Hello!
Replying to your post in this thread because I did not want to mix up two topics there!
Anyways, the variables can be directly manipulated in XSE without the use of their address.
You can use something like: "setvar (variable number) (value)" to assign a value to a particular variable. Just like your example in the post, setvar 0x4001 0x00 will cause the variable 0x4001 to have value 0 stored in it.
If you wish to use this value/variable for a different task, then you can use the following syntax:
compare (variable to compare) (value to compare with)
if (condition) call/goto @true
There is a bit to explain here.
"compare (variable to compare) (value to compare with)" is self-explanatory. If you write "compare 0x4001 0x0", then the game will check if variable 0x4001 is equal to 0, or greater than or less than 0, etc etc.
The "(condition)" is the main focus here. In case of flags, there are only two options to check: set or cleared. That is why after a checkflag we do either "if 0x0 goto @somewhere" or "if 0x1 goto @somewhere"
But the check for variables go even further. There can be values from 0x0 up to 0x5 over there. Each value has a different meaning:
0x0 = Lower Than
0x1 = Equals
0x2 = Greater Than
0x3 = Lower than or Equal to
0x4 = Greater than or Equal to
0x5 = Not exactly equal to
Here is an example to clear things more. Say, you wanted to know if variable 0x4069 is greater than 0x5. If it is greater than 0x5, then the code would branch to a different portion. Then the comparison would be:
compare 0x4069 0x5
if 0x2 goto @otherpart
You can also use 'call' in place of 'goto'. The difference between 'goto @there' and 'call @there' is:
'goto @there' tells the code to just entirely branch off to the new location if the said condition is true and ignore everything below the goto line.
'call @there' tells the code to go to the specified new location, do the stuffs written there and then come and continue executing orders from the line below the call line.
I hope this helps! Sorry if the explanation has become a little too big! You can ask me for more help if needed! Also, there are some fantastic XSE script tutorials in Pokecommunity! You can check them out!