- 1,103
- Posts
- 17
- Years
- Melbourne, Australia
- Seen Oct 12, 2010
thethethethe's Pokescript Tutorial
Before I begin, I'd like to give thanks, to Dabomstew, Irish Witch, Foullump, Earthsvisitor, Mastermind X, loading_NOW, score_under and The Rom Raiders team (namely Hackmew, D-Trough and Wuggles); for commands, that I've found out about through tutorials and programs, and even just asking things, thanks.
Now a little background into why I'm writing this. I wrote a scripting tutorial to post at Phcompany, and I was looking at it and I thought, WOW, this is really outdated. Some of the stuff, was even wrong. Then I looked over at PC, and I saw the stacks and stacks of scripting tutorials, all covering the same basic commands over and over and over again. So I decided I'll make ammends for my poor tutorial and fix it up with this new one, and also end the trend of scripting tutorials posting the same things over and over.
Also please note. I won't be including all commands, because first of all, not all are known, and second of all, I consider some of them useless. Ones I consider useless will NOT be included with an explanation.
I think since, it's a Pokescript tutorial, I should give a little info on Pokescript.
Pokescript is a program created by Irish Witch. This program is, in my opinion, easier to use than other scripting programs like scriptED and Diamond Cutter.
Some important features of Pokescript are:
Dynamic offsets
You don't need to assign the hex pointer. It will do that for you.
Option of Using Decimal and Hex Values.
To make it easier. Instead of having to use 0x64, you can just use 100. But remember, if "0x" is infront of the number, it's a hex number.
This tutorial is going to cover a lot in detail.
The way I'll explain everything is, to show a script at the beginning and then explain everything "new" after it.
Please note, because I prefer to hack Fire Red over Ruby, some scripts are written to suit Fire Red/Leaf Green, and NOT Ruby/Sappire/Emerald.
I think I'll start with pointers.
Pokescript automatically assigns the script to the rom, therefore, unlike it's opposition; ScriptED and Diamond Cutter, you can just use a random name for each pointer.
So we can use any random name for the pointer. It could be, for example...
$aaaaaaa ; $hellomynameisthethethethe ; $1234567890
As long as there are no spaces in it, and pointers aren't "doubled up" the pointer will work.
So as an example these won't work
$a a a a a a ; $hello my name is thethethethe.
Now I can move onto a normal message script.
I'll begin at the top of the script and work my way down.
#org $start marks the beginning of the script. It shows that it's the beginning.
lock will lock your player so that while this script is "in motion" the player won't be able to move.
faceplayer is used to make the sprite you are interacting with, face you.
message is used when you want a message to display on the screen. It is followed by a pointer that will be placed at the bottom as shown.
The actual message will appear like this.
Now the boxset. Boxset MUST follow a message. Without this the message box, wont appear. In this case I've used boxset 6. I'll cover more later. boxset may also appear as callstd.
Now we use release. This will release the locked player.
And end will do what it's name says, and end the script.
There are lots of other little add ons that can be used with the message. Here's a short list, before I explain them.
\c usually refers to a colour.
So in this type of message
Here's a short list.
Fire Red/Leaf Green
Ruby/Sapphire I'd assume that they work for Emerald too, but I haven't actually tested it yet.
\h is used with hex values. Here's an example.
So in this example, I'm goint to use "$", here's an example.
\n is used in text when we want to go to a new line. So in this message line.
So in this message line.
Before I continue. I'm going to just add something on flags.
Flags are very useful when you need an event to only occur once or if you want a person to disappear.
We can set a flag, and if we want an overworld, to dissappear we have to assign the set flag to the OW's, people ID in advancemap. But I'll go into more detail on that later.
Many flags are used within the game already. So if you plan on leaving scripts that are already in the rom, you'll need to be more careful on what flags you use, because flags can only really be used once.
If you want some flags that are not used in the rom as a start, here's a few. 0x200 - 0x29F, 500-79F, 1000-109F. But you'll find more if you experiment with them.
I'll have to do a bit of explaining here, so I'll start with preventing events to happen.
We've already covered lock and faceplayer, so we'll go to checkflag.
checkflag checks if a flag has been set. Checkflag is usually followed by an if line.
When using the if line after checkflag it contains either a b_true or b_false. b_true, meaning, that if the flag is set goto ${pointer}, and if not it will continue with the script. Similiarly, b_false checks if the flag is NOT set, and if it isn't it will goto ${pointer}, and if the flag is set, the script will continue without going to the pointer.
This pointer used in if b_true goto $done it points to another part of the script as you can see in the script.
As you can see the if b_true goto $done points to a different part of a script as shown with the #org $done
Here we have a message and a new command, clearflag.
Once flags are set they can be "unset" with the command clearflag.
Clearflag has to be followed by the flag number.
And here we are at the end of the script.
But there is more than one way to use a flag. Some flags have some sort of game function. I'll explain that in the next part.
Givepokemon does exactly what it says. It gives the player a Pokemon. Here's my example script. There will be quite a few new commands here.
Okay. There's a lot here I need to explain.
I guess I'll start from the top.
checkflag and the if line, we have already covered.
Message has also been covered, but boxset 5hasn't.
boxset 5 does a similar job to boxset 6, but this box also gives us the option of a Yes/No box on the screen aswell. Obviously this would be used if you want to ask someone a question.
boxset 5 is usually followed by a compare line.
compare needs the variable, which in this case is LASTRESULT and also a value, which in this case is 1.
LASTRESULT is a useful variable that most commands store values in.
When using compare after a boxset 5, you only have two options for the value, 0, which is NO and 1, which is YES.
This compare LASTRESULT 0x1, will check if you pressed YES and of course, compare LASTRESULT 0x0 will check if you pressed NO.
This if line that follows the compare line does the same thing as what it does for checkflag. if b_true will check if the button pressed matches the compared value and if it is, it will goto ${pointer} and if not, it will continue the script.
Then we have a Normal Message and the end of the script. So I'll now move onto the next part.
The first new command here is givepokemon.
givepokemon uses three values. The first is the Pokemon, the second being the level and the third being the Item Held.
So in the script above, mine shows....
But look! We have something slightly different there. Instead of, if b_true goto $name, we have if b_true gosub $name.
If you use ScriptED this, is would just be if2 to you. Gosub, is somthing used in other programming languages, and is just used to say, "go there but you have to come back."
So let's look at what we have there, gosub $name, I guess that means that we are going to go look at $name
Here we have call 0x1A74EB. Call is used to call some other script within a rom. It can also call a part of your script, in that case it would appear,
But, I know what you're asking, what's at 0x1A74EB? Some people use the command namepokemon, but that isn't the most reliable command. So we use the namepokemon already in the rom, which is if you haven't figured it out yet, is at 0x1A74EB.
Now we have return, but what's that do, it just returns to wherevere it was called from or gosubed from. I didn't mention it earlier, but call should have a return wherever it is called from.
That return has brought us back to message $5. The rest is already explained, so now we can move onto the next part.
I think we'll move onto something similiar and go to...
I guess, now I can just not mention messages and boxsets, so I'll just start straight with cry.
Sorry but I have to get a little "advanced" here, but hopefully, I'll explain it well enough so that it sounds simple. When we script cry in hex it takes 6 bytes,
[cry] [bank] [pkmn] [pkmn] [buffer] [buffer]
In pokescript unfortunately it's only coded 4 of those six bytes, so now we need to add two bytes, which will act as those buffers. So I chose to just use two nops. To cover those buffers.
Oh wait, I forgot to explain Cry. First we have the command, and then it's followed by the bank. 0xA1, is the Pokemon cry bank. Then that is followed by the Pokemon, which in this case, is a Charizard.
Now Wildbattle. So in my script, we have.
So from there, I can explain, the first one is the Pokemon, the second is the level, and finally, the third is the item.
fadescreen is a command that is used to make the screen fade to black, and sometimes back. fadescreen 0x0 will create a blinking effect which will make it seem as if the Pokemon is there one second, and gone the next. There are more different fadescreen's but I'll cover some of those later in the tutorial.
Now we can move onto #raw 0x53 0x0F 0x80. This is very useful, as it makes the Overworld your interacting with dissappear. I'll go into a little more detail on #raw 0x53 0x0F 0x80 below in the spoiler, because it will be a little more complex than where we are at, at the moment.
#raw 0x53 can also be used a little differently and I'll explain that also a little later in the tutorial.
Remeber how I mentioned in Flags, how I mentioned something about the people id, in advancemap. This is where I'll be explaining that. Here, we've used the flag 0x200, so we are going to change the Overworld that this script is assigned to's people id to 0200. The people id, is used to make sure that the Overworld, doesn't continue to re-appear, but that is easier to learn via experience.
and that's it, I guess we can now move onto something else.
So Checkgender, huh? I guess there isn't too much for me to explain here.
So we have the command Checkgender. Like most commands, it assigns a value to LASTRESULT. We check what this value is with compare LASTRESULT 0x*. The asterix just stands for what we are checking for. With checkgender, it assigns 0x0 to LASTRESULT for a male, and it assigns 0x1 to LASTRESULT for a female.
I've used two compare's but it can be alternitavely my script could also have been written like this.
Or like this...
It really just comes down to preference. Nothing is set in stone when it comes to scripting, there's always more than one way to do something, and I'll show some more examples of this later.
It think that's all that I need to explain for this.
One thing you may notice about this script is that I've pointed to different parts of the script to the same pointer. This is not a mistake, you can do this. I added that here because I think it's a good thing for someone to know about.
Now onto the new things in this script. We have the giveitem command.
Giveitem will take two values, the item no. and the amount.
In my script I have used these.
giveitem {Potion} {One of them}
That's actually all you need to do for this command. It will automatically play a jingle, and it will automatically display a message saying "You recieved ............" That's actually all I need to explain.
WARNING: The most common mistake when people use this, is that they leave off the second number and forget about it. This will make the game go to a Red Screen, which you will not be able to come back from. Make sure you have both numbers used with this command.
How about we move onto some simple specials now.
For those who might be interested, this is actually part of a script from my hack.
Looks like I've used boxset 4 and #raw 0x68 again. I've also used fadescreen 0x1 aswell as fadescreen 0x0, another fanfare and special 0x0.
I'm going to do something different here. I'm going to start with the fadescreens? Do you still remember what fadescreen 0x0 does?
Fadescreen 0x1 is of course not the same as fadescreen 0x0, it actually fades the screen out to completely black. But I can guess what you're asking, how do we turn it back? We of course use fadescreen 0x0 to reverse the process, and return the screen to it's normal state.
Now that you should have an understnding of fadescreen 0x1, we can move backwards, and look at "Why I used boxset 4 instead of boxset 6.
I will be fully truthful with you on this. For some reason, that I can't explain, if we use boxset 6 before we use fadescreen 0x1 the box will remain open until we return to our normal screen with fadescreen 0x0, and once we are there we will see it close but I don't want that. It doesn't look very good. We want it to close before we come back from our black screen. I can't explain this, but for some reason, when we use boxset 4 and #raw 0x68, it does just that. So whenever you have a script like this, use boxset 4 before, we go to a fadescreen.
The fanfare is very useful in this script. In theory I could have used pause(which is a command I have not covered yet), but I wanted to use the combination of fanfare 0x100 and waitfanfare.
For those who don't know, fanfare 0x100 is the healing jingle that is played when your mother heals your Pokemon. So now, with the help of waitfanfare, the screen will not return to normal until that jingle is completed.
Now all that's left is of course, special 0x0. This is a special command that will fully heal the Pokemon within your party. Useful isn't it?
I'm also going to include a short list of specials in spoiler right here, for whoever may want it.
Specials
What's new here? Applymovement, pausemove, pause, playsound and fadesound. I guess I'll explain them all in that order.
Applymovement is a very useful command that allows to show an overworld walking or running depending on what we want.
When we use applymovement, it has to be followed by a People Number, which is found here...
and a pointer to where our movements are. An overworld with a people number of "4", seems normal doesn't it? But what about one with 0xFF(256). There's never 256 Overworlds on the one map. 0xFF is the "Hero's" people number.
Now let's look at this movements in a simpler view.But First I'll have to give you a movements list won't I?
Ruby/Sapphire
Fire Red/Leaf Green
Before we look at the movements in a different view, I should explain the layout of the movements at the pointer. It is set out in a similiar way to a message. We have #org $pointer first and then what's being written to the rom below that. So we add #raw and then the movements that we want. But remember, that if you forget to add 0xFE to the end of the movements, your script will not work.
Actually, you know what? I changed my mind, before we look at the movements we're going to look at pausemove and pause.
pausemove is one of the best commands that you will ever find. This isn't a command in scriptED, so I've heard it refered to as the "perfect pause" and that is exactly what it is. When used as pausemove 0x0, it will wait for the exact amount of time that it takes for the movements to end. Really helpful isn't it?
Now we have pause. pause will wait for a set amount of time. You have to actually add the amount that it will wait for. The way we work out how long we should pause for is,
{Let "a" be the amount of movements}
Pause time = 0x10 + 0x10a
Personally, I don't use this very often, I prefer to use pausemove almost all of the time. But later on I might show where using pause instead of pausemove can be better.
Okay now, no more sidetracking, let's look at the movements.Lets look at the script withouta anything but the applymovements, pause and pausemoves. This leaves us with this.
The first two applymovements are in a completely normal setup.
ie. applymovement 0xXX $YYYYYY
pausemove/pause
But let's look at the next set of movements. It's set up differently. We have two applymovements before we have some sort of pause. What would happen if I did that? They would both move at the same time. This is sometimes referred to as "follow-me." With a "follow-me" we can use as many applymovements before the pause as we want. This can be useful if we wanted a "group" to walk together. We can have three, four, five, six, however many you want.I think that's all there is to the applymovement command.
Now we can move onto that playsound. Doesn't something look a little familiar about this? It is followed by a nop. Similiar to cry, isn't it? So I guess I'll explain in a similiar way, why the nop is there.
When we script playsound in hex we need 4 bytes to get it to work. Here's a short summary of what we need:
[playsound] [song] [song] [buffer]
Pokescript is missing that buffer. So we add nop for that buffer.
So now as you can see from the playsound in the script, we only to add one value after it, the Song number. If you're hacking Fire Red, you're in luck... I have a short list of song numbers in Fire Red. So sorry to R/S/E hackers but you can find the song numbers in A-Map.
Fire Red Songs
Now we have fadesound. What's that do? It's set up similiar to playsound and it will fade into the sound displayed. Since it is set up in a similiar way to playsound, it has a nop at the end of it so that it works. If you want more detail on how it works, just refer back to playsound.
Hmmmm... Is that it? No.
I thought I might point out something about the checkflag in this script. We actually have no setflag in this script. So why do I have a checkflag? We can actually check in one script if a flag was set in a different script. So in this script shown in this section, we check if the Pokemon menu has been activated before the script will go to it's end ($done).
Okay, I'm also going to ask you to compile the script, assign it to an event and not a person, and test it in the rom. Then look at this spoiler.
So what's next.
I'm going to do something different here. I'm not going to show a script. There's too much to explain to show in just one script.
Here's the most basic example.
This is the most basic form.
Before I explain this fragment of a script, I should go into a little more detail, on the command countpokemon itself.
countpokemon checks how many pokemon are in your party and writes the value to LASTRESULT. So if we have six Pokemon in our party, it would assign 0x06 to LASTRESULT, and if we had 3 pokemon in our party it would assign 0x03 to LASTRESULT.
Now back to that cut out part of a script.
With compare LASTRESULT 0x6 we are checking if they're are six Pokemon in our party. And then with if b_true goto $continue, it displays "if there is six pokemon in your party go to $continue."
That is the simplest form of countpokemon.
Let's get a little more complicated. Let's try this.
compare LASTRESULT 0x1 checks for one Pokemon in your party. But what's this b_>> thing supposed to do. It checks if what's in our party is greater than what is being compared. So according to this fragment of a script, if we have more than one pokemon in our party the script will continue.
Here's a short table of some different possibities for the b_??.
So I'll add one more example, just to help the information sink in.
In this example, it checks if you have two Pokemon, and if you have a number of Pokemon other than two, the script won't continue to $continue.
thethethethe's Pokescript Scripting Tutorial
Do Not Take Without Permission
Before I begin, I'd like to give thanks, to Dabomstew, Irish Witch, Foullump, Earthsvisitor, Mastermind X, loading_NOW, score_under and The Rom Raiders team (namely Hackmew, D-Trough and Wuggles); for commands, that I've found out about through tutorials and programs, and even just asking things, thanks.
Now a little background into why I'm writing this. I wrote a scripting tutorial to post at Phcompany, and I was looking at it and I thought, WOW, this is really outdated. Some of the stuff, was even wrong. Then I looked over at PC, and I saw the stacks and stacks of scripting tutorials, all covering the same basic commands over and over and over again. So I decided I'll make ammends for my poor tutorial and fix it up with this new one, and also end the trend of scripting tutorials posting the same things over and over.
Also please note. I won't be including all commands, because first of all, not all are known, and second of all, I consider some of them useless. Ones I consider useless will NOT be included with an explanation.
I think since, it's a Pokescript tutorial, I should give a little info on Pokescript.
Pokescript is a program created by Irish Witch. This program is, in my opinion, easier to use than other scripting programs like scriptED and Diamond Cutter.
Some important features of Pokescript are:
Dynamic offsets
You don't need to assign the hex pointer. It will do that for you.
Option of Using Decimal and Hex Values.
To make it easier. Instead of having to use 0x64, you can just use 100. But remember, if "0x" is infront of the number, it's a hex number.
This tutorial is going to cover a lot in detail.
The way I'll explain everything is, to show a script at the beginning and then explain everything "new" after it.
Please note, because I prefer to hack Fire Red over Ruby, some scripts are written to suit Fire Red/Leaf Green, and NOT Ruby/Sappire/Emerald.
I think I'll start with pointers.
Pointers
Pokescript automatically assigns the script to the rom, therefore, unlike it's opposition; ScriptED and Diamond Cutter, you can just use a random name for each pointer.
So we can use any random name for the pointer. It could be, for example...
$aaaaaaa ; $hellomynameisthethethethe ; $1234567890
As long as there are no spaces in it, and pointers aren't "doubled up" the pointer will work.
So as an example these won't work
$a a a a a a ; $hello my name is thethethethe.
Message Script
Now I can move onto a normal message script.
Code:
#org $start
lock
faceplayer
message $1
boxset 6
release
end
#org $1
$1 1 =Hi.\nWelcome to my tutorial!
#org $start marks the beginning of the script. It shows that it's the beginning.
lock will lock your player so that while this script is "in motion" the player won't be able to move.
faceplayer is used to make the sprite you are interacting with, face you.
message is used when you want a message to display on the screen. It is followed by a pointer that will be placed at the bottom as shown.
The actual message will appear like this.
I'll explain the other types, like \p and \l and others, a little later.Hi.
Welcome to my tutorial.
Now the boxset. Boxset MUST follow a message. Without this the message box, wont appear. In this case I've used boxset 6. I'll cover more later. boxset may also appear as callstd.
Now we use release. This will release the locked player.
And end will do what it's name says, and end the script.
Extra Message Info
There are lots of other little add ons that can be used with the message. Here's a short list, before I explain them.
I'll go in order of this list.\c
\h
\n
\l
\p
\v
\c usually refers to a colour.
So in this type of message
Will appear in a black text. But there are some more colours.\c\h01\h02You recieved a Pokemon
Here's a short list.
Fire Red/Leaf Green
Spoiler:
Code:
White - \c\h01\h00
Black - \c\h01\h02
Grey - \c\h01\h03
Red - \c\h01\h04
Orange - \c\h01\h05
Dark Green - \c\h01\h06
Cyan - \c\h01\h07
Blue - \c\h01\h08
Light Blue - \c\h01\h09
Spoiler:
Code:
White - \c\h01\h01
Red - \c\h01\h02
Grey - \c\h01\h03
Blue - \c\h01\h04
Black - \c\h01\h09
Pink - \c\h01\h0C
Brown - \c\h01\h0D
\h is used with hex values. Here's an example.
That \hB7 is the currency sign of the Pokemon world.Here's \hB7100
So in this example, I'm goint to use "$", here's an example.
Here's a Table for all the hex codes of each symbol.Here's $100
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=
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=
F8=[d]
F9=[l]
FA=\l
FB=\p
FC=\c
FD=\v
FE=\n
FF=\x
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=
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=
F8=[d]
F9=[l]
FA=\l
FB=\p
FC=\c
FD=\v
FE=\n
FF=\x
\n is used in text when we want to go to a new line. So in this message line.
It would appear like this.Hi.\nWelcome.
\l is used in text for a new line. But it can only be used after \n has already been used.Hi.
Welcome.
So in this message line.
This will appear like this.Hi.\nWelcome home.\lPlease put your bags up-\lstairs.
\p is used when we want the text to continue in a new box. So in this message line.Hi.
Welcome home.
Please put your bags up-
stairs.
This will appear like this. An empty line means a new box....\p...\p...\pThat's Right!
\v is used when we want display stored text. So here's an example....
...
...
That's Right!
This would appear like this.Hi \v\h01!\n\v\h06 is looking for you.
Hi [PLAYER'S NAME]
[RIVAL'S NAME] is looking for you.
Flags
Before I continue. I'm going to just add something on flags.
Flags are very useful when you need an event to only occur once or if you want a person to disappear.
We can set a flag, and if we want an overworld, to dissappear we have to assign the set flag to the OW's, people ID in advancemap. But I'll go into more detail on that later.
Many flags are used within the game already. So if you plan on leaving scripts that are already in the rom, you'll need to be more careful on what flags you use, because flags can only really be used once.
If you want some flags that are not used in the rom as a start, here's a few. 0x200 - 0x29F, 500-79F, 1000-109F. But you'll find more if you experiment with them.
I'll have to do a bit of explaining here, so I'll start with preventing events to happen.
Code:
#org $start
lock
faceplayer
checkflag 0x200
if b_true goto $done
message $1
boxset 6
setflag 0x200
release
end
#org $done
message $2
boxset 6
clearflag 0x200
release
end
checkflag checks if a flag has been set. Checkflag is usually followed by an if line.
When using the if line after checkflag it contains either a b_true or b_false. b_true, meaning, that if the flag is set goto ${pointer}, and if not it will continue with the script. Similiarly, b_false checks if the flag is NOT set, and if it isn't it will goto ${pointer}, and if the flag is set, the script will continue without going to the pointer.
This pointer used in if b_true goto $done it points to another part of the script as you can see in the script.
As you can see the if b_true goto $done points to a different part of a script as shown with the #org $done
Here we have a message and a new command, clearflag.
Once flags are set they can be "unset" with the command clearflag.
Clearflag has to be followed by the flag number.
And here we are at the end of the script.
But there is more than one way to use a flag. Some flags have some sort of game function. I'll explain that in the next part.
Givepokemon
Givepokemon does exactly what it says. It gives the player a Pokemon. Here's my example script. There will be quite a few new commands here.
Code:
#org $start
checkflag 0x828
if b_true goto $done
message $1
boxset 5
compare LASTRESULT 0x1
if b_true goto $take
message $2
boxset 6
release
end
#org $take
givepokemon 4 5 0
fanfare 0x13E
message $3
boxset 4
waitfanfare
#raw 0x68
setflag 0x828
message $4
boxset 5
compare LASTRESULT 0x1
if b_true gosub $name
message $5
boxset 6
release
end
#org $name
call 0x1A74EB
return
#org $done
message $6
boxset 6
release
end
#org $1
$1 1 =I'm sorry, I can't take care\nof my Charmander.\pCan you take care of it for me?
#org $2
$2 1 =That's okay. I'm sure someone\nelse will take it.
#org $3
$3 1 =\c\h01\h02You received a Charmander!
#org $4
$4 1 =\c\h01\h02Would you like to rename Charmander?
#org $5
$5 1 =Take Care of Charmander.
#org $6
$6 1 =I hope you're taking good care of\nCharmander.
I guess I'll start from the top.
checkflag and the if line, we have already covered.
Message has also been covered, but boxset 5hasn't.
boxset 5 does a similar job to boxset 6, but this box also gives us the option of a Yes/No box on the screen aswell. Obviously this would be used if you want to ask someone a question.
boxset 5 is usually followed by a compare line.
compare needs the variable, which in this case is LASTRESULT and also a value, which in this case is 1.
LASTRESULT is a useful variable that most commands store values in.
When using compare after a boxset 5, you only have two options for the value, 0, which is NO and 1, which is YES.
This compare LASTRESULT 0x1, will check if you pressed YES and of course, compare LASTRESULT 0x0 will check if you pressed NO.
This if line that follows the compare line does the same thing as what it does for checkflag. if b_true will check if the button pressed matches the compared value and if it is, it will goto ${pointer} and if not, it will continue the script.
Then we have a Normal Message and the end of the script. So I'll now move onto the next part.
The first new command here is givepokemon.
givepokemon uses three values. The first is the Pokemon, the second being the level and the third being the Item Held.
So in the script above, mine shows....
Code:
givepokemon (Charmander) (Level 4) (No Item)[/i]
Just in case, you don't already have one, here's a list of Pokemon and Items.
[B]Pokemon[/B]
[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|w| 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
[/spoiler]
[B]Items[/B]
[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[/spoiler]
Now we have [I]fanfare 0x13E[/I]. This is a jingle. It's a short bit of music that is played when you recieve something like a Pokemon or an item.
Then we have a [I]message[/I]. The only difference here is that we have used [I]boxset 4[/I]. Boxset 4 is different to [I]boxset 6[/I], because it will not close. But if it doesn't close, why would I use it? You'll just have to keep reading to find out.
[I]waitfanfare[/I] will do what it's name displays. It will wait for the fanfare to finish, before it allows the script to continue. This [I]boxset 4[/I] has left the box open while we wait for the [I]fanfare[/I] to end.
[I]#raw 0x68[/I], a very useful command in my script. This is a very useful command with [I]boxset 4[/I]. It will basically, make the [I]boxset 4[/I] act as a [I]boxset 6[/I], so that it can now close when you press a button.
[I]setflag 0x828[/I]... I wonder what this is for. In Fire Red and Leaf Green, this is very useful, as it activates the [I]Pokemon[/I] option on Start Button Menu.
Here's a Short list of some of them. That's pretty much all thats needed, don't you think?
[B]Flags[/B]
[spoiler]Fire Red:
0x820 - First Badge
0x821 - Second Badge
0x822 - Third Badge
0x823 - Fourth Badge
0x824 - Fifth Badge
0x825 - Sixth Badge
0x826 - Seventh Badge
0x827 - Eighth Badge
0x828 - Pokemon Menu
0x829 - Pokedex Menu
0x82F - Running Shoes
Ruby/Sapphire:
0x800 - Pokemon Menu
0x801 - Pokedex Menu
0x802 - Pokenav Menu
0x807 - First Badge
0x808 - Second Badge
0x809 - Third Badge
0x80A - Fourth Badge
0x80B - Fifth Badge
0x80C - Sixth Badge
0x80D - Seventh Badge
0x80E - Eighth Badge
0x860 - Running Shoes
Emerald:
0x860 - Pokemon Menu
0x861 - Pokedex Menu
0x862 - Pokenav Menu[/spoiler]
Now we have the [code]boxset 5
compare LASTRESULT 0x1
if b_true gosub $name
If you use ScriptED this, is would just be if2 to you. Gosub, is somthing used in other programming languages, and is just used to say, "go there but you have to come back."
So let's look at what we have there, gosub $name, I guess that means that we are going to go look at $name
Here we have call 0x1A74EB. Call is used to call some other script within a rom. It can also call a part of your script, in that case it would appear,
Code:
call ${pointer}
Now we have return, but what's that do, it just returns to wherevere it was called from or gosubed from. I didn't mention it earlier, but call should have a return wherever it is called from.
That return has brought us back to message $5. The rest is already explained, so now we can move onto the next part.
I think we'll move onto something similiar and go to...
Wildbattle
Code:
#org $start
lock
faceplayer
message $1
boxset 6
cry 0xA1 6
nop
nop
wildbattle 6 30 0x8B
fadescreen 0
#raw 0x53 0x0F 0x80
setflag 0x200
release
end
#org $1
$1 1 =CHARIZARD: Raaarrgghh!
Sorry but I have to get a little "advanced" here, but hopefully, I'll explain it well enough so that it sounds simple. When we script cry in hex it takes 6 bytes,
[cry] [bank] [pkmn] [pkmn] [buffer] [buffer]
In pokescript unfortunately it's only coded 4 of those six bytes, so now we need to add two bytes, which will act as those buffers. So I chose to just use two nops. To cover those buffers.
Oh wait, I forgot to explain Cry. First we have the command, and then it's followed by the bank. 0xA1, is the Pokemon cry bank. Then that is followed by the Pokemon, which in this case, is a Charizard.
Now Wildbattle. So in my script, we have.
Code:
wildbattle {Charizard} {Level 30} {Oran Berry}
fadescreen is a command that is used to make the screen fade to black, and sometimes back. fadescreen 0x0 will create a blinking effect which will make it seem as if the Pokemon is there one second, and gone the next. There are more different fadescreen's but I'll cover some of those later in the tutorial.
Now we can move onto #raw 0x53 0x0F 0x80. This is very useful, as it makes the Overworld your interacting with dissappear. I'll go into a little more detail on #raw 0x53 0x0F 0x80 below in the spoiler, because it will be a little more complex than where we are at, at the moment.
Spoiler:
When we interact/talk with an OW, the people number is assigned to the variable 0x800F. So in the case of #raw 0x53 0x0F 0x80, it's showing, "remove sprite, (variable) 0x800F" It isn't actually a people no. 0x800F, it's just that the people no. is assigned to the variable.
#raw 0x53 can also be used a little differently and I'll explain that also a little later in the tutorial.
Remeber how I mentioned in Flags, how I mentioned something about the people id, in advancemap. This is where I'll be explaining that. Here, we've used the flag 0x200, so we are going to change the Overworld that this script is assigned to's people id to 0200. The people id, is used to make sure that the Overworld, doesn't continue to re-appear, but that is easier to learn via experience.
and that's it, I guess we can now move onto something else.
Checkgender
Code:
#org $start
lock
faceplayer
checkgender
compare LASTRESULT 0x0
if b_true goto $boy
compare LASTRESULT 0x1
if b_true goto $girl
end
#org $boy
message $1
boxset 6
release
end
#org $girl
message $2
boxset 6
release
end
#org $1
$1 1 =Hello Mr. \v\h01.
#org $2
$2 1 =Hello Ms. \v\h01.
So we have the command Checkgender. Like most commands, it assigns a value to LASTRESULT. We check what this value is with compare LASTRESULT 0x*. The asterix just stands for what we are checking for. With checkgender, it assigns 0x0 to LASTRESULT for a male, and it assigns 0x1 to LASTRESULT for a female.
I've used two compare's but it can be alternitavely my script could also have been written like this.
Code:
#org $start
lock
faceplayer
checkgender
compare LASTRESULT 0x0
if b_true goto $boy
message $2
boxset 6
release
end
#org $boy
message $1
boxset 6
release
end
#org $1
$1 1 =Hello Mr. \v\h01.
#org $2
$2 1 =Hello Ms. \v\h01.
Code:
#org $start
lock
faceplayer
checkgender
compare LASTRESULT 0x1
if b_true goto $girl
message $1
boxset 6
release
end
#org $girl
message $2
boxset 6
release
end
#org $1
$1 1 =Hello Mr. \v\h01.
#org $2
$2 1 =Hello Ms. \v\h01.
It think that's all that I need to explain for this.
Giveitem
Code:
#org $start
lock
faceplayer
checkflag 0x200
if b_true goto $done
message $1
boxset 5
compare LASTRESULT 0x1
if b_true goto $take
message $2
boxset 6
release
end
#org $done
message $3
boxset 6
release
end
#org $take
giveitem 13 1
message $3
boxset 6
setflag 0x200
release
end
#org $1
$1 1 =Hi I'm from the Cherrygrove\nPokemart.\pWhy don't you take this free\nsample.
#org $2
$2 1 =That's okay, I'm sure someone\nelse might enjoy it.
#org $3
$3 1 =If you want more you'll have\nto go to the pokemart to\lbuy them.
Now onto the new things in this script. We have the giveitem command.
Giveitem will take two values, the item no. and the amount.
In my script I have used these.
giveitem {Potion} {One of them}
That's actually all you need to do for this command. It will automatically play a jingle, and it will automatically display a message saying "You recieved ............" That's actually all I need to explain.
WARNING: The most common mistake when people use this, is that they leave off the second number and forget about it. This will make the game go to a Red Screen, which you will not be able to come back from. Make sure you have both numbers used with this command.
How about we move onto some simple specials now.
Special
Code:
#org $start
lock
faceplayer
message $10
boxset 4
#raw 0x68
fadescreen 0x1
fanfare 0x100
special 0x0
waitfanfare
fadescreen 0x0
message $11
boxset 6
release
end
#org $10
$10 1 =What wonderful Pokèmon you\nhave there but they look like\lthey could use a break.
#org $11
$11 1 =Now they look better.\nDon't forget to visit.
Looks like I've used boxset 4 and #raw 0x68 again. I've also used fadescreen 0x1 aswell as fadescreen 0x0, another fanfare and special 0x0.
I'm going to do something different here. I'm going to start with the fadescreens? Do you still remember what fadescreen 0x0 does?
Spoiler:
That's right, it creates a blinking effect.
Fadescreen 0x1 is of course not the same as fadescreen 0x0, it actually fades the screen out to completely black. But I can guess what you're asking, how do we turn it back? We of course use fadescreen 0x0 to reverse the process, and return the screen to it's normal state.
Now that you should have an understnding of fadescreen 0x1, we can move backwards, and look at "Why I used boxset 4 instead of boxset 6.
I will be fully truthful with you on this. For some reason, that I can't explain, if we use boxset 6 before we use fadescreen 0x1 the box will remain open until we return to our normal screen with fadescreen 0x0, and once we are there we will see it close but I don't want that. It doesn't look very good. We want it to close before we come back from our black screen. I can't explain this, but for some reason, when we use boxset 4 and #raw 0x68, it does just that. So whenever you have a script like this, use boxset 4 before, we go to a fadescreen.
The fanfare is very useful in this script. In theory I could have used pause(which is a command I have not covered yet), but I wanted to use the combination of fanfare 0x100 and waitfanfare.
For those who don't know, fanfare 0x100 is the healing jingle that is played when your mother heals your Pokemon. So now, with the help of waitfanfare, the screen will not return to normal until that jingle is completed.
Now all that's left is of course, special 0x0. This is a special command that will fully heal the Pokemon within your party. Useful isn't it?
I'm also going to include a short list of specials in spoiler right here, for whoever may want it.
Specials
Spoiler:
special 0x0 - Heal Pokemon
special 0x3C - Acess 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 - Groudons 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)
special 0x3C - Acess 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 - Groudons 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)
Applymovement
Code:
#org $start
checkflag 0x828
if b_true goto $done
message $1
boxset 6
applymovement 0x04 $move
pausemove 0x0
applymovement 0xFF $move2
pause 0x30
message $2
boxset 6
playsound 0x13E
nop
applymovement 0x04 $move3
applymovement 0xFF $move3
pausemove 0
fadesound 0x12C
nop
release
end
#org $done
release
end
#org $move
#raw 0x62 0x12 0x12 0x12 0x12 0xFE
#org $move2
#raw 0x03 0xFE
#org $move3
#raw 0x13 0x13 0x13 0x13 0xFE
#org $1
$1 1 =Waaaiiiitttt!!!
#org $2
$2 1 =You can't go out there\nwithout your own Pokemon.\pWild Pokemon will hurt you.
Applymovement is a very useful command that allows to show an overworld walking or running depending on what we want.
When we use applymovement, it has to be followed by a People Number, which is found here...
and a pointer to where our movements are. An overworld with a people number of "4", seems normal doesn't it? But what about one with 0xFF(256). There's never 256 Overworlds on the one map. 0xFF is the "Hero's" people number.
Now let's look at this movements in a simpler view.But First I'll have to give you a movements list won't I?
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
' EXIT
0xFE
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
' EXIT
0xFE
Fire Red/Leaf Green
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
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
Before we look at the movements in a different view, I should explain the layout of the movements at the pointer. It is set out in a similiar way to a message. We have #org $pointer first and then what's being written to the rom below that. So we add #raw and then the movements that we want. But remember, that if you forget to add 0xFE to the end of the movements, your script will not work.
Actually, you know what? I changed my mind, before we look at the movements we're going to look at pausemove and pause.
pausemove is one of the best commands that you will ever find. This isn't a command in scriptED, so I've heard it refered to as the "perfect pause" and that is exactly what it is. When used as pausemove 0x0, it will wait for the exact amount of time that it takes for the movements to end. Really helpful isn't it?
Now we have pause. pause will wait for a set amount of time. You have to actually add the amount that it will wait for. The way we work out how long we should pause for is,
{Let "a" be the amount of movements}
Pause time = 0x10 + 0x10a
Personally, I don't use this very often, I prefer to use pausemove almost all of the time. But later on I might show where using pause instead of pausemove can be better.
Okay now, no more sidetracking, let's look at the movements.Lets look at the script withouta anything but the applymovements, pause and pausemoves. This leaves us with this.
Code:
#org $start
applymovement 0x04 $move
pausemove 0x0
applymovement 0xFF $move2
pause 0x30
applymovement 0x04 $move3
applymovement 0xFF $move3
pausemove 0
release
end
#org $move
#raw 0x62 0x12 0x12 0x12 0x12 0xFE
#org $move2
#raw 0x03 0xFE
#org $move3
#raw 0x13 0x13 0x13 0x13 0xFE
ie. applymovement 0xXX $YYYYYY
pausemove/pause
But let's look at the next set of movements. It's set up differently. We have two applymovements before we have some sort of pause. What would happen if I did that? They would both move at the same time. This is sometimes referred to as "follow-me." With a "follow-me" we can use as many applymovements before the pause as we want. This can be useful if we wanted a "group" to walk together. We can have three, four, five, six, however many you want.I think that's all there is to the applymovement command.
Now we can move onto that playsound. Doesn't something look a little familiar about this? It is followed by a nop. Similiar to cry, isn't it? So I guess I'll explain in a similiar way, why the nop is there.
When we script playsound in hex we need 4 bytes to get it to work. Here's a short summary of what we need:
[playsound] [song] [song] [buffer]
Pokescript is missing that buffer. So we add nop for that buffer.
So now as you can see from the playsound in the script, we only to add one value after it, the Song number. If you're hacking Fire Red, you're in luck... I have a short list of song numbers in Fire Red. So sorry to R/S/E hackers but you can find the song numbers in A-Map.
Fire Red Songs
Spoiler:
Fire Red
0x108 - Safari Zone
0x112 - Team Rocket Celadon Hideout, Bruno
0x113 - Elite 4
0x117 - Cinnabar Island
0x118 - Lavender Town
0x11F - Viridian Forest, Diglett Cave, Seafoam Islands
0x120 - Mt Moon, Victory Road, Rock Tunnel
0x121 - Power Plant, Pokemon Mansion
0x123 - Route Song 2
0x124 - Route Song 1
0x125 - Route Song 3
0x126 - Route Song 4
0x127 - Elite 4, Champion
0x12C - Pallet Town
0x12F - Pokemon Center, Mart
0x130 - S.S. Anne
0x132 - Pokemon Tower, Agatha
0x133 - Team Rocket Silph Co.
0x134 - Cerulean City, Fushia
0x135 - Celadon
0x139 - Vermillion
0x13A - Viridian, Pewter, Saffron
0x14B - Mt.Ember/Icefall Cave
0x14D - Island Routes
0x14E - Dotted Hole
0x14F - Island 1-3
0x150 - Island 4-5
0x151 - Island 6-7
0x158 - Trainer Tower
0x108 - Safari Zone
0x112 - Team Rocket Celadon Hideout, Bruno
0x113 - Elite 4
0x117 - Cinnabar Island
0x118 - Lavender Town
0x11F - Viridian Forest, Diglett Cave, Seafoam Islands
0x120 - Mt Moon, Victory Road, Rock Tunnel
0x121 - Power Plant, Pokemon Mansion
0x123 - Route Song 2
0x124 - Route Song 1
0x125 - Route Song 3
0x126 - Route Song 4
0x127 - Elite 4, Champion
0x12C - Pallet Town
0x12F - Pokemon Center, Mart
0x130 - S.S. Anne
0x132 - Pokemon Tower, Agatha
0x133 - Team Rocket Silph Co.
0x134 - Cerulean City, Fushia
0x135 - Celadon
0x139 - Vermillion
0x13A - Viridian, Pewter, Saffron
0x14B - Mt.Ember/Icefall Cave
0x14D - Island Routes
0x14E - Dotted Hole
0x14F - Island 1-3
0x150 - Island 4-5
0x151 - Island 6-7
0x158 - Trainer Tower
Now we have fadesound. What's that do? It's set up similiar to playsound and it will fade into the sound displayed. Since it is set up in a similiar way to playsound, it has a nop at the end of it so that it works. If you want more detail on how it works, just refer back to playsound.
Hmmmm... Is that it? No.
I thought I might point out something about the checkflag in this script. We actually have no setflag in this script. So why do I have a checkflag? We can actually check in one script if a flag was set in a different script. So in this script shown in this section, we check if the Pokemon menu has been activated before the script will go to it's end ($done).
Okay, I'm also going to ask you to compile the script, assign it to an event and not a person, and test it in the rom. Then look at this spoiler.
Spoiler:
Didn't work, did it? Froze on the spot. You're going to need to change this...
to this....
Try it now. Worked perfectly, didn't it?
to this....
Try it now. Worked perfectly, didn't it?
So what's next.
Countpokemon
I'm going to do something different here. I'm not going to show a script. There's too much to explain to show in just one script.
Here's the most basic example.
Code:
countpokemon
compare LASTRESULT 0x6
if b_true goto $continue
Before I explain this fragment of a script, I should go into a little more detail, on the command countpokemon itself.
countpokemon checks how many pokemon are in your party and writes the value to LASTRESULT. So if we have six Pokemon in our party, it would assign 0x06 to LASTRESULT, and if we had 3 pokemon in our party it would assign 0x03 to LASTRESULT.
Now back to that cut out part of a script.
With compare LASTRESULT 0x6 we are checking if they're are six Pokemon in our party. And then with if b_true goto $continue, it displays "if there is six pokemon in your party go to $continue."
That is the simplest form of countpokemon.
Let's get a little more complicated. Let's try this.
Code:
countpokemon
compare LASTRESULT 0x1
if b_>> goto $continue
Here's a short table of some different possibities for the b_??.
Spoiler:
B_<< Lower Than
B_== Equals
B_>> Greater Than
B_<= Lower than or Equal to
B_>= Greater than or Equal to
B_!= Not exactly equal to
B_== Equals
B_>> Greater Than
B_<= Lower than or Equal to
B_>= Greater than or Equal to
B_!= Not exactly equal to
So I'll add one more example, just to help the information sink in.
Code:
countpokemon
compare LASTRESULT 0x2
if b_!= goto $continue
Last edited by a moderator: