[Cache] Any Particular Reason?

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

[Cache] Any Particular Reason?

Post by naturesfury »

is there any particular reason JJCP And Fai's CP uses gamecaches instead of variables?
from what i understand, caches work like variables except they can carry stuff outside of the single game instance to load things from another map.......

but keybindings don't need to be carried over.........do they? o.o
owner123
Super Moderator
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm

Re: [Cache] Any Particular Reason?

Post by owner123 »

I think the gamecache is to identify the cheatpack/version.
I'm not 100% sure though.
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: [Cache] Any Particular Reason?

Post by naturesfury »

O.O?
it can do that?
weird.......didnt notice anything about that....
all it did was store/get strings from the cache
(on both Fai's and JJCP)
for fai i guess the name of the cache (blahblah.w3v) could be the version....but JJCP just has keybindings.w3v
and well, the keybindings dont even carry over (if u -binddown -gold 500 one game, u cant use the bind hotkey for another) ><
sooooooooo i rly dont see a point.......
-confused-
X3n0nX
Member
Posts: 63
Joined: December 22nd, 2010, 7:37 am
Title: Administrator
Location: Middle East

Re: [Cache] Any Particular Reason?

Post by X3n0nX »

I'm not so sure about this but, here's what I got.

The gamecache you see in the very first line is called "CACHE",

Code: Select all

gamecache CACHE=InitGameCache("KeyBindings.w3v")

If you knew simple JASS, you should know what this global variable do. First of all, it creates a variable called "CACHE" and a gamecache which is "KeyBindings.w3v".
_____________________________________________________________________
I just skimmed the CP and not so entirely sure about this but, it seems that the CACHE is used for the key bindings to work. When you set a command into a key, it saves the command in the CACHE, which is a string. And just calls the stored string in the CACHE when you press "that" key.

Code: Select all

call Cheatz(GetTriggerPlayer(),GetStoredString(CACHE,I2S(GetPlayerId(GetTriggerPlayer())),"up"))
When you press the "up" arrow key, it gets the stored string in CACHE which is the command. ;)
_____________________________________________________________________
Please note that I'm not sure about what I had mentioned above, I just skimmed the CP. I would read the whole CP but, I just won't for the meantime, I lack time. :), I'll check FAI for you, if there's a chance.

EDIT: And yes, you can use gamecaches from other maps when the maps are using the same gamecache, but I think JJ didn't made it that way, It could cause bugs.
Image
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: [Cache] Any Particular Reason?

Post by naturesfury »

LOL ummmmmmmm yea.......i alrdy knew that >.>
im saying.........that a variable would work the same (an integer/string array)
and JJ doesnt use gamecache to tranfer data from map to map
so....why does he use a cache instead of a variable
if only JJ did that, i woulda dismissed it as his random choice of doing things
but FAI did that too, so i was wondering if theres a particular reason a cache is used for keybindings instead of a variable
X3n0nX
Member
Posts: 63
Joined: December 22nd, 2010, 7:37 am
Title: Administrator
Location: Middle East

Re: [Cache] Any Particular Reason?

Post by X3n0nX »

If you would use a variable, then, you will need a variable for each of the arrow key. You don't want to overwrite the binded command on the right arrow key when you bind another key to the up arrow key. That would mean you can only bind one command at a time, but if you use 4 variables. It would work, but using gamecaches are much more efficient. You only need one gamecache, it saves memory. And much easier to use than using 4 variables. Besides variables, you can also use hashtables, which works similar to a variable. Instead, hashtables can save hashes, which variables can't. Also hashtables can save decimals, which variables can't. Hashtables can also save what variables can save, they just can do more than variables and are much more efficient than variables.

Also, I never replaced the hashtable to a variable, hashtables works. And I'll be sticking to that,
Image
User avatar
UndeadxAssassin
Grammar King
Posts: 2116
Joined: June 22nd, 2008, 10:11 pm
Title: Worst human for 4eva
Location: Mostly USEast

Re: [Cache] Any Particular Reason?

Post by UndeadxAssassin »

(20:53:52) Bartimaeus: Thank you, Jen.
(20:53:56) Bartimaeus: Truly, you are wise.
(23:44:12) Bartimaeus: I was in pubic school until middle school...
Learn how to extract and read RAW Codes here!

Need help? Click here and ask your question!
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: [Cache] Any Particular Reason?

Post by naturesfury »

erm.......u do no that arrays exist o.o
and....real saves decimals....

and @undead
ill pm what i was gonna post cause u might still not want the act revealed
X3n0nX
Member
Posts: 63
Joined: December 22nd, 2010, 7:37 am
Title: Administrator
Location: Middle East

Re: [Cache] Any Particular Reason?

Post by X3n0nX »

You do know that arrays actually is another variable. So 4 arrays = 4 variables. What do you prefer? Using 1 gamecache for all the key bind functions, or creating 4 variables for each of the key bind functions. Gamecache is more accurate, more efficient, and easier to use.

@Undead, yes, it works the same thing, you store the string in the gamecache. :)
Image
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: [Cache] Any Particular Reason?

Post by naturesfury »

huh????
u only need one array........?
u no...that varname[number 0-8982]