Quote:
Originally Posted by frabulator
Thats what I was thinking as well, however I do not know how to create a variable in pokemon scripts. In VB its easy enough as 'dim vr as variable = 0" and then "vr = vr +1". But in Pokescripts, I'm lost.
|
Yeah, pokescripting isn't a programming language and you can only use the defined commands. You don't have to declare any variables. They're all global, and all of the non-temporary ones will retain their value through saves. In scripting, to do arithmetic and variable logic, you need to use the scripting commands. So to add or subtract there are specific commands like addvar and subvar that you need to use.
To setup a way to count:
Quote:
setvar 0x8000 0x0 ' set the value of the variable to 0, so we can start counting from 0
checkflag 0xbadge1
if true call @incrementvar
checkflag 0xbadge2
if true call @incrementvar
checkflag 0xbadge3
if true call @incrementvar
...
|
To check amount of badges earned after you've counted:
Quote:
compare 0x8000 0x1
if 0x1 goto @onebadge
...
|
Incrementing a variable
Quote:
#org @incrementvar
addvar 0x8000 0x1
return
|
I would recommend breaking it down into these 3 parts. Because later on, you could just do something like, "call 0xaddress_for_count_badges" and conserve ROM space.