Cirrus' Ridiculously-Long XSE Scripting Tutorial (Not Finished ATM o.o)
Page 1 of 1 • Share
Cirrus' Ridiculously-Long XSE Scripting Tutorial (Not Finished ATM o.o)
Hello, Shaychuians. Have you ever wanted to completely customize a Pokemon game? Make people say whatever you want, walk around, give you any Pokemon/item you want, or even create your own trainers with your own choice of Pokemon? Your computer g33k friend Cirrus will be teaching you how to do this, and moar if he feels like it.
This article will cover how to write a script to your Pokemon ROM. ROM links are illegal, so you'll have to find one yourself. But I will give you links to the tools that you'll need to start your Pokemon-hacking hobby:
Advance Trainer - This tool will allow you to customize any trainer in your Pokemon game, including which trainer they are, the music that plays, their Pokemon, the Pokemon's held item, as well as the trainers' name.
XSE - The best scripting tool out there IMO. This will be one of your most-used tools if you plan to script. There are older scripting programs such as scriptEd and Pokescript that can be used as well, but the computer language that is used for it is somewhat different than XSE, and they are outdated, so I wouldn't normally recommend them. Writing the scripts to your ROM using these programs takes longer, and also requires that you make multiple files.
Free Space Finder - I believe this comes with XSE when you download it, but if it doesn't here it is. This is mainly used for finding free space to write scripts to in XSE, and as such, it'd be a great idea to integrate it with XSE through the drop-down menu that can automatically open up FSF. How to do this will be covered later in the article.
unLZ - A bit buggy and somewhat complex, but this tool is the most popular of its kind. This tool allows you to change the graphics of any picture in your Pokemon game. Sounds simple, doesn't it? Well, this program deserves its own tutorial, so using this will be covered later on.
AdvanceMap v1.92 - A must-have for any kind of ROM hacker. This tool is very easy to use, and allows you to completely customize any map in the game, as well as change the position and sprite type of any person in the game. It is also needed in scripting to appoint scripts to the game, and to people. Many other easy-to-use tools come with this, including PET (another trainer editor) and PokeCryGUI.
APE (Advanced Palette Editor) - A tool that allows you to change or swap color palettes in your ROM. More details on it will be included in future articles.
Lunar IPS (LIPS) - A very useful tool that makes patches from your ROMs so that you can apply said patch to a clean Pokemon ROM, and convert it into your customized game. Think of it as a 'change saver' that you can patch onto an unmodified ROM to give it the changes.
Elite Map - A more advanced program that does what AdvanceMap does, and more. I'm not very familiar with this program, as I mainly use AdvanceMap. But if you want to get more complex with your ROM-hacking, EliteMap is an option.
Advance Mart - A very user-friendly tool that allows you to edit Pokemart items.
Advance Starter - Allows you to change the starter Pokemon in the game.
Before we do any scripting, we'll make our lives easier, and integrate FSF with XSE. It is much easier than it sounds. All you need to do is put FSF in the same folder as XSE. That's all there is to it, but it will help you out a lot in the future.
Alright, on to scripting. You will need XSE above, AdvanceMap, Free Space Finder, and a Firered, Leafgreen, Ruby, Sapphire or Emerald ROM. First, open up XSE. On the File tab, select 'Open', and choose your ROM.
I'll start off with the most basic of scripts - we're gonna make someone in the game say something. It can be whatever we want.
I'll explain this from the top down.
#dynamic 0x800000 at the top is the offset that the game will use to write the script to the ROM. To use any kind of information, the ROM needs to know where the info is, and this offset tells it this. To find free space in your ROM, go to the Tools dropdown menu in XSE, and select 'Free Space Finder' (you DID integrate it with XSE, didn't you? o.O). When FSF comes up, it'll look like this:
Click on 'Search'. Assuming you opened that ROM, it will give you an offset number that you can use for the script. Select 'Copy', and X out of FSF. Then paste this offset number after the '0x' in #dynamic. KEEP NOTE OF THIS NUMBER. You will need it after you write the script to the ROM!
Back to the script, #org @message is the pointer that will be used for the script, and declares the start of the script. 'Message' can be anything you want, as long as it doesn't start with a number! @main, @script, @start, @iliekmudkipzlulz, anything you like.
lock prevents your character from moving when the script is being executed, as you may have noticed if you played a Pokemon game.
faceplayer turns the sprite you're talking to to you while the script is being executed.
msgbox is the XSE command to show a message box at the bottom of the screen. It is preceded with the pointer that contains the text to be shown in this box.
0x6 is the 'normal' box number. There are 5 different types.
0x2
0x3
0x4
0x5
0x6
release at the end of the script instructs the game to cancel out the lock effect that was defined earlier, and end, of course, ends the script.
As with most programming languages, variables are declared after the initial program processes. In this script, @message was declared during the msgbox command that we used earlier. "#org @message" is where the defined text is stored for the @message variable. It is preceded on the next line by an = sign, followed by the message you wish to display.
In messaging, there are 6 commands for line positioning.
\c is used for coloring text.
\h is used to define hex values, particularly used for special characters in the game.
Shows as "I have $200! " in the game, as hex B7 in the game is the currency symbol.
A complete list of all the hexes for each special symbol:
\n is used to indent onto a new line.
[quote=Me]Hello.\nI'm Cirrus.[/quote]
Shows up as:
[quote=Me]Hello.
I'm Cirrus.[/quote]
\l indents the text to a new line, but it can only be used after \n is used.
[quote="Me]Hello.\nI am Cirrus.\nYour creator.\nYour teacher.[/quote]
Would show up as:
\p can be used to continue the message in a new box.
\v is used to display stored text. For example:
Would display as:
Flags are very useful tools. They are in-game "on and off switches" that can control whether an event should happen only once. They can also be used to make a sprite disappear after an event.
They are declared in hexadecimal, and have a value of either 0x0 or 0x1.
There are two commands for the flag statement.
setflag, as you may predict, sets a flag, or "turns on the switch". Once set, there is no way to uncheck it in a save file of the game.
checkflag checks to see what the value of the flag is, whether it be on or off.
Here's an example script:
In this script, the game will check the flag at 0x200, and if the flag has been set (it will have a value of 0x1), it will go to the pointer '@done', and continue the script from there. If the flag is not set (therefore, would have a value of 0x0), it will continue as normal with the script, moving on to 'msgbox @message1 0x6'.
Because we want the event to only happen once, we put 'setflag 0x200' after the initial script is done executing. Of course, since the script is using the same flag to determine what to do, we are using one flag for the entire script, 0x200.
Here is a list of flags that are already used in the game, and that may interfere with other game aliments if you use them in a custom script:
Additionally, here are a few useful flags that are already in the game:
Firered
Ruby & Sapphire
Alright, starting from the top again.
We already covered checkflag and setflag, but I'd like to stress again that the same 2 flags should be used in the script. Notice how checkflag on line 2 and setflag on line 16 are both set to 0x200?
Anyhoo, look at line 3 and 4. In XSE, as well as almost any programming language, we have the if statement. On line 2, the game checks the flag number 0x200, and if it not set to 0x1, it will continue
on with the script, and execute msgbox @1 on line 4.
On line 5, we have compare LASTRESULT 0x1. This command is almost always preceded after an 0x5 boxset, which is what we defined in line 4. Remember how I said that 0x5 is used for Yes and No statements? Well, if you select Yes from that box, it will write 0x1 to the variable LASTRESULT, which is a stored variable in the game. If you answer No, it will do nothing, and continue with the script from there.
On line 11, we have the meat of this entire command, the givepokemon command.
List of Pokemon numbers:
List of items:
You could also convert these values to hex, and prefix it with 0x to acheive the same effect, but I find it simpler to just use the decimal representation. It is automatically converted to hex after you compile it, anyway.
On line 12, we have fanfare 0x13E. This is the little jingle that plays when someone gives you a Pokemon. Bear in mind that the script is read quite fast by the game, so the jingle will play at approximately the same time as msgbox @receivedmsg 0x4.
waitfanfare on line 14 is very important. It waits until the jingle is finished before the script proceeds. If we didn't include this, the nicknaming dialogue would come up if the player were to hit A during the fanfare, which is not too pro.
closeonkeypress makes it so that the only way to continue with the script is if the player presses A or B after the fanfare is done.
On line 16, we have the setflag command, as I described earlier. Theoretically, you can put the setflag command in several places in this script, but for orderly purposes, I like to put it after the main event would be completed. It could be put on, say, lines 17-20, or line 25.
Line 24 reads call 0x1A74EB. The call command makes the game go to a certain offset number in the game. In this case, it is going to the script with the name 1A74EB. Just like how this script would be written to 0x800000, the script at 1A74EB also has a function. As you may be able to find out, it's the nicknaming dialogue screen.
gosub at line 19 basically tells the game "go there, but come back". A VERY important point is that when you declare gosub, you must always declare return in the pointer that you're telling it to go to. Because the game is going to the pointer @name, we must declare return after the function.
It is good programming practice in any programming languages to order your functions, and in the case of XSE, your pointers. I put all my pointers after the main programming function at the top, and in the order in which they appear. It's a good thing to get into this habit, as it will make your script more orderly, and easier to debug. The script will compile just fine if you were to, say, put the function @nickname on line 36 before the function @1 on line 30, but it's usually best to order them.
Once again, I'll start from the top, and descend.
As usual, we have the #dynamic command on the first line that declares which offset we will use for the script, as well as #org @start, lock and faceplayer.
As a refresher, msgbox @1 0x6 on line 5 displays a dialogue box with a type-6 box (0x6, it's just converted to hex), which is a 'normal' message box. What is contained inside that dialogue box is determined in the pointer @1. As said before, you can substitute anything you like for the 1 in that pointer, as long as the pointer on line 14 has the same name as it. Otherwise, it will not work.
Line 6 contains the cry command. As you may be able to guess, it plays the Pokemon's cry almost simultaneously when the dialogue box is opened.
On line 7, we have the wildbattle command.
On line 8 and 9, we have fadescreen, which fades the screen from white to black, or from black to white. There are 4 specific commands for it.
The hidesprite command is very useful, as it will make the overworld sprite of the Pokemon disappear after the battle, thus having the script run only once. It should be noted that hidesprite should always precede the setflag command. Otherwise, the sprite will only disappear when you talk to the sprite, and will reappear if you move!
But why 0x800F? Well, in the game, when we interact with a sprite, the person number (found in AdvanceMap) is assigned to the game variable named 0x800F. In this command, we are basically saying "hide the sprite that I am currently talking with.". hidesprite can also be used for specific person numbers on the map, but I will cover this later on.
But why no checkflag command in this script? Well, since we have the hidesprite command, it isn't really needed. What we DO need to do, however, is set the flag number to the Person ID number in AdvanceMap.
Because we have setflag 0x200 in our script, that Person ID MUST be 0200 for the Pokemon to disappear when it is supposed to disappear. Of course, you can choose another flag number, as long as it is the same flag number that is in the Person ID value. Now because we use hidesprite 0x800F BEFORE we set the flag 0x200, the sprite will not reappear because its status has already been recorded into the setflag command. Therefore, checkflag is not needed for this script.
GIVEITEM
I think I covered pretty much everything here except for the actual giveitem command. The syntax for it is:
For the message type, you can use either MSG_OBTAIN or MSG_FIND.
We have a few new commands here, including waitmovement 0x0, #raw and of course, applymovement.
The syntax for applymovement is:
This is where many beginners make mistakes. When you want somebody to move, you MUST ensure that the parameter for the person's sprite is the same as it is found in AdvanceMap. It can be found here:
DO NOT confuse the top Person Event No. field with the one that is under 'Delete Event'. In the example I used above, the value for the circled Person Event No. field would have to be 2 for this script to work.
On lines 8 and 11, I used the command waitmovement 0x0. This tells the game to stop the script until the movements have finished executing. If we did not include it on line 11, the message that we declared on line 12 would be executed while the player was moving.
On line 9, we have pause 0x30. This will pause the script from executing for the amount of time that you define for the parameter where 0x30 is. To give you an idea of how long the pauses are, 0x30 is nearly equivalent to one second in real time. As I have said before, 0x30 is the hexadecimal representation. If you convert 0x30 from hexadecimal to regular decimal, you will get 48. This means that I could have used pause 48, and it would have given me the same effect as if I used 0x30.
Notice on line 7, I declared the pointer @movements for the applymovement command. This brings it to line 24 to execute the movements there. On line 25, we have the actual movements that are to be done. When you do this, you always have to start with #raw. This tells the game that you are using raw hexadecimal data for the data that you are to declare. After that, you include all of the movements that you want the person to make. Here's a complete list of them:
Ruby/Sapphire
Firered/Leafgreen:
You can declare as many of them as you like.
After you declare the movements, you MUST, MUST follow it with 0xFE. This terminates the movements declaration, and continues the script. Otherwise, your game will freeze.
On line 22, I used the \v\h01 command. As mentioned at the beginning of the tutorial, this will display your in-game name.
We have a new command here, fadescreen 0x1 and fadescreen 0x0. As you might guess. it fades the screen from normal to black. It will remain black until we declare fadescreen 0x0.
Notice how I used 0x4 on line 6. We covered this before, and this is where such a command comes in handy. You never thought we'd have to use it, huh?
Anyhoo, because I declared 0x4, the message box will not close until we hit A or B. Why did I use 0x4 and closeonkeypress, rather than just 0x6?
If I were to do that, the dialogue box would remain open while the screen is black, which we don't want. The script would run, but showing the dialogue box during the black screen part would look quite unprofessional. When we use 0x4 and closeonkeypress, the dialogue box closes before fadescreen 0x1 is executed.
Here's a list of all the special commands:
More coming later on.
This article will cover how to write a script to your Pokemon ROM. ROM links are illegal, so you'll have to find one yourself. But I will give you links to the tools that you'll need to start your Pokemon-hacking hobby:
Advance Trainer - This tool will allow you to customize any trainer in your Pokemon game, including which trainer they are, the music that plays, their Pokemon, the Pokemon's held item, as well as the trainers' name.
XSE - The best scripting tool out there IMO. This will be one of your most-used tools if you plan to script. There are older scripting programs such as scriptEd and Pokescript that can be used as well, but the computer language that is used for it is somewhat different than XSE, and they are outdated, so I wouldn't normally recommend them. Writing the scripts to your ROM using these programs takes longer, and also requires that you make multiple files.
Free Space Finder - I believe this comes with XSE when you download it, but if it doesn't here it is. This is mainly used for finding free space to write scripts to in XSE, and as such, it'd be a great idea to integrate it with XSE through the drop-down menu that can automatically open up FSF. How to do this will be covered later in the article.
unLZ - A bit buggy and somewhat complex, but this tool is the most popular of its kind. This tool allows you to change the graphics of any picture in your Pokemon game. Sounds simple, doesn't it? Well, this program deserves its own tutorial, so using this will be covered later on.
AdvanceMap v1.92 - A must-have for any kind of ROM hacker. This tool is very easy to use, and allows you to completely customize any map in the game, as well as change the position and sprite type of any person in the game. It is also needed in scripting to appoint scripts to the game, and to people. Many other easy-to-use tools come with this, including PET (another trainer editor) and PokeCryGUI.
APE (Advanced Palette Editor) - A tool that allows you to change or swap color palettes in your ROM. More details on it will be included in future articles.
Lunar IPS (LIPS) - A very useful tool that makes patches from your ROMs so that you can apply said patch to a clean Pokemon ROM, and convert it into your customized game. Think of it as a 'change saver' that you can patch onto an unmodified ROM to give it the changes.
Elite Map - A more advanced program that does what AdvanceMap does, and more. I'm not very familiar with this program, as I mainly use AdvanceMap. But if you want to get more complex with your ROM-hacking, EliteMap is an option.
Advance Mart - A very user-friendly tool that allows you to edit Pokemart items.
Advance Starter - Allows you to change the starter Pokemon in the game.
Before we do any scripting, we'll make our lives easier, and integrate FSF with XSE. It is much easier than it sounds. All you need to do is put FSF in the same folder as XSE. That's all there is to it, but it will help you out a lot in the future.
Alright, on to scripting. You will need XSE above, AdvanceMap, Free Space Finder, and a Firered, Leafgreen, Ruby, Sapphire or Emerald ROM. First, open up XSE. On the File tab, select 'Open', and choose your ROM.
MESSAGE scriptS
I'll start off with the most basic of scripts - we're gonna make someone in the game say something. It can be whatever we want.
- Code:
#dynamic 0x800000
#org @message
lock
faceplayer
msgbox @message 0x6
release
end
#org @message
=OMG. I love Cirrus SOOO\nmuch for making this guide!!
I'll explain this from the top down.
#dynamic 0x800000 at the top is the offset that the game will use to write the script to the ROM. To use any kind of information, the ROM needs to know where the info is, and this offset tells it this. To find free space in your ROM, go to the Tools dropdown menu in XSE, and select 'Free Space Finder' (you DID integrate it with XSE, didn't you? o.O). When FSF comes up, it'll look like this:
Click on 'Search'. Assuming you opened that ROM, it will give you an offset number that you can use for the script. Select 'Copy', and X out of FSF. Then paste this offset number after the '0x' in #dynamic. KEEP NOTE OF THIS NUMBER. You will need it after you write the script to the ROM!
Back to the script, #org @message is the pointer that will be used for the script, and declares the start of the script. 'Message' can be anything you want, as long as it doesn't start with a number! @main, @script, @start, @iliekmudkipzlulz, anything you like.
lock prevents your character from moving when the script is being executed, as you may have noticed if you played a Pokemon game.
faceplayer turns the sprite you're talking to to you while the script is being executed.
msgbox is the XSE command to show a message box at the bottom of the screen. It is preceded with the pointer that contains the text to be shown in this box.
0x6 is the 'normal' box number. There are 5 different types.
0x2
- Spoiler:
- 0x2 is used for a normal message box that does not require the use of lock or faceplayer.
0x3
- Spoiler:
- 0x3 is used for signposts. It shows the square-shaped dialogue box when you interact with a signpost.
0x4
- Spoiler:
- A normal messagebox that does not close. the command "closeonkeypress" must be used to close it. It does not have a lock or faceplayer effect.
0x5
- Spoiler:
- Used for Yes or No questions in a script. It must be followed by some kind of 'compare' command.
0x6
- Spoiler:
- As mentioned before, a normal message box that closes after all the text is shown. It does not have a lock or faceplayer effect by default.
release at the end of the script instructs the game to cancel out the lock effect that was defined earlier, and end, of course, ends the script.
As with most programming languages, variables are declared after the initial program processes. In this script, @message was declared during the msgbox command that we used earlier. "#org @message" is where the defined text is stored for the @message variable. It is preceded on the next line by an = sign, followed by the message you wish to display.
In messaging, there are 6 commands for line positioning.
\c is used for coloring text.
\h is used to define hex values, particularly used for special characters in the game.
Me wrote:I have \hB7200!
Shows as "I have $200! " in the game, as hex B7 in the game is the currency symbol.
A complete list of all the hexes for each special symbol:
- Spoiler:
- 00=
01=À
02=Á
03=Â
04=Ç
05=È
06=É
07=Ê
08=Ë
09=Ì
0B=Î
0C=Ï
0D=Ò
0E=Ó
0F=Ô
10=Æ
11=Ù
12=Ú
13=Û
14=Ñ
15=ß
16=à
17=á
19=ç
1A=è
1B=é
1C=ê
1D=ë
1E=ì
20=î
21=ï
22=ò
23=ó
24=ô
25=æ
26=ù
27=ú
28=û
29=ñ
2A=º
2B=ª
2C=·
2D=&
2E=+
34=[Lv]
35==
36=;
51=¿
52=¡
53=[PK]
54=[MN]
55=[PO]
56=[Ke]
57=[BL]
58=[OC]
59=[K]
5A=Í
5B=%
5C=(
5D=)
68=â
6F=í
79=[u]
7A=[D]
7B=[L]
7C=[R]
A1=0
A2=1
A3=2
A4=3
A5=4
A6=5
A7=6
A8=7
A9=8
AA=9
AB=!
AC=?
AD=.
AE=-
AF=·
B0=[...]
B1="
B2=["]
B3='
B4=[']
B5=[m]
B6=[f]
B7=$
B8=,
B9=[x]
BA=/
BB=A
BC=B
BD=C
BE=D
BF=E
C0=F
C1=G
C2=H
C3=I
C4=J
C5=K
C6=L
C7=M
C8=N
C9=O
CA=P
CB=Q
CC=R
CD=S
CE=T
CF=U
D0=V
D1=W
D2=X
D3=Y
D4=Z
D5=a
D6=b
D7=c
D8=d
D9=e
DA=f
DB=g
DC=h
DD=i
DE=j
DF=k
E0=l
E1=m
E2=n
E3=o
E4=p
E5=q
E6=r
E7=s
E8=t
E9=u
EA=v
EB=w
EC=x
ED=y
EE=z
EF=[>]
F0=:
F1=Ä
F2=Ö
F3=Ü
F4=ä
F5=ö
F6=ü
F7=[u]
F8=[d]
F9=[l]
FA=\l
FB=\p
FC=\c
FD=\v
FE=\n
FF=\x
\n is used to indent onto a new line.
[quote=Me]Hello.\nI'm Cirrus.[/quote]
Shows up as:
[quote=Me]Hello.
I'm Cirrus.[/quote]
\l indents the text to a new line, but it can only be used after \n is used.
[quote="Me]Hello.\nI am Cirrus.\nYour creator.\nYour teacher.[/quote]
Would show up as:
Me wrote:Hello.
I am Cirrus.
Your creator. <----You would be pressing A at this point.
Your teacher.
\p can be used to continue the message in a new box.
\v is used to display stored text. For example:
- Code:
\v\h01! Come here!
Would display as:
Me wrote:(player's name)! Come here!
FLAGS
Flags are very useful tools. They are in-game "on and off switches" that can control whether an event should happen only once. They can also be used to make a sprite disappear after an event.
They are declared in hexadecimal, and have a value of either 0x0 or 0x1.
There are two commands for the flag statement.
setflag, as you may predict, sets a flag, or "turns on the switch". Once set, there is no way to uncheck it in a save file of the game.
checkflag checks to see what the value of the flag is, whether it be on or off.
Here's an example script:
- Code:
#dynamic 0x800000
#org @main
lock
faceplayer
checkflag 0x200
if 0x1 goto @done
msgbox @message1 0x6
setflag 0x200
release
end
#org @done
msgbox @message2 0x6
release
end
#org @message1
= Hello, my name is\nPeter Griffin!
#org @message2
= Haven't we talked before?
In this script, the game will check the flag at 0x200, and if the flag has been set (it will have a value of 0x1), it will go to the pointer '@done', and continue the script from there. If the flag is not set (therefore, would have a value of 0x0), it will continue as normal with the script, moving on to 'msgbox @message1 0x6'.
Because we want the event to only happen once, we put 'setflag 0x200' after the initial script is done executing. Of course, since the script is using the same flag to determine what to do, we are using one flag for the entire script, 0x200.
Here is a list of flags that are already used in the game, and that may interfere with other game aliments if you use them in a custom script:
- Spoiler:
- 0x1
0x2
0x3
0x4
0x5
0x6
0x11
0x12
0x13
0x14
0x15
0x16
0x17
0x18
0x19
0x1A
0x1B
0x1C
0x1D
0x1E
0x1F
0x20
0x2B
0x2C
0x2E
0x2F
0x30
0x31
0x32
0x33
0x34
0x35
0x36
0x37
0x38
0x39
0x3D
0x3E
0x3F
0x40
0x41
0x42
0x43
0x44
0x45
0x46
0x47
0x48
0x49
0x4A
0x4B
0x4C
0x4D
0x50
0x51
0x52
0x54
0x58
0x59
0x5A
0x5B
0x5C
0x5D
0x5E
0x5F
0x60
0x62
0x63
0x64
0x65
0x66
0x67
0x68
0x69
0x6A
0x6B
0x6D
0x6E
0x6F
0x70
0x71
0x72
0x73
0x74
0x75
0x76
0x77
0x79
0x7A
0x7B
0x7C
0x7D
0x7E
0x7F
0x80
0x81
0x82
0x83
0x84
0x85
0x86
0x87
0x88
0x89
0x8A
0x8B
0x8C
0x8D
0x8E
0x8F
0x90
0x91
0x92
0x93
0x94
0x95
0x96
0x97
0x98
0x99
0x9A
0x9B
0x9C
0x9E
0x9F
0xA0
0xA1
0xA2
0xA3
0xA4
0xA5
0xA6
0xA7
0xA8
0xA9
0xAA
0xAB
0xAC
0xAD
0xAE
0xAF
0xB0
0xB1
0xB2
0xB3
0xB4
0xB5
0xB6
0xB7
0xB8
0xB9
0xBA
0xBB
0xBC
0xBD
0xBE
0xBF
0xC0
0xC1
0xC2
0xC3
0xC4
0xC5
0xC6
0xC7
0xC8
0xC9
0xCA
0xCB
0xCC
0xCD
0xCE
0xD0
0xD1
0xD4
0xD5
0xD6
0xD7
0xD8
0xD9
0xDA
0xDB
0xDC
0xDD
0xDE
0xDF
0xE0
0xE1
0xE2
0xE3
0xE4
0xE5
0xE6
0xE7
0xE8
0xE9
0xEA
0xEB
0xEC
0xED
0xEE
0xEF
0xF0
0xF1
0xF2
0xF3
0xF4
0xF5
0xF6
0xF7
0xF8
0xF9
0xFA
0xFB
0xFC
0xFE
0xFF
0x100
0x101
0x102
0x103
0x104
0x105
0x106
0x107
0x108
0x109
0x10A
0x10B
0x10D
0x10E
0x10F
0x110
0x111
0x112
0x113
0x114
0x115
0x116
0x117
0x118
0x119
0x11A
0x11B
0x11C
0x11D
0x11E
0x11F
0x120
0x121
0x122
0x124
0x125
0x126
0x127
0x128
0x129
0x12A
0x12B
0x12C
0x12D
0x12E
0x138
0x140
0x141
0x142
0x143
0x144
0x163
0x16A
0x16E
0x16F
0x188
0x189
0x190
0x191
0x192
0x194
0x1A7
0x1A8
0x1A9
0x1AA
0x1B6
0x1B7
0x1B8
0x1CE
0x1CF
0x1D0
0x1E5
0x1E6
0x1ED
0x1EE
0x1EF
0x219
0x21A
0x21F
0x230
0x231
0x232
0x233
0x234
0x235
0x236
0x237
0x238
0x239
0x23A
0x23B
0x23C
0x23D
0x23F
0x240
0x241
0x243
0x244
0x245
0x246
0x247
0x248
0x249
0x24A
0x24B
0x24D
0x24E
0x24F
0x250
0x251
0x252
0x253
0x254
0x255
0x256
0x257
0x258
0x259
0x25B
0x25E
0x263
0x264
0x265
0x266
0x267
0x268
0x269
0x26A
0x26B
0x26C
0x26D
0x26E
0x26F
0x270
0x271
0x272
0x273
0x274
0x275
0x276
0x278
0x279
0x27A
0x27B
0x27C
0x27D
0x27E
0x27F
0x280
0x281
0x282
0x283
0x284
0x285
0x286
0x287
0x288
0x289
0x28A
0x28B
0x28C
0x28D
0x28E
0x28F
0x290
0x291
0x292
0x293
0x294
0x295
0x296
0x297
0x298
0x29A
0x29B
0x29C
0x29D
0x29E
0x29F
0x2A0
0x2A1
0x2A2
0x2A3
0x2A5
0x2A6
0x2BB
0x2BC
0x2BD
0x2BE
0x2BF
0x2C0
0x2C1
0x2C2
0x2C3
0x2C4
0x2C5
0x2C6
0x2C7
0x2C8
0x2C9
0x2CA
0x2CB
0x2CC
0x2CD
0x2CE
0x2CF
0x2D0
0x2D1
0x2D2
0x2D3
0x2D4
0x2D5
0x2D6
0x2D7
0x2D8
0x2D9
0x2DA
0x2DB
0x2DC
0x2DD
0x2E1
0x2E2
0x2E3
0x2E4
0x2E5
0x2E6
0x2E7
0x2E8
0x2EC
0x2ED
0x2EE
0x2EF
0x2F0
0x2F1
0x2F2
0x2F3
0x2F4
0x2F5
0x2F6
0x2F7
0x2F8
0x2F9
0x2FA
0x2FB
0x2FC
0x2FD
0x2FE
0x2FF
0x300
0x301
0x302
0x303
0x305
0x307
0x308
0x309
0x30A
0x30B
0x30C
0x30D
0x310
0x311
0x31C
0x31D
0x31E
0x31F
0x320
0x321
0x322
0x323
0x326
0x327
0x328
0x329
0x32E
0x32F
0x330
0x333
0x335
0x336
0x33C
0x33D
0x33F
0x343
0x348
0x349
0x34D
0x34E
0x350
0x351
0x354
0x356
0x357
0x358
0x35A
0x35B
0x35C
0x362
0x364
0x365
0x366
0x36D
0x36E
0x370
0x371
0x372
0x373
0x379
0x37A
0x37B
0x37C
0x37D
0x37E
0x380
0x381
0x382
0x384
0x385
0x386
0x387
0x388
0x389
0x38A
0x38F
0x390
0x391
0x393
0x394
0x395
0x396
0x39E
0x39F
0x3A0
0x3A5
0x3A6
0x3A7
0x3A8
0x3A9
0x3AC
0x3AD
0x3AE
0x3B0
0x3B1
0x3B2
0x3B3
0x3B4
0x3B5
0x3B7
0x3B8
0x3B9
0x3BA
0x3BB
0x3BC
0x3BD
0x3BE
0x3BF
0x3C1
0x3C2
0x3C3
0x3C4
0x3C5
0x3C7
0x3C8
0x3CD
0x3CE
0x3CF
0x3D0
0x3D1
0x3D2
0x3D3
0x3D4
0x3D6
0x3D7
0x3D8
0x3D9
0x3DA
0x3DB
0x3DC
0x3DD
0x3DE
0x3DF
0x436
0x4B0
0x4B1
0x4B2
0x4B3
0x4B4
0x4B5
0x4B6
0x4B7
0x4B8
0x4B9
0x4BA
0x4BB
0x4BC
0x4BD
0x4C1
0x4C9
0x4CD
0x4D4
0x4DD
0x4DE
0x4DF
0x4E0
0x800
0x801
0x802
0x804
0x805
0x806
0x807
0x808
0x809
0x80A
0x80B
0x80C
0x80D
0x80E
0x80F
0x810
0x811
0x812
0x813
0x814
0x815
0x816
0x817
0x818
0x819
0x81A
0x81B
0x81C
0x81D
0x81E
0x820
0x821
0x822
0x823
0x824
0x825
0x826
0x827
0x828
0x829
0x82A
0x82B
0x82C
0x82D
0x82F
0x830
0x832
0x834
0x83A
0x83B
0x83C
0x83D
0x83E
0x83F
0x840
0x841
0x842
0x843
0x844
0x845
0x846
0x847
0x848
0x849
0x84A
0x84B
0x84C
0x84F
0x850
0x851
0x852
0x853
0x854
0x855
0x856
0x857
0x858
0x859
0x85A
0x85B
0x85C
0x85E
0x85F
0x860
0x861
0x863
0x890
0x891
0x892
0x893
0x894
0x895
0x896
0x897
0x898
0x899
0x89A
0x89B
0x89C
0x89D
0x89E
0x89F
0x8A0
0x8A1
0x8A2
0x8A3
0x8A4
0x8A5
0x8A6
0x8A7
0x8A8
0x8A9
0x8AA
0x8AB
0x8AC
0x8AD
0x8AE
0x8AF
0x8B0
0x8B1
0x8B2
0x8B3
0x8B4
0x8B5
0x8B6
0x8B7
0x8B8
0x8B9
0x8BA
0x8BB
0x8BC
0x8BD
0x8BE
0x8BF
0x8C0
0x8C1
0x8C2
0x8CA
0x8CB
0x8CC
0x8CD
0x8CE
0x8CF
0x8D0
0x8D1
0x8D2
Additionally, here are a few useful flags that are already in the game:
Firered
- Spoiler:
- 0x820 – Activates First Badge
0x821 - Activates Second Badge
0x822 - Activates Third Badge
0x823 - Activates Fourth Badge
0x824 - Activates Fifth Badge
0x825 - Activates Sixth Badge
0x826 - Activates Seventh Badge
0x827 - Activates Eighth Badge
0x828 - Activates Pokemon Menu
0x829 - Activates Pokedex Menu
0x82F - Activates Running Shoes
Ruby & Sapphire
- Spoiler:
- 0x800 - Activates Pokemon Menu
0x801 - Activates Pokedex Menu
0x802 - Activates Pokenav Menu
0x807 - Activates First Badge
0x808 - Activates Second Badge
0x809 - Activates Third Badge
0x80A - Activates Fourth Badge
0x80B - Activates Fifth Badge
0x80C - Activates Sixth Badge
0x80D - Activates Seventh Badge
0x80E - Activates Eighth Badge
0x860 - Activates Running Shoes
GIVE POKEMON
- Code:
#dynamic 0x800000
1 #org @main
2 checkflag 0x200
3 if 0x1 goto @done
4 msgbox @1 0x5
5 compare LASTRESULT 0x1
6 if 0x1 goto @get
7 msgbox @2 0x6
8 release
9 end
10 #org @get
11 givepokemon 1 0x5 0 0x0 0x0 0x0
12 fanfare 0x13E
13 msgbox @receivedmsg 0x4
14 waitfanfare
15 closeonkeypress
16 setflag 0x200
17 msgbox @nickname 0x5
18 compare LASTRESULT 0x1
19 if 0x1 gosub @name
20 msgbox @5 0x6
21 release
22 end
23 #org @name
24 call 0x1A74EB
25 return
26 #org @done
27 msgbox @6 0x6
28 release
29 end
30 #org @1
31 = Hey, kid. You want\pthis POKEMON?
32 #org @2
33 = Fine.\pSee ya around.
34 #org @receivedmsg
35 = [black_fr]You received a BULBASAUR!
36 #org @nickname
37 = [black_fr]Would you like to give a\nnickname to BULBASAUR?
38 #org @5
39 = Take care of that\nBULBASAUR, kid.
40 #org @6
41 = How's that BULBASAUR doing?
Alright, starting from the top again.
We already covered checkflag and setflag, but I'd like to stress again that the same 2 flags should be used in the script. Notice how checkflag on line 2 and setflag on line 16 are both set to 0x200?
Anyhoo, look at line 3 and 4. In XSE, as well as almost any programming language, we have the if statement. On line 2, the game checks the flag number 0x200, and if it not set to 0x1, it will continue
on with the script, and execute msgbox @1 on line 4.
On line 5, we have compare LASTRESULT 0x1. This command is almost always preceded after an 0x5 boxset, which is what we defined in line 4. Remember how I said that 0x5 is used for Yes and No statements? Well, if you select Yes from that box, it will write 0x1 to the variable LASTRESULT, which is a stored variable in the game. If you answer No, it will do nothing, and continue with the script from there.
On line 11, we have the meat of this entire command, the givepokemon command.
- Code:
givepokemon 1 (The Pokemon you want, in this case Bulbasaur) 0x5 (level) 0 (hold item) 0x0 0x0 0x0 (buffers)
List of Pokemon numbers:
- Spoiler:
BULBASAUR 1
IVYSAUR 2
VENUSAUR 3
CHARMANDER 4
CHARMELEON 5
CHARIZARD 6
SQUIRTLE 7
WARTORTLE 8
BLASTOISE 9
CATERPIE 10
METAPOD 11
BUTTERFREE 12
WEEDLE 13
KAKUNA 14
BEEDRILL 15
PIDGEY 16
PIDGEOTTO 17
PIDGEOT 18
RATTATA 19
RATICATE 20
SPEAROW 21
FEAROW 22
EKANS 23
ARBOK 24
PIKACHU 25
RAICHU 26
SANDSHREW 27
SANDSLASH 28
NIDORAN|f| 29
NIDORINA 30
NIDOQUEEN 31
NIDORAN|m| 32
NIDORINO 33
NIDOKING 34
CLEFAIRY 35
CLEFABLE 36
VULPIX 37
NINETALES 38
JIGGLYPUFF 39
WIGGLYTUFF 40
ZUBAT 41
GOLBAT 42
ODDISH 43
GLOOM 44
VILEPLUME 45
PARAS 46
PARASECT 47
VENONAT 48
VENOMOTH 49
DIGLETT 50
DUGTRIO 51
MEOWTH 52
PERSIAN 53
PSYDUCK 54
GOLDUCK 55
MANKEY 56
PRIMEAPE 57
GROWLITHE 58
ARCANINE 59
POLIWAG 60
POLIWHIRL 61
POLIWRATH 62
ABRA 63
KADABRA 64
ALAKAZAM 65
MACHOP 66
MACHOKE 67
MACHAMP 68
BELLSPROUT 69
WEEPINBELL 70
VICTREEBEL 71
TENTACOOL 72
TENTACRUEL 73
GEODUDE 74
GRAVELER 75
GOLEM 76
PONYTA 77
RAPIDASH 78
SLOWPOKE 79
SLOWBRO 80
MAGNEMITE 81
MAGNETON 82
FARFETCH'D 83
DODUO 84
DODRIO 85
SEEL 86
DEWGONG 87
GRIMER 88
MUK 89
SHELLDER 90
CLOYSTER 91
GASTLY 92
HAUNTER 93
GENGAR 94
ONIX 95
DROWZEE 96
HYPNO 97
KRABBY 98
KINGLER 99
VOLTORB 100
ELECTRODE 101
EXEGGCUTE 102
EXEGGUTOR 103
CUBONE 104
MAROWAK 105
HITMONLEE 106
HITMONCHAN 107
LICKITUNG 108
KOFFING 109
WEEZING 110
RHYHORN 111
RHYDON 112
CHANSEY 113
TANGELA 114
KANGASKHAN 115
HORSEA 116
SEADRA 117
GOLDEEN 118
SEAKING 119
STARYU 120
STARMIE 121
MR. MIME 122
SCYTHER 123
JYNX 124
ELECTABUZZ 125
MAGMAR 126
PINSIR 127
TAUROS 128
MAGIKARP 129
GYARADOS 130
LAPRAS 131
DITTO 132
EEVEE 133
VAPOREON 134
JOLTEON 135
FLAREON 136
PORYGON 137
OMANYTE 138
OMASTAR 139
KABUTO 140
KABUTOPS 141
AERODACTYL 142
SNORLAX 143
ARTICUNO 144
ZAPDOS 145
MOLTRES 146
DRATINI 147
DRAGONAIR 148
DRAGONITE 149
MEWTWO 150
MEW 151
CHIKORITA 152
BAYLEEF 153
MEGANIUM 154
CYNDAQUIL 155
QUILAVA 156
TYPHLOSION 157
TOTODILE 158
CROCONAW 159
FERALIGATR 160
SENTRET 161
FURRET 162
HOOTHOOT 163
NOCTOWL 164
LEDYBA 165
LEDIAN 166
SPINARAK 167
ARIADOS 168
CROBAT 169
CHINCHOU 170
LANTURN 171
PICHU 172
CLEFFA 173
IGGLYBUFF 174
TOGEPI 175
TOGETIC 176
NATU 177
XATU 178
MAREEP 179
FLAAFFY 180
AMPHAROS 181
BELLOSSOM 182
MARILL 183
AZUMARILL 184
SUDOWOODO 185
POLITOED 186
HOPPIP 187
SKIPLOOM 188
JUMPLUFF 189
AIPOM 190
SUNKERN 191
SUNFLORA 192
YANMA 193
WOOPER 194
QUAGSIRE 195
ESPEON 196
UMBREON 197
MURKROW 198
SLOWKING 199
MISDREAVUS 200
UNOWN 201
WOBBUFFET 202
GIRAFARIG 203
PINECO 204
FORRETRESS 205
DUNSPARCE 206
GLIGAR 207
STEELIX 208
SNUBBULL 209
GRANBULL 210
QWILFISH 211
SCIZOR 212
SHUCKLE 213
HERACROSS 214
SNEASEL 215
TEDDIURSA 216
URSARING 217
SLUGMA 218
MAGCARGO 219
SWINUB 220
PILOSWINE 221
CORSOLA 222
REMORAID 223
OCTILLERY 224
DELIBIRD 225
MANTINE 226
SKARMORY 227
HOUNDOUR 228
HOUNDOOM 229
KINGDRA 230
PHANPY 231
DONPHAN 232
PORYGON2 233
STANTLER 234
SMEARGLE 235
TYROGUE 236
HITMONTOP 237
SMOOCHUM 238
ELEKID 239
MAGBY 240
MILTANK 241
BLISSEY 242
RAIKOU 243
ENTEI 244
SUICUNE 245
LARVITAR 246
PUPITAR 247
TYRANITAR 248
LUGIA 249
HO-OH 250
CELEBI 251
TREECKO 277
GROVYLE 278
SCEPTILE 279
TORCHIC 280
COMBUSKEN 281
BLAZIKEN 282
MUDKIP 283
MARSHTOMP 284
SWAMPERT 285
POOCHYENA 286
MIGHTYENA 287
ZIGZAGOON 288
LINOONE 289
WURMPLE 290
SILCOON 291
BEAUTIFLY 292
CASCOON 293
DUSTOX 294
LOTAD 295
LOMBRE 296
LUDICOLO 297
SEEDOT 298
NUZLEAF 299
SHIFTRY 300
NINCADA 301
NINJASK 302
SHEDINJA 303
TAILLOW 304
SWELLOW 305
SHROOMISH 306
BRELOOM 307
SPINDA 308
WINGULL 309
PELIPPER 310
SURSKIT 311
MASQUERAIN 312
WAILMER 313
WAILORD 314
SKITTY 315
DELCATTY 316
KECLEON 317
BALTOY 318
CLAYDOL 319
NOSEPASS 320
TORKOAL 321
SABLEYE 322
BARBOACH 323
WHISCASH 324
LUVDISC 325
CORPHISH 326
CRAWDAUNT 327
FEEBAS 328
MILOTIC 329
CARVANHA 330
SHARPEDO 331
TRAPINCH 332
VIBRAVA 333
FLYGON 334
MAKUHITA 335
HARIYAMA 336
ELECTRIKE 337
MANECTRIC 338
NUMEL 339
CAMERUPT 340
SPHEAL 341
SEALEO 342
WALREIN 343
CACNEA 344
CACTURNE 345
SNORUNT 346
GLALIE 347
LUNATONE 348
SOLROCK 349
AZURILL 350
SPOINK 351
GRUMPIG 352
PLUSLE 353
MINUN 354
MAWILE 355
MEDITITE 356
MEDICHAM 357
SWABLU 358
ALTARIA 359
WYNAUT 360
DUSKULL 361
DUSCLOPS 362
ROSELIA 363
SLAKOTH 364
VIGOROTH 365
SLAKING 366
GULPIN 367
SWALOT 368
TROPIUS 369
WHISMUR 370
LOUDRED 371
EXPLOUD 372
CLAMPERL 373
HUNTAIL 374
GOREBYSS 375
ABSOL 376
SHUPPET 377
BANETTE 378
SEVIPER 379
ZANGOOSE 380
RELICANTH 381
ARON 382
LAIRON 383
AGGRON 384
CASTFORM 385
VOLBEAT 386
ILLUMISE 387
LILEEP 388
CRADILY 389
ANORITH 390
ARMALDO 391
RALTS 392
KIRLIA 393
GARDEVOIR 394
BAGON 395
SHELGON 396
SALAMENCE 397
BELDUM 398
METANG 399
METAGROSS 400
REGIROCK 401
REGICE 402
REGISTEEL 403
KYOGRE 404
GROUDON 405
RAYQUAZA 406
LATIAS 407
LATIOS 408
JIRACHI 409
DEOXYS 410
CHIMECHO 411
List of items:
- Spoiler:
Master Ball 1
Ultra Ball 2
Great Ball 3
Poké Ball 4
Safari Ball 5
Net Ball 6
Dive Ball 7
Nest Ball 8
Repeat Ball 9
Timer Ball 10
Luxury Ball 11
Premier Ball 12
Potion 13
Antidote 14
Burn Heal 15
Ice Heal 16
Awakening 17
Parlyz Heal 18
Full Restore 19
Max Potion 20
Hyper Potion 21
Super Potion 22
Full Heal 23
Revive 24
Max Revive 25
Fresh Water 26
Soda Pop 27
Lemonade 28
Moomoo Milk 29
Energypowder 30
Energy Root 31
Heal Powder 32
Revival Herb 33
Ether 34
Max Ether 35
Elixir 36
Max Elixir 37
Lava Cookie 38
Blue Flute 39
Yellow Flute 40
Red Flute 41
Black Flute 42
White Flute 43
Berry Juice 44
Sacred Ash 45
Shoal Salt 46
Shoal Shell 47
Red Shard 48
Blue Shard 49
Yellow Shard 50
Green Shard 51
HP Up 63
Protein 64
Iron 65
Carbos 66
Calcium 67
Rare Candy 68
PP Up 69
Zinc 70
PP Max 71
Guard Spec. 73
Dire Hit 74
X Attack 75
X Defend 76
X Speed 77
X Accuracy 78
X Special 79
Poké Doll 80
Fluffy Tail 81
Super Repel 83
Max Repel 84
Escape Rope 85
Repel 86
Sun Stone 93
Moon Stone 94
Fire Stone 95
Thunderstone 96
Water Stone 97
Leaf Stone 98
Tinymushroom 103
Big Mushroom 104
Pearl 106
Big Pearl 107
Stardust 108
Star Piece 109
Nugget 110
Heart Scale 111
Orange Mail 121
Harbor Mail 122
Glitter Mail 123
Mech Mail 124
Wood Mail 125
Wave Mail 126
Bead Mail 127
Shadow Mail 128
Tropic Mail 129
Dream Mail 130
Fab Mail 131
Retro Mail 132
Cheri Berry 133
Chesto Berry 134
Pecha Berry 135
Rawst Berry 136
Aspear Berry 137
Leppa Berry 138
Oran Berry 139
Persim Berry 140
Lum Berry 141
Sitrus Berry 142
Figy Berry 143
Wiki Berry 144
Mago Berry 145
Aguav Berry 146
Iapapa Berry 147
Razz Berry 148
Bluk Berry 149
Nanab Berry 150
Wepear Berry 151
Pinap Berry 152
Pomeg Berry 153
Kelpsy Berry 154
Qualot Berry 155
Hondew Berry 156
Grepa Berry 157
Tamato Berry 158
Cornn Berry 159
Magost Berry 160
Rabuta Berry 161
Nomel Berry 162
Spelon Berry 163
Pamtre Berry 164
Watmel Berry 165
Durin Berry 166
Belue Berry 167
Liechi Berry 168
Ganlon Berry 169
Salac Berry 170
Petaya Berry 171
Apicot Berry 172
Lansat Berry 173
Starf Berry 174
Enigma Berry 175
Brightpowder 179
White Herb 180
Macho Brace 181
Exp. Share 182
Quick Claw 183
Soothe Bell 184
Mental Herb 185
Choice Band 186
King's Rock 187
Silverpowder 188
Amulet Coin 189
Cleanse Tag 190
Soul Dew 191
Deepseatooth 192
Deepseascale 193
Smoke Ball 194
Everstone 195
Focus Band 196
Lucky Egg 197
Scope Lens 198
Metal Coat 199
Leftovers 200
Dragon Scale 201
Light Ball 202
Soft Sand 203
Hard Stone 204
Miracle Seed 205
Blackglasses 206
Black Belt 207
Magnet 208
Mystic Water 209
Sharp Beak 210
Poison Barb 211
Nevermeltice 212
Spell Tag 213
Twistedspoon 214
Charcoal 215
Dragon Fang 216
Silk Scarf 217
Up-grade 218
Shell Bell 219
Sea Incense 220
Lax Incense 221
Lucky Punch 222
Metal Powder 223
Thick Club 224
Stick 225
Red Scarf 254
Blue Scarf 255
Pink Scarf 256
Green Scarf 257
Yellow Scarf 258
Mach Bike 259
Coin Case 260
Itemfinder 261
Old Rod 262
Good Rod 263
Super Rod 264
S.S. Ticket 265
Contest Pass 266
Wailmer Pail 268
Devon Goods 269
Soot Sack 270
Basement Key 271
Acro Bike 272
PokéBlock Case 273
Letter 274
Eon Ticket 275
Red Orb 276
Blue Orb 277
Scanner 278
Go-goggles 279
Meteorite 280
Rm. 1 Key 281
Rm. 2 Key 282
Rm. 4 Key 283
Rm. 6 Key 284
Storage Key 285
Root Fossil 286
Claw Fossil 287
Devon Scope 288
TM01 289
TM02 290
TM03 291
TM04 292
TM05 293
TM06 294
TM07 295
TM08 296
TM09 297
TM10 298
TM11 299
TM12 300
TM13 301
TM14 302
TM15 303
TM16 304
TM17 305
TM18 306
TM19 307
TM20 308
TM21 309
TM22 310
TM23 311
TM24 312
TM25 313
TM26 314
TM27 315
TM28 316
TM29 317
TM30 318
TM31 319
TM32 320
TM33 321
TM34 322
TM35 323
TM36 324
TM37 325
TM38 326
TM39 327
TM40 328
TM41 329
TM42 330
TM43 331
TM44 332
TM45 333
TM46 334
TM47 335
TM48 336
TM49 337
TM50 338
HM01 339
HM02 340
HM03 341
HM04 342
HM05 343
HM06 344
HM07 345
HM08 346
Oak's Parcel 349
Poké Flute 350
Secret Key 351
Bike Voucher 352
Gold Teeth 353
Old Amber 354
Card Key 355
Lift Key 356
Helix Fossil 357
Dome Fossil 358
Silph Scope 359
Bicycle 360
Town Map 361
VS Seeker 362
Fame Checker 363
TM Case 364
Berry Pouch 365
Teachy TV 366
Tri-pass 367
Rainbow Pass 368
Tea 369
Mysticticket 370
Auroraticket 371
Powder Jar 372
Ruby 373
Sapphire 374
You could also convert these values to hex, and prefix it with 0x to acheive the same effect, but I find it simpler to just use the decimal representation. It is automatically converted to hex after you compile it, anyway.
On line 12, we have fanfare 0x13E. This is the little jingle that plays when someone gives you a Pokemon. Bear in mind that the script is read quite fast by the game, so the jingle will play at approximately the same time as msgbox @receivedmsg 0x4.
waitfanfare on line 14 is very important. It waits until the jingle is finished before the script proceeds. If we didn't include this, the nicknaming dialogue would come up if the player were to hit A during the fanfare, which is not too pro.
closeonkeypress makes it so that the only way to continue with the script is if the player presses A or B after the fanfare is done.
On line 16, we have the setflag command, as I described earlier. Theoretically, you can put the setflag command in several places in this script, but for orderly purposes, I like to put it after the main event would be completed. It could be put on, say, lines 17-20, or line 25.
Line 24 reads call 0x1A74EB. The call command makes the game go to a certain offset number in the game. In this case, it is going to the script with the name 1A74EB. Just like how this script would be written to 0x800000, the script at 1A74EB also has a function. As you may be able to find out, it's the nicknaming dialogue screen.
gosub at line 19 basically tells the game "go there, but come back". A VERY important point is that when you declare gosub, you must always declare return in the pointer that you're telling it to go to. Because the game is going to the pointer @name, we must declare return after the function.
It is good programming practice in any programming languages to order your functions, and in the case of XSE, your pointers. I put all my pointers after the main programming function at the top, and in the order in which they appear. It's a good thing to get into this habit, as it will make your script more orderly, and easier to debug. The script will compile just fine if you were to, say, put the function @nickname on line 36 before the function @1 on line 30, but it's usually best to order them.
WILD BATTLE
- Code:
1 #dynamic 0x800000
2 #org @start
3 lock
4 faceplayer
5 msgbox @1 0x6
6 cry 0x9 0x0
7 wildbattle 0x9 0x1E 0x8B
8 fadescreen 0x1
9 fadescreen 0x0
10 hidesprite 0x800F
11 setflag 0x200
12 release
13 end
14 #org @1
15 = BLASTOISE: BLAAAAAAA!!!!
Once again, I'll start from the top, and descend.
As usual, we have the #dynamic command on the first line that declares which offset we will use for the script, as well as #org @start, lock and faceplayer.
As a refresher, msgbox @1 0x6 on line 5 displays a dialogue box with a type-6 box (0x6, it's just converted to hex), which is a 'normal' message box. What is contained inside that dialogue box is determined in the pointer @1. As said before, you can substitute anything you like for the 1 in that pointer, as long as the pointer on line 14 has the same name as it. Otherwise, it will not work.
Line 6 contains the cry command. As you may be able to guess, it plays the Pokemon's cry almost simultaneously when the dialogue box is opened.
- Code:
cry 0x9 (Pokemon hex number you want the cry to be) 0x0 (effect number of the cry, but I'm not completely sure on how this works. 0x0 works just fine in this case.)
On line 7, we have the wildbattle command.
- Code:
wildbattle 0x9 (hex number of Blastoise) 0x1E (hex of the encounter level, in this case, 30) 0x8B (hex value of hold item, in this case, Oran Berry)
On line 8 and 9, we have fadescreen, which fades the screen from white to black, or from black to white. There are 4 specific commands for it.
- Spoiler:
- 0x0 - Fade from black to normal
0x1 – Fade from normal to black
0x2 – Fade from white to normal
0x3 – Fade from normal to white
The hidesprite command is very useful, as it will make the overworld sprite of the Pokemon disappear after the battle, thus having the script run only once. It should be noted that hidesprite should always precede the setflag command. Otherwise, the sprite will only disappear when you talk to the sprite, and will reappear if you move!
But why 0x800F? Well, in the game, when we interact with a sprite, the person number (found in AdvanceMap) is assigned to the game variable named 0x800F. In this command, we are basically saying "hide the sprite that I am currently talking with.". hidesprite can also be used for specific person numbers on the map, but I will cover this later on.
But why no checkflag command in this script? Well, since we have the hidesprite command, it isn't really needed. What we DO need to do, however, is set the flag number to the Person ID number in AdvanceMap.
Because we have setflag 0x200 in our script, that Person ID MUST be 0200 for the Pokemon to disappear when it is supposed to disappear. Of course, you can choose another flag number, as long as it is the same flag number that is in the Person ID value. Now because we use hidesprite 0x800F BEFORE we set the flag 0x200, the sprite will not reappear because its status has already been recorded into the setflag command. Therefore, checkflag is not needed for this script.
GIVEITEM
- Code:
1 #dynamic 0x800000
2
3 #org @main
4 lock
5 faceplayer
6 checkflag 0x200
7 if 0x1 goto @done
8 msgbox @1 0x5
9 compare 0x800D 0x1
10 if 0x1 goto @take
11 msgbox @2 0x6
12 release
13 end
14
15 #org @done
16 msgbox @3 0x6
17 release
18 end
19
20 #org @take
21 giveitem 0xD 0x1 MSG_OBTAIN
22 msgbox @3 0x6
23 setflag 0x200
24 release
25 end
26
27 #org @1
28 = Hey, kid! You want this?
29
30 #org @2
31 = Fine. I'll give it to\nsome other person.
32
33 #org @3
34 = I don't have anymore.\nGo buy them if you want more.
I think I covered pretty much everything here except for the actual giveitem command. The syntax for it is:
- Code:
giveitem 0xD (item hex) 0x1 (amount to give) MSG_OBTAIN (message type)
For the message type, you can use either MSG_OBTAIN or MSG_FIND.
APPLYMOVEMENT
- Code:
1 #dynamic 0x800000
2
3 #org @start
4 checkflag 0x200
5 if 0x1 goto @done
6 msgbox @message 0x6
7 applymovement 2 @movements
8 waitmovement 0x0
9 pause 0x30
10 applymovement 0xFF @follow
11 waitmovement 0x0
12 msgbox @message2 0x6
13 setflag 0x200
14 release
15 end
16
17 #org @done
18 release
19 end
20
21 #org @message
22 = /v/h01, follow me!
23
24 #org @movements
25 #raw 0x12 0x12 0x12 0x12 0x03 0xFE
26
27 #org @follow
28 #raw 0x12 0x12 0x12 0xFE
29
30 #org @message
31 = Great! You can walk!
We have a few new commands here, including waitmovement 0x0, #raw and of course, applymovement.
The syntax for applymovement is:
- Code:
applymovement 2 (the number of the person's sprite in AdvanceMap) @movements (pointer leading to the movement commands)
This is where many beginners make mistakes. When you want somebody to move, you MUST ensure that the parameter for the person's sprite is the same as it is found in AdvanceMap. It can be found here:
- Spoiler:
DO NOT confuse the top Person Event No. field with the one that is under 'Delete Event'. In the example I used above, the value for the circled Person Event No. field would have to be 2 for this script to work.
On lines 8 and 11, I used the command waitmovement 0x0. This tells the game to stop the script until the movements have finished executing. If we did not include it on line 11, the message that we declared on line 12 would be executed while the player was moving.
On line 9, we have pause 0x30. This will pause the script from executing for the amount of time that you define for the parameter where 0x30 is. To give you an idea of how long the pauses are, 0x30 is nearly equivalent to one second in real time. As I have said before, 0x30 is the hexadecimal representation. If you convert 0x30 from hexadecimal to regular decimal, you will get 48. This means that I could have used pause 48, and it would have given me the same effect as if I used 0x30.
Notice on line 7, I declared the pointer @movements for the applymovement command. This brings it to line 24 to execute the movements there. On line 25, we have the actual movements that are to be done. When you do this, you always have to start with #raw. This tells the game that you are using raw hexadecimal data for the data that you are to declare. After that, you include all of the movements that you want the person to make. Here's a complete list of them:
Ruby/Sapphire
- Spoiler:
0x54 Hide
0x55 Show
0x56 Alert
0x57 Question
0x58 Love
0x5A Pokeball
0x10 Delay0
0x11 Delay1
0x12 Delay2
0x13 Delay3
0x14 Delay4
' Step
0x00 Down0
0x01 Up0
0x02 Left0
0x03 Right0
0x04 Down1
0x05 Up1
0x06 Left1
0x07 Right1
0x08 Down2
0x09 Up2
0x0A Left2
0x0B Right2
0x17 Left3
0x18 Right3
0x15 Down3
0x16 Up3
0x2D Down4
0x2E Up4
0x2F Left4
0x30 Right4
' Running
0x35 RunDown
0x36 RunUp
0x37 RunLeft
0x38 RunRight
0x7E RunDown2
0x7F RunUp2
0x80 RunLeft2
0x81 RunRight2
' Hop & Jump
0x0C HopTileDown
0x0D HopTileUp
0x0E HopTileLeft
0x0F HopTileRight
0x3A HighHopDown
0x3B HighHopUp
0x3C HighHopLeft
0x3D HighHopRight
0x46 HopDown
0x47 HopUp
0x48 HopLeft
0x49 HopRight
0x4A HopDown180
0x4B HopUp180
0x4C HopLeft180
0x4D HopRight180
0x42 JumpDown
0x43 JumpUp
0x44 JumpLeft
0x45 JumpRight
' Straf (May have glitches)
0x19 StDown1
0x1A StUp1
0x1B StLeft1
0x1C StRight1
0x1D StDown2
0x1E StUp2
0x1F StLeft2
0x20 StRight2
0x21 StDown3
0x22 StUp3
0x23 StLeft3
0x24 StRight3
0x25 StDown4
0x26 StUp4
0x27 StLeft4
0x28 StRight4
0x6A StDown1i
0x6B StUp1i
0x6C StLeft1i
0x6D StRight1i
0x6E StDown5
0x6F StUp5
0x70 StLeft5
0x71 StRight5
'Special
0x31 SlideFaceDown
0x32 SlideFaceUp
0x33 SlideFaceLeft
0x34 SlideFaceRight
0x86 IceSlideDown
0x87 IceSlideUp
0x88 IceSlideLeft
0x89 IceSlideRight
' Glitchy
0x3E Up0A
0x3F Down0A
0x4E Down0B
0x63 Up0B
0x65 Right0A
0x66 RunStopLoopDown
0x67 RunStopLoopUp
0x68 RunStopLoopLeft
0x69 RunStopLoopRight
0x72 Down15
0x73 Up15
0x74 Left15
0x75 Right15
0x7A Down6
0x7B Up6
0x7C Left6
0x7D Right6
0x82 Down7
0x83 Up7
0x84 Left7
0x85 Right7
Firered/Leafgreen:
- Spoiler:
Face Down 0x00
Face Up 0x01
Face Left 0x02
Face Right 0x03
Step Down (Very Slow) 0x08
Step Up (Very Slow) 0x09
Step Left (Very Slow) 0x0A
Step Right (Very Slow) 0x0B
Step Down (Slow) 0x0C
Step Up (Slow) 0x0D
Step Left (Slow) 0x0E
Step Right (Slow) 0x0F
Step Down (Normal) 0x10
Step Up (Normal) 0x11
Step Left (Normal) 0x12
Step Right (Normal) 0x13
Jump Down 2 Squares 0x14
Jump Up 2 Squares 0x15
Jump Left 2 Squares 0x16
Jump Right 2 Squares 0x17
Step Down (Fast) 0x1D
Step Up (Fast) 0x1E
Step Left (Fast) 0x1F
Step Right (Fast) 0x20
Step on the Spot Down 0x21
Step on the Spot Up 0x22
Step on the Spot Left 0x23
Step on the Spot Right 0x24
Step on the Spot Down (Fast) 0x25
Step on the Spot Up (Fast) 0x26
Step on the Spot Left (Fast) 0x27
Step on the Spot Right (Fast) 0x28
Step on the Spot Down (Very Fast) 0x29
Step on the Spot Up (Very Fast) 0x2A
Step on the Spot Left (Very Fast) 0x2B
Step on the Spot Right (Very Fast) 0x2C
Face Down (Non-Instant) 0x2D
Face Up (Non-Instant) 0x2E
Face Left (Non-Instant) 0x2F
Face Right (Non-Instant) 0x30
Slide Down 0x31
Slide Up 0x32
Slide Left 0x33
Slide Right 0x34
Slide Down On Right Foot 0x3D
Slide Up On Right Foot 0x3E
Slide Left On Right Foot 0x3F
Slide Right On Right Foot 0x40
Slide Down On Left Foot 0x41
Slide Up On Left Foot 0x42
Slide Left On Left Foot 0x43
Slide Right On Left Foot 0x44
Face Player 0x4A
Face Away from Player 0x4B
Jump Down 1 Square 0x4E
Jump Up 1 Square 0x4F
Jump Left 1 Square 0x50
Jump Right 1 Square 0x51
Jump in Place (Facing Down) 0x52
Jump in Place (Facing Up) 0x53
Jump in Place (Facing Left) 0x54
Jump in Place (Facing Right) 0x55
Jump in Place (Facing Down->Up) 0x56
Jump in Place (Facing Up->Down) 0x57
Jump in Place (Facing Left->Right) 0x58
Jump in Place (Facing Right->Left) 0x59
Disappear 0x60
Reappear 0x61
"!" box popup 0x62
"?" box popup 0x63
"X" box popup 0x64
"!!" box popup 0x65
"^_^" box popup 0x66
You can declare as many of them as you like.
After you declare the movements, you MUST, MUST follow it with 0xFE. This terminates the movements declaration, and continues the script. Otherwise, your game will freeze.
On line 22, I used the \v\h01 command. As mentioned at the beginning of the tutorial, this will display your in-game name.
SPECIAL
- Code:
1 #dynamic 0x800000
2
3 #org @start
4 lock
5 faceplayer
6 msgbox @talk 0x4
7 closeonkeypress
8 fadescreen 0x1
9 fanfare 0x100
10 special 0x0
11 waitfanfare
12 fadescreen 0x0
13 msgbox @after 0x6
14 release
15 end
16
17 #org @talk
18 = Would you like me to/nheal your POKEMON?
19
20 #org @after
21 = Now they look better!\nGood luck on your journey!
We have a new command here, fadescreen 0x1 and fadescreen 0x0. As you might guess. it fades the screen from normal to black. It will remain black until we declare fadescreen 0x0.
Notice how I used 0x4 on line 6. We covered this before, and this is where such a command comes in handy. You never thought we'd have to use it, huh?
Anyhoo, because I declared 0x4, the message box will not close until we hit A or B. Why did I use 0x4 and closeonkeypress, rather than just 0x6?
If I were to do that, the dialogue box would remain open while the screen is black, which we don't want. The script would run, but showing the dialogue box during the black screen part would look quite unprofessional. When we use 0x4 and closeonkeypress, the dialogue box closes before fadescreen 0x1 is executed.
Here's a list of all the special commands:
- Spoiler:
- special 0x0 - Heal Pokemon
special 0x3C - Access Bill's PC (FR/LG)
special 0x98 - Going up to Mountain (R/S)
special 0x9C - Wally Catch (R/S)
special 0x9F - choose A Pokemon (R/S)
special 0xE0 - PokeBlock Case (R/S)
special 0x10F - Restart Game
special 0x110 - Hall of Fame and Credits
special 0x111 - Elevator Animation
special 0x119 - Groudon's Orb effect (R/S)
special 0x131 - Earthquake (R/S)
special 0x132 - Show Floors
special 0x136 - Earthquake (FR/LG)
special 0x137 - Lava Battle
special 0x156 - Battle with Ghost (FR/LG)
special 0x157 - Get on Bike (FR/LG)
special 0x161 - Start Surfing (FR/LG)
special 0x166 - Nickname
special 0x16F - Activate National Dex (FR/LG)
special 0x17B - Seagallop Animation
special 0x191 - SS. Anne Leaving
special 0x1F3 - Activate National Dex (Emerald)
More coming later on.
Similar topics
» Long Trade Thread is Long. Can Clone, Sav, Change NNs & Check Legality (Beta ver.)
» Scripting Club Rules
» Cirrus's Graveyard-The Ghost-Type Gym
» Johto Festa (Accepting anyone, As long as you have the Required Pokemon)
» HTML Tutorial 1: Using gedit as a better tool, also outlines HTML.
» Scripting Club Rules
» Cirrus's Graveyard-The Ghost-Type Gym
» Johto Festa (Accepting anyone, As long as you have the Required Pokemon)
» HTML Tutorial 1: Using gedit as a better tool, also outlines HTML.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum