Money Commands
This is a pretty big section, so I'll split it up into 6 sections for each of the money related commands.
- givemoney
- paymoney
- checkmoney
- showmoney
- hidemoney
- updatemoney
I'll explain them in the order they were listed.
Givemoney
The name gives it away. This command will give the player a designated amount of money. The command is set out like this.
Let XX be the money value:
givemoney [XX]
0x00
The final
0x00 actually determines whether it updates your money account. If it were changed to
0x01, the money balance does not change and therefore defeats the purpose of the giving the player money. I'll move onto explaining the money now.
I'll give you an example to show what's happening. We'll use the amount 10,000. so let's convert 10000 to Hex, which gives us 0x2710.
Here's our line of code:
Code:
givemoney 0x2710 0x00
You should be able to understand what's happening. I'll give another example, just in case you need it:
Money amount = 500 [hex = 0x1F4]
Code:
givemoney 0x1F4 0x00
]I'd say that's enough information on
givemoney.
Paymoney
Like
givemoney, the name gives the function away. This command takes money from the player.
The command is set up in an almost identical manner to
givemoney. I'll show the setup again, just in case you forgot already:
Let XX, be the money value:
paymoney [XX]
0x00
The final
0x00 has the same function as what it does with
givemoney.
Just in case you wanted it, here's an example:
Money amount = 600 [Hex = 258]
Code:
paymoney 0x258 0x00
Ta-dah! You've now learned the
givemoney and
paymoney commands.
Checkmoney
This command, obviously, checks if your account for a designated amount of money. It's set up in the same way as the previous two commands, but there is a difference. I'll show you how it's set up.
checkmoney [XX]
0x00
Looks the same, doesn't it? That's because it is exactly the same. The difference is that the reason for the
0x00 at the end is for something different than the other two.
0x00 means "Check Money account", and
0x01 would mean "Don't check Money account", so if you were to use
0x01, it would defeat the purpose of the command.
Now, how do we check the amount? Remember the
countpokemon command? We check in that same way, using the
compare and
if lines.
Here's also a little example, just in case that wasn't explained very well:
Conditions:
Money amount = 1000 [Hex = 3E8] ;
Need at least 1000 to continue in script
Code:
checkmoney 0x3E8 0x00
compare 0x800D 0x1
if 0x4 goto @continue
msgbox @notenough 0x6
Just in case you feel that you need another example, here's one more:
Conditions:
Money amount = 20,000 [Hex = 4E20] ;
Need less than 20,000 to continue in script
Code:
checkmoney 0x4E20 0x00
compare 0x800D 0x1
if 0x0 goto @continue
msgbox @toomuch 0x6
Showmoney
This breaks away from the style that the other money commands are written in. It's set out like this:
Code:
showmoney [X coordinate] [Y coordinate] 0x00
Okay. The first byte is
showmoney, obviously, followed by the X coordinate and the Y coordinate on the screen. Personally, I just the co-ordinates (0,0). I think that by now you can just trust me and just use
0x00 for that last byte. There's a reason, but if you remember the reasons for the previous commands, just use the
0x00.
Here's a little example of what how it is set out:
X and Y co-ordinates - (0,0)
Code:
showmoney 0x00 0x00 0x00
This box will appear in the top left hand corner of the screen.
Hidemoney
This one is also different from the rest of them. This command is set out like this:
Code:
hidemoney [X coordinate] [Y coordinate]
The second and third arguments are just the co-ordinates of the shown money box.
If I were to write this to counter-act the effect of my previously shown script, my
hidemoney line would appear like this:
Code:
hidemoney 0x00 0x00
Nice and simple.
Updatemoney
This is the last money command. It's simply set out like this:
Code:
updatemoney [X-Co-ordinate] [Y-co-ordinate] 0x00
Like the
hidemoney command, the X & Y co-ordinates need to compliment the co-ordinates of the
showmoney. Well, I'll just show an example, I guess.
Code:
updatemoney 0x00 0x00 0x00
I guess now I can move onto some different commands now.
Addvar
The name says it all. It says "Add to Variable". Before I explain what it does, I'll show you how it's set out.
Code:
addvar [Variable] [Value]
addvar will add the designated value to the value that is already stored within the designated variable. What a mouthful. If that's a little complicated, I'll simplify it.
As an example, let's say the variable 0x4036 already has the value 0x1 stored into it, and we want to add 0x3 to it to make it 0x4.
I'll put it into an example:
Code:
setvar 0x4036 0x1
addvar 0x4036 0x3
That's pretty much all there is to it. It's up to you to find a use for it.
Subvar
Of course, since we can add to a variable, we must be able to subtract from the variable. It's set out in the exact same way as
addvar:
Code:
subvar [Variable] [Value]
Since it's just the opposing function to
addvar, I think I can just go straight through to the example:
Code:
setvar 0x4004 0x6
subvar 0x4004 0x03
In the example, it takes 0x3 from what is stored in the variable 0x4004.
Lockall
It's just
lockall. There's no other arguments. It's used when you want to lock all the people in the map, instead of locking just the person you're talking to. It's pretty useful.
Showpokepic
The name may be a little misleading. This command can bring up an image of a designated Pokemon. The command is set out like this:
Code:
showpokepic [Pokemon No.] [X coordinate] [Y coordinate]
We obviously need to begin with the command. Then, it's followed by the Pokemon number, which needs to be in hex. This is then followed by the X and Y coordinates of where you want the image of the Pokemon to appear. Here's a little example to help clarify things:
Conditions:
Pokemon = Dratini
Coordinates = (10,3) Center of Screen.
Code:
showpokepic 0x93 0x0A 0x03
I'd say that's about it for now, but I'll show a bigger example in the next section.
Hidepokepic
Without using this, your
showpokepic box will remain open until you leave the map.
The command is just
hidepokepic. There's no need for any arguments.
Well, here's an example of the two commands combined in a fragment of a script.
Code:
showpokepic 0x01 0x0A 0x03
msgbox @1 0x5
compare 0x800D 0x1
if 0x1 goto @seen
hidepokepic
msgbox @2 0x6
..... .....etc.
#org @seen
hidepokepic
msgbox @3 0x6
......... .........etc.
#org @1
= Have you seen this Pokemon?
#org @2
= That's too bad.
#org @3
= That's cool. I wish I could\nsee it.
The
hidepokepic just closes the
pokepic box.
Door Commands
There are three door related commands.
- setdooropened [prepare to open door]
- setdoorclosed [prepare to close door]
- doorchange [activate door animation]
I guess we'll start with
setdooropened.
Setdooropened
Obviously, this opens doors on a map. It's set out like this:
Code:
setdooropened [X coordinate] [Y coordinate]
Here's an example. Oak's Lab's Door in Pallet Town's coordinates are (10,0D).
Code:
setdooropened 0x10 0x0D
So try it in a ROM. Did it work?
It didn't, did it?
Here's the reason why. It need to be followed by this command.
Doorchange
This command needs to follow both
setdooropened and
setdoorclosed. Without this command following, they don't work. This command doesn't need any arguments. Here's an example, with the
setdooropened command:
Code:
setdooropened 0x10 0x0D
doorchange
Setdoorclosed
It's set out in the same way as the
setdooropened command. I'll show you the set-up again, just in case you've already forgotten.
Code:
setdoorclosed [X coordinate] [Y coordinate]
I'm going to show an example using all three commands:
Code:
setdooropened 0x10 0x0D
doorchange
applymovement 0xFF @move
waitmovement 0x0
setdoorclosed 0x10 0x0D
doorchange
warp 0x4 0x3 0x0
Coin Commands
There are 6 coin commands, and they are very closely "related" to the money commands, as they have similiar arguments. Here's a list of the different commands:
- checkcoins
- givecoins
- removecoins
- showcoins
- hidecoins
- updatecoins
I'll work my way from the top down, I guess.
Checkcoins
This is a pretty simple command, and isn't as difficult or as long as
checkmoney. It checks to see if you have a certain amount of coins. It's set out like this:
Code:
checkcoins [Amount]
Here's a short little example:
Check for 3000 coins; if higher than, continue
Code:
checkcoins 0xBB8
compare 0x800D 0x1
if 0x4 goto @continue
Givecoins/removecoins
Since they have similiar aguments, I thought I'd put these two together.
This is how they are set out:
[command] [Amount]
I guess I'll give an example of both so we can move onto the other three commands:
givecoins
Give 1000 coins
removecoins
Take 1000 coins
Showcoins
This command will display a little box with your coin count. It's set out in a similiar way to
showmoney, except you drop off the last argument. This is how the command is set out:
Code:
showcoins [X Coordinate] [Y Coordinate]
As an example, the co-ordinates (0,0) will appear like this:
Code:
showcoins 0x00 0x00
Not hard, is it?
Hidecoins
Obviously, this command hides the coin counter that was brought up with the
showcoins command. It's set out in the same way as
showcoins, but if you want to see it again, here it is:
Code:
hidecoins [X Coordinate] [Y Coordinate]
Just remember that without this command, the counter will remain until the map is reset.
Updatecoins
Of course, this will update the coin counter and show any changes within your "coin balance". How's this set out? I bet you would be able to guess correctly. It's set up the same way as the
showcoins and
hidecoins, and just for the heck of it, I'll show the example again.
Code:
updatecoins [X Coordinate] [Y Coordinate]
Here's what I promised. I'll make it a little bigger than what I normally do. I shouldn't have to explain this script because you should be able to understand it:
Code:
showcoins 0x00 0x00
givecoins 0x3E8
updatecoins 0x00 0x00
msgbox @1 0x5
compare 0x800D 0x1
if 0x1 goto @begin
hidecoins 0x00 0x00
msgbox @2 0x6
release
end
#org @1
= Is there anything else?
#org @2
= Thank you! Please come\nagain!
There! I've used four of the six commands in a few lines of one script.
Displaying Names/Values
The title may be a little hard to understand. This section is dedicated to assigning names of Pokemon, names of Items and numbers to
\v\h02 and others of the sort.
Here's a list of the commands that we will go over.
- bufferpokemon
- bufferfirstpokemon
- bufferitem
- bufferattack
- buffernumber
Like always, I'll start at the top and work my way down.
Bufferpokemon
With this, we will assign a certain Pokemon's name to a
\v\hXX variable.
It's set out like this.
Code:
bufferpokemon [buffer#] [PKMN Number]
We have to subtract two from the end of the [buffer#] and use that number.
Here's an example. We're going to assign Charizard's name to [buffer1].
bufferpokemon 0x00 0x06
msgbox @1 0x6
release
end
#org @1
= How is [buffer1]?[/code]Nice and basic. Just in case you want a second example, I'll 'chuck' one more below.
Pokemon = Chikorita; Storing to? = \v\h03
Code:
bufferpokemon 0x01 0x98
msgbox @1 0x6
release
end
#org @1
= How's \v\h03 going?
Bufferfirstpokemon
This command is set out a little differently to the one above. We just set it out like this:
Code:
bufferfirstpokemon [buffer#]
There's just two bytes needed for it to work.
Since it's such a short command, I'll just show an example. In the example, we're going to show how to assign the first Pokemon in the party's name to [buffer1].
Code:
bufferfirstpokemon 0x00
msgbox @1 0x6
.... ....
#org @1
= Let me give \v\h02 a haircut.
Bufferitem
It's set out in the exact same way that
bufferpokemon is, but it's still worth showing. In case you've forgotten how
bufferpokemon was set out, here's how
bufferitem is set out.
bufferitem [buffer#] [item #]
Since there really isn't too much need for a second explanation, I'll move straight into the example:
Code:
bufferitem 0x00 0x04
msgbox @doyou 0x5
.... .... ....
#org @doyou
= Do you have any [buffer1]s?
Notice how I've added "s" straight after
[buffer1]. If you don't know why, it's so that the message will appear like this:
Quote:
|
Do you have any POKe BALLs?
|
Bufferattack
I bet you could probably guess how this command is set out. It's done the same way as
bufferitem and
bufferpokemon. It's set out like this.
Code:
bufferattack [buffer#] [attack #]
I think the only thing is that I haven't given you a list of the attacks yet, have I?
Anyway, here's the list. This will come in handy a little later:
HEX Values
Now I guess I could jump into an example now, couldn't I?
Code:
bufferattack 0x00 0x13B
bufferpokemon 0x01 0x06
msgbox @1 0x5
... ...
#org @1
= Can [buffer2] use [buffer1]?
I just thought I'd make it a little more confusing.
The message actually says:
Quote:
|
Can Charizard use Overheat?
|
Buffernumber
This is just used to display a number stored in a variable. It's set up like this:
buffernumber [buffer#] [Variable]
The downside of this command is that it can only display numbers from 0-65535 [Hex = 0x0 - I'll show an example. We're going to put the number 50000 in [buffer1].
Code:
setvar 0x800D 0xC350
buffernumber 0x00 0x800D
msgbox @1 0x6
.... .... ....
#org @1
= Account Balance: \hB7: [buffer1]
That's all there is to it.
Msgboxsign
This is a fun little command. This will turn your normal
msgbox into a Signpost Box. Here's an example:
Code:
#dynamic 0x800000
#org @start
msgbox @1 0x6
msgboxsign
msgbox @1 0x6
msgboxnormal
msgbox @1 0x6
release
end
#org @1
= Test.
Try this in a ROM.
The first message should appear as a normal
boxset 0x6. But when we used
msgboxsign, our second
boxset 0x6 became a signpost box. But what's this
msgboxnormal doing here?
msgboxnormal converts the box back into a normal
boxset 0x6. This is just a little playful command that gave us a break from the commands that are having four and five arguments.
Callasm
This command is used to call an ASM function that you have added to the ROM. I'm not going to write an example. I'm going to use the example of the command used with Mastermind X's "Shiny Hack".
This is his hex script:
Quote:
|
Originally Posted by Mastermind_X
0071b7a0h: 23 71 B7 71 08 00 B6 82 00 1E 00 00 00 25 38 01 ; #q·q..¶‚.....%8.
0071b7b0h: 28 01 01 23 71 B7 71 08 02 FF FF FF FF FF FF FF ; (..#q·q..ÿÿÿÿÿÿÿ
|
With his explanation
Quote:
|
Originally Posted by Mastermind_X
[23] //asm call
[XXXXXXXX] //pointer to thumb-sub+1
[00] //filler
[B6] //define wild pokemon
[XXXX] //pokemon-id (INGAME)
[XX] //level
[XXXX] //held Item
[00]
[25] //special-event
[3801] //wild pokemon battle!
[28] //wait
[0101] //a second
[23] //asm call
[XXXXXXXX] //pointer to thumb-sub+1
[02] //end
|
Now here's my version of his script in XSE language:
Code:
#dynamic 0x800000
#org @start
callasm 0x71B771
wildbattle 0x82 0x1E 0x0
special 0x138
pause 0x101
callasm 0x71B771
end
with a bit more of an explanation.
He's called the ASM function twice: once to turn it on, and once to turn it off.
I think he's explained everything else.
Getplayerpos
getplayerpos can be used to store the player's X and Y positions on the map into designated variables.
The command is set out like this:
Quote:
getplayerpos [xxxx] [yyyy]
xxxx: Variable for x position
yyyy: Variable for y position
|
Here's an example. With this, we'll store the Player's X Position to 0x4000, and the Player's Y position into 0x4001.
Code:
....
getplayerpos 0x4000 0x4001
....
Repeattrainerbattle
This is a simple command that will begin the Last Trainer battle commenced. It's done simply with command
repeattrainerbattle.
We can easily use this in a script by simply doing:
Code:
repeattrainerbattle
Releaseall
This command is used as the opposite to '
lockall''. This command will release all sprites on the current map.
Here's how it can be used:
Waitkeypress
This command can be used as a pause. The command
waitkeypress is used to wait until a key is pressed before it continues.
It's used like this:
It doesn't need any arguments.
Yesnobox
This command is somewhat pointless when there is
msgbox @text 0x5. It acts in the same way as
0x5 where when you use compare, yes = 1 and no = 0. Its only reason for use might be to have some flexibility as to where you want the box to be placed.
The command is set out like this:
xx: X co-ordinate
yy: Y co-ordinate
In a script, we can use it like this:
Code:
msgbox @1 0x4
yesnobox 0x0 0x0
closeonkeypress
compare 0x800D 0x1
if 0x1 goto @yes
Multichoice, preparemsg, waitmsg
Yes, it's something people want to use, so here's a brief guide on
multichoice and two other commands that normally accompany it.
I'll show an example first, which will make it easier for me to explain how it's used:
Code:
preparemsg 0x161232
waitmsg
multichoice 0xE 0x0 0x1E 0x0
copyvar 0x8000 0x800D
compare 0x8000 0x0
if 0x1 goto @option1
compare 0x8000 0x1
if 0x1 goto @option2
compare 0x8000 0x2
if 0x1 goto @option3
compare 0x8000 0x3
if 0x1 goto @option4
compare 0x8000 0x4
if 0x1 goto @option5
compare 0x8000 0x5
if 0x1 goto @option6
compare 0x8000 0x7F
if 0x1 goto @canceled
end
First, I'll explain
preparemsg. The following four bytes refer to the pointer to text.
waitmsg is similar to
closeonkeypress. This command is special and is used with
preparemsg to close it.
Now onto the
multichoice command. YAY! Well, it's set out like this:
Quote:
|
multichoice [xx] [yy] [zz] [aa]
|
xx: X co-ordinate
yy: Y co-ordinate
zz: Multi ID. Refer to Multi List
aa: Determines if B can cancel. 0x0 means B can cancel.
The first two parameters are easy to use. Like other commands, they are just the X and Y co-ordinates on the screen.
The third parameter is the options that appear on the multi list. It's for Fire Red, so sorry to Ruby hackers.
Spoiler:
[00] - Yes
No
[01] - Eevee
Flareon
Jolteon
Vaporeon
Quit looking.
[02] - Normal
Black
Pink
Sepia
[03] - Hall of Fame
Quit
[04] - Eggs
Quit
[05] - Victories
Quit
[06] - Hall of Fame
Eggs
Quit
[07] - Hall of Fame
Victories
Quit
[08] - Eggs
Victories
Quit
[09] - Hall of Fame
Eggs
Victories
Quit
[0A] - Exit
[0B] - Exit
[0C] - Exit
[0D] - Bicycle $1,000,000
No Thanks
[0E] - Abra 180 coins
Clefairy 500 coins
Dratini 2,800 coins
Scyther 5,500 coins
Porygon 9,999 coins
No Thanks
[0F] - SLP
PSN
PAR
BRN
FRZ
EXIT
[10] - Yes
No
Info
[11] - Single battle
Double battle
Multi battle
Info
Exit
[12] - Yes
No
Info
[13] - Make a Challenge
Info
Exit
[14] - Rooftop
B1F
Exit
[15] - Helix Fossil
Exit
[16] - Dome Fossil
Exit
[17] - Old Amber
Exit
[18] - Helix Fossil
Old Amber
Exit
[19] - Dome Fossil
Old Amber
Exit
[1A] - Fresh Water $200
Soda Pop $300
Lemonade $350
Exit
[1B] - 50 coins $1,000
500 coins $10,000
Exit
[1C] - Excellent
Not So Bad
[1D] - Right
Left
[1E] - TM13 4,000 coins
TM23 3,500 coins
TM24 4,000 coins
TM30 4,500 coins
TM35 4,000 coins
No Thanks
[1F] - 5F
4F
3F
2F
1F
Exit
[20] - Fresh Water
Exit
[21] - Soda Pop
Exit
[22] - Fresh Water
Soda Pop
Exit
[23] - Lemonade
Exit
[24] - Fresh Water
Lemonade
Exit
[25] - Soda Pop
Lemonade
Exit
[26] - Fresh Water
Soda Pop
Lemonade
Exit
[27] - Trade Center
Colosseum
Exit
[28] - Game Link Cable
Wireless
Exit
[29] - Smoke Ball 800 coins
Miracle Seed 1,000 coins
Charcoal 1,000 coins
Mystic water 1,000 coins
Yellow flute 1,600 coins
No Thanks
[2A] - B1F
B2F
B4F
Exit
[2B] - Linked game play
Direct Corner
Union Room
Quit
[2C] - Two Island
Three Island
Exit
[2D] - One Island
Three Island
Exit
[2E] - One Island
Two Island
Exit
[2F] - Trade Center
Colosseum
Berry Crush
Exit
[30] - Nada
Nada
Exit
[31] - Pokemon Jump
Dodrio Berry-Picking
Exit
[32] - Trade Center
Colosseum
Exit
[33] - 2 Tinymushrooms
1 Big Mushroom
[34] - Trade Center
Colosseum
Berry Crush
Exit
[35] - Trade Center
Colosseum
Exit
[36] - Sevii Islands
Navel Rock
Exit
[37] - Sevii Islands
Birth Island
Exit
[38] - Sevii Islands
Navel Rock
Birth Island
Exit
[39] - One Island
Two Island
Three Island
Exit
[3A] - Vermilion
Two Island
Three Island
Exit
[3B] - Vermilion
One Island
Three Island
Exit
[3C] - Vermilion
One Island
Two Island
Exit
[3D] - Vermilion
Exit
[3E] - Blank
Blank
Exit
[3F] - Join Group
Become Leader
Exit
[40] - Single
Double
Knockout
Mixed
Exit
From the example script, you should be able to tell that the selected result from
multichoice is stored into the variable 0x800D.
You should be able to see I copied it to variable 0x8000 to see if it would confuse anyone. I hope it didn't. The
copyvar was not needed. You can just
compare with 0x800D, but by now, you should already know that.
The following
compares should be fairly obvious as to what they do. They compare what option has been selected. 0x0 is the top option, 0x1 is the second to the top, and so on until the final option.
Name Pokemon
Here's another working Name Pokemon sequence, although this one will only work if the Pokemon is given into the party and not a PC box. Here's a script where it can be used. I'll explain it in the code.
But before I do that, Pokemon's party position is [Position] - 1. First in line is 0x0. And sixth would be 0x5. Now the script...
Code:
countpokemon
compare 0x800D 0x6 'If you have 6 Pokemon, don't continue.
if 0x1 goto @toomany
givepokemon 0x1 0x5 0x0 'Gives a Pokemon
msgbox @2 0x5 'the obligatory, "Would you like to rename....
compare 0x800D 0x1
if 0x1 gosub @name 'If yes call .... ....'
Who cares about this part?
#org @name
countpokemon 'Counts Pokemon
subvar 0x800D 0x1 'Takes one away from 0x800D. Reason Above.
copyvar 0x8004 0x800D 'copies over to 0x8004 which is used by special 0x166
fadescreen 0x1 'Fades screen to black
special 0x166 'Name Pokemon, Party number at 0x8004
waitstate 'Wait for Special
return 'Returns
#org @toomany
msgbox @1 0x6
release
end
#org @1
= Your party is full.\nPlease deposit one to\nmake room.
#org @2
= Would you like to give a\nnickname to this Pokemon?
Hope that helped.
Store Pokemon to Pokedex
Okay, so here's another string like the
Name Pokemon above. It simply adds a Pokemon to the 'Seen' section of your Pokedex.
This one is fairly easy to do. Here's the script. It'll make it easier for me to explain.
Code:
setvar 0x8004 0x97
special 0x163
See? Nice and short.
Pretty basic too. We put the Pokemon number of the Pokemon we want to set to 'Seen' to 0x8004. In this case, I'm preparing Mew to appear as Seen.
Special 0x163 only finishes the job and actually sets it as Seen in your Pokedex.
That was a very extensive and in-detail scripting tutorial. Hope you enjoyed it!
If you see any bugs, feel free to tell me about them.
P.S. It took me about a week to convert to XSE style.
1-17-09 P.P.S. It's been MEGA-UPDATED! WOOT!