the compare command is like check flage?
and setvar is like set flag?
so checkflag 0xflag number = compare 0xvariable 0xvalue like
0x0 = no
0x1 = yes
and setvar 0xvariable 0xvallue either 0x0 or 0x1 is the same as setflag 0xflag number?
No, not exactly.
You can't use a variable from something you need a flag for, so trying to use a variable in a spot a flag must go won't work.
Also, only flags return just Boolean results, (True/False... 0= no, 1= yes)
Variables store numbers to be used elsewhere.
You can use variables to define the type of pokemon a player is given in a script, or even defining the strength of an earthquake. They can be used to choose how and where to ride a boat, giving players a random item from a list, or just a random item if you prefer.
Remember, that a variable can only store a number from 0 to 65535 (or 0x0 to 0xFFFF in HEX) so storing entire pointers, you can not do, but a variable can change what pointer your script chooses from to branch off to another script.
Each command that calls for a variable will MOST LIKELY use a variable differently from another.
For instance, givepokemon has quite a few parameters, and you can use a variable to change the pokemon it gives, without having to branch off to a completely different script.
(If I remember correctly, I know that the giveitem command lets you use variables to define it's parameters...)
Now, lets say the player gets Any of the 3 starter pokemon from Kanto at random, bulbasaur, charmander, and squirtle...
Now, we COULD make a branching script for all of these... or we can optimize it and use variables instead.
Just write the variable in the Pokemon # portion of the givepokemon command, and have the script change the variable with the various variable setting commands to get your desired number...
setvar - Sets a variable
copyvar - Copies a variable to a variable
addvar - Adds a number to a variable
subvar - must I explain?
comparevars - Compares the 1st variable to the 2nd, it's used exactly like the compare command, only it can use 2 variables instead of a variable and a static number.
random - Generates a psuedo-random number between 0 and the given number (If my memory serves me right)
All useful commands that require variables.
There is bound to be a few more variable manipulating ones out there but I cna't remember off the top of my head.
(Technically, writebytetooffset would count since you CAN manually change a variable, it's just not wise to do so without knowing what you are doing...)
(even if it seems confusing now, keep at it, you'll get it eventually!)
I would suggest NSE, it has it bookmarked so u can change it. you would just need to export the one you want, then insert it again to the hero one.
It would be easier to just open NSE, get the offsets for both the sprite you want to use later, and the current hero sprite from the bookmarks file, then open up a hex editor, and look for a pointer to the hero backsprite, and change it to the offset of the backsprite you want to use that is already in-game.
If you're working with R/S the only thing I can think of as a problem would be the intro movie...
In Ruby and Sapphire, the intro movie shows May and Brendan's backsprites, so you'd want to be sure when repointing that the changes you make actually do what you wanted it to do.
This way you don't have to insert another copy of the image data into the ROM.