Welcome to the PokéCommunity!

Hi there! Thanks for visiting PokéCommunity. We’re a group of Pokémon fans dedicated to providing the best place on the Internet for discussing ideas and sharing fan-made content. Welcome! We’re glad you’re here.

In order to join our community we need you to create an account with us. Doing so will allow you to make posts, submit and view fan art and fan fiction, download fan-made games, and much more. It’s quick and easy; just click here and follow the instructions.

Pokémon Sun and Moon are now available! Read our extensive Sun and Moon review at Daily!

The finale of the fourth annual Favorite Pokémon Tournament is underway in Pokémon General!View the poll and vote for as many Pokémon as you'd like. Voting is only open until the 5th of December though, so don't wait to make your picks!

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 offsetsYou 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.

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.

Quote:

Hi.
Welcome to my tutorial.

I'll explain the other types, like \p and \l and others, a little later.

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.

Quote:

\c\h\n\l\p\v

I'll go in order of this list.\c usually refers to a colour.
So in this type of message

Quote:

\c\h01\h02You recieved a Pokemon

Will appear in a black text. But there are some more colours.
Here's a short list.Fire Red/Leaf Green

\n is used in text when we want to go to a new line. So in this message line.

Quote:

Hi.\nWelcome.

It would appear like this.

Quote:

Hi.
Welcome.

\l is used in text for a new line. But it can only be used after \n has already been used.
So in this message line.

Quote:

Hi.\nWelcome home.\lPlease put your bags up-\lstairs.

This will appear like this.

Quote:

Hi.
Welcome home.
Please put your bags up-
stairs.

\p is used when we want the text to continue in a new box. So in this message line.

Quote:

...\p...\p...\pThat's Right!

This will appear like this. An empty line means a new box.

Quote:

...

...

...

That's Right!

\v is used when we want display stored text. So here's an example.

Quote:

Hi \v\h01!\n\v\h06 is looking for you.

This would appear like this.

Quote:

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.

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

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....
[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.

Now we have fanfare 0x13E. 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 message. The only difference here is that we have used boxset 4. Boxset 4 is different to boxset 6, 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.waitfanfare will do what it's name displays. It will wait for the fanfare to finish, before it allows the script to continue. This boxset 4 has left the box open while we wait for the fanfare to end.#raw 0x68, a very useful command in my script. This is a very useful command with boxset 4. It will basically, make the boxset 4 act as a boxset 6, so that it can now close when you press a button.setflag 0x828... I wonder what this is for. In Fire Red and Leaf Green, this is very useful, as it activates the Pokemon 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?Flags

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,

Code:

call ${pointer}

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 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.

Code:

wildbattle {Charizard} {Level 30} {Oran Berry}

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.

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.

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.

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?

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[size="1"](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

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

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 nosetflag 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?

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

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.

Code:

countpokemon
compare LASTRESULT 0x1
if b_>> goto $continue

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_??.

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

So I'll add one more example, just to help the information sink in.

Code:

countpokemon
compare LASTRESULT 0x2
if b_!= goto $continue

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.

Obviously, trainerbattle is just a battle with a trainer. Trainerbattle is great because the game will actually keep track of whether you have beaten a trainer or not. So in this script we have no need for a checkflag/setflag situation.
Now to explaining these values after the trainerbattle. These are:
[trainerbattle] [Type of battle] [Trainer ID] [Message Before Battle] [Message if you Win]
So I'll guess I'll explain the type of battle. The type of battle, just displays whether it is a double battle, Gym Leader Battle, and some more. When you just use "0", it is just a normal trainerbattle. One that you would just see in a route, or even a gym trainer. It will, "Spot you," beginning message, battle, Message when win.
Now we'll move onto the Trainer ID. I don't have a list of these sorry. But what I can do, is tell you that these are the ID's of trainers that are found in PET. For Example, Brock can be found with with a Trainer ID of 0x19E, and Blaine can be found at 0x1A3.
Now we see two pointers. $before & $after. I've labeled these to help display what they are for. The first pointer, $before displays is the pointer to the message displayed before the battle.$after, can you guess what this does? That's right it's the pointer to the message after the battle. This message appears while we are still in the batte event. Remember the colours that were mentioned towards the beginning of this tutorial. Well, we can use colours with this too, but they are different.
Here's a list.Fire Red

Sorry Ruby hackers, I don't have a list for those values.
Now if I were to test it in a rom, guess what happens after the trainerbattle? Nothing... The script ends. So, why do I have a message after it?
Remember how I talked about trainerbattle keeping track of whether you have beaten them or not. Once you beat the trainer, the trainer battle will be skipped. So when you speak to them after beating them in a battle, it will be treated like a normal message script.
So wait! Why don't I have a lock and faceplayer there after the trainerbattle? The reason is that once you have beaten that trainer, it will act as the lock/faceplayer combo, and you don't have to worry about them in this script.
That's the scripting side of this command done. Now the A-Map side. Now compile this script, and test it in a rom. Did it work like a normal trainerbattle? I bet your answer is No.
You'll need to fill in these boxes.

Remember that image, that was used with the previous script. Ignore that, for this kind of script, the "trainer" box doesn't need to be checked.
This script is a little longer than the previous trainerbattle script.
You'll see that the "0" in the previous script, has become a "1." There is also a third pointer.
If it shows a "1," it means that it needs three pointers after the trainerbattle command. The first two are the same as in the previous script, one for before the battle, and one for after the battle. But you'll see the third pointer doesn't point to a message. It points to $later. It's a seperate part of the script, where it allows the script to continue after you have won the trainerbattle.
If you refer to the flag section, you'll be able to see what the setflag 0x820 is. It's to activate the first badge on the trainercard.
I think that's about all I need to add on trainerbattle's.

Warp

I think I'm st the stage in this tutorial, where I don't need to show an example script of every command. This is one of those cases.
So now, we have warp. Warp is there to allow the player to warp to a different map. Warp is used like this.[warp] [map bank] [map number] [warp number]
Let's say we wanted to warp to the front of Oak's Lab in Pallet Town.
So open a Fire Red/Leaf Green Rom in Advance Map, and open the Pallet town map.To the far left of the program's window, you'll see an orange box next to the current open map. If you've clicked Pallet Town, it should say Pallet Town (3.0).
The "3" is the map bank, and the "0" is the map number. Now we need to click on the warp on the door of Oak's Lab. It should have "Event Number: 2". Now we have our three values.
So we write our warp command.

Code:

warp 0x3 0x0 0x2

Ta-dah! There's our warp. Except you know what the problem with warp is, once you use it, the script ends. But you might say... "How come when you warp to Oak's Lab in Fire Red, the script still continues?" That involves some of the more difficult parts of scripting. Level Scripts. Since these are a little difficult, I'll explain these towards the end of the tutorial.

This is something that quite a few people don't know about. It's something that a lot of scripters were 'in the dark' about it.
Well, I want this to warp straight to your bed in your room. This is in map PALLET TOWN (4.1). So what is the 0xFF for? The 0xFF is what tells the command that it is going to warp to a certain postion. But wait, didn't I just say that after the warp command, the script ends? That is true. So why do I have the #raw's there?
If we were to script that warp to position in hex it would appear.39 04 01 FF 02 00 06 00
So even though the #raw's on a different line, the #raw's still part of the warp command. But wait, I haven't explained what the #raw's are for yet...
Let's look at the locations of the bed in your room. (X=2)(Y=6). So they are 0002 & 0006. Now we have to reverse these values. I'll explain how to do this.
If we have 0002, we'll seperate that into 2 bytes, 00 02, and then we reverse it.... 02 00
IF we do the same thing for Y=6, we get 06 00. We have our #raw's.
So it's that simple. We can now warp to a certain postion.

Weather Commands

When we want to change the weather in a script there are two commands that we need to know about, Setweather and doweather.Setweather will set a certain type of weather to be activated by doweather.
So this is how we set up our setweather command.[setweather] [weather type 2 bytes]
Here's a list of the different weather types. This applys to all third Generation games.

But let's look at this. There is a reason behind it. We have a #raw 0x00 after setweather. That's right, it's like cry and playsound it isn't coded correctly. So why didn't I use nop. Nop is either coded by pokescript as two different bytes 00 & 01. We just don't want to take that chance and have it use 01 instead of the 00, that is needed.
As you can see, doweather doesn't need any values after it. It's simply just doweather on it's own.

There is one more somewhat useful #raw 0xA3.
This command will prepare the game to return back to it's default map weather. Since this only prepares the rom for it, it still needs to be followed by doweather.

Pokemart

Here's just a basic script. By now, you should be able to add to it, pretty easily.

Well, we have the pokemon command. It is simply followed by a pointer. This will point to the values of the items that will appear in the pokemart screen. The #binary are set up differently. They're set up like this.#binary int 0x(value)
In this case, we have the these items respectively:

Master Ball 0x1

Ultra Ball 0x2

Great Ball 0x3

Poké Ball 0x4

Safari Ball 0x5

Net Ball 0x6

Dive Ball 0x7

Nest Ball 0x8

Repeat Ball 0x9

Timer Ball 0xA

Luxury Ball 0xB

Premier Ball 0xC

Parlyz Heal 0x13

Full Restore 0x14

But why is there no 0x0 item. 0x0 marks the end of the item line. Without this, the command will NOT work. You don't have to have two lines of items, it could appear like this.

#raw's also give us the option of using commands, that aren't coded into pokescript. You've already seen some of them. #raw 0xA3, #raw 0x68, and #raw 0x53. These are just what we have already covered. From this point on there, more and more will appear.

Hidesprite and Showsprite

These two commands are #raw's. Showsprite is the #raw 0x53 command that we covered in a little detail earlier. We used it as this, #raw 0x53 0x0F 0x80, which will make the last person we talked to disappear. But, what if we wanted a certain person to dissappear?
Remember the reversing of values that we covered in the warp to position section.

Quote:

Originally Posted by thethethethe

Let's look at the locations of the bed in your room. (X=2)(Y=6). So they are 0002 & 0006. Now we have to reverse these values. I'll explain how to do this.
If we have 0002, we'll seperate that into 2 bytes, 00 02, and then we reverse it.... 02 00
IF we do the same thing for Y=6, we get 06 00. We have our #raw's.

We're going to do this with the people numbers of the OW. A common mistake is confusing the [b]people id[/i] with the [b]event id.[/i]. Make sure you get the people Id. If forgot to show how the command is set out didn't I?#raw 0x53 0x(people no. reverersed) 0x(people no. reverersed)
So lets use an example. People No. = 4. Here's how it will appear.#raw 0x53 0x04 0x00
And maybe one more if it's needed. People No = 12.#raw 0x53 0x0C 0x00
Now you should have a pretty full understanding of the #raw 0x53 command, so let's move onto showsprite.

Showsprite, can make an OW re-appear.
Showsprite is set out in the exact same way as #raw 0x53. And if you haven't guessed already, Showsprite isn't a command coded in pokescript it is #raw 0x55.
So here's some complimentary examples from when I explained #raw 0x53Example 1. People No. = 4.#raw 0x55 0x04 0x00Example 2. People No = 12.#raw 0x55 0x0C 0x00
If you wanted to keep the person viewable:
If you remember back to wildbattle, you'll see that you need to use a setflag to keep the person hidden. So if we were to keep them viewable after using #raw 0x55, we would need to use clearflag.

Giveegg

Yet another #raw command. #raw 0x7A. A relatively simple command to use. All we need is to add the pokemon number reveresed after it.
So as an example, let's give a Pikachu Egg. Pikachu's Pokemon number is 25. So let's convert that to hex; 0x0019. Now just like with people numbers, we reverse it. and it gives us 19 00.
So our giveegg, command would appear like this.

Code:

#raw 0x7A 0x19 0x00

Just incase, you need some more explanation, let's use Treecko as an extra example. Treecko is number 277. So we convert it to hex; 0x0115; and then reverse it; 15 01. So our line appears like this;

Code:

#raw 0x7A 0x15 0x01

Pretty easy, huh?

Change Message Colour

YAY! Another #raw. #raw 0xC7. We had an older way of changing the text colour with the message. Let's do it in the script. We have three usefule colours here.

Blue = 0x00

Red = 0x01

Black = 0x02

Since they're short I'll show examples of all three of them.Black Text

WE can find our X and Y Co-ordinates in Advance map, which has been shown earlier. We can also find our tile number in Advancemap. the number depends on what tileset we are using aswell. So Hold your mouse over a tile in the right pane. In the little status bar at the bottom on the far left, you should have Block: XX Offset: XXXXXX
Movement allowed has two possible options.

0x0 = Passable

0x1 = Blocked off

So what's the special there for?
This special will reset the map so that it allows the tile to set. Without this, you'll have to leave the screen and come back before it will actually work.

Special Trainer Commands

We've got three commands here, all #raw's.
First is Checktrainer - #raw 0x60
Second is disable trainer - #raw 0x61
Last is is Enable Trainer - #raw 0x62
All these three commands are set out in the same way.
[command] [pet id reversed] [pet id reversed]
Some more reversing. Maybe you've figured this out by now, but whenever we have 2 or more bytes, the bytes are reversed. This is also the case for pointers, and money values, but I'll be covering them in more detail a little later.
For all three examples I'm going to use, the trainer "Gym Leader Brock." Which in Fire Red, the Pet ID, is 0x19E. So let's reverse it now, so that I don't have to do it later. 0x019E, is 9E 01.
Now let's work with checktrainer. So since we're checking for something, the answer or result is going to have to be stored somewhere. Like most commands, the result is stored into LASTRESULT. So here's the example.

Pretty straightforward, isn't it? It's simply followed by the compare and if statements. If you thought this was easy, the next two are even easier.
Here's Disabletrainer. Again, we'll be using Brock for the example.

Code:

#raw 0x61 0x9E 0x01

That's it. If were supposed to battle Brock, it won't battle anymore. The trainerbattle is disabled.
But now we want to re-enable the trainerbattle. We're still using Brock.

Code:

#raw 0x62 0x9E 0x01

How's that? The trainerbattle 0x19E, has now been re-enabled.

Checkitem/removeitem

This time only part #raw. It's like Cry and Playsound, its not coded correctly into the pokescript database. These are probably easier to view through an example.

A bit more than usual. I'll start at the top of my list. This looks a little familiar doesn't it. compare LASTRESULT 0x1compare 0x800D 0x1
Guess, why they look similiar, they're the same thing. 0x800D=LASTRESULT
I'm going to be using this type of thing from now on. I'm not going to be "babying" anyone with LASTRESULT anymore.Vrey soon, we're going to start moving into variables. So I'll start introdusing you into them now, so I'm not just introducing you into a new wway of thinking straight away.

if 0x1 goto $pointer, I'll include if 0x4 goto $pointer in this explanation aswell. Up to date, Up to date, we've only used these.B_<< Lower Than (b_false)
B_== Equals (b_true)
B_>> Greater Than
B_<= Lower than or Equal to
B_>= Greater than or Equal to
B_!= Not exactly equal to

But now I'm going to add to that. Other than what we have here, we can also use values, like 0x1, 0x2, 0x3 etc. I'll propoose a new "table"B_<< Lower Than (0) (b_false)
B_== Equals (1) (b_true)
B_>> Greater Than (2)
B_<= Lower than or Equal to (3)
B_>= Greater than or Equal to (4)
B_!= Not exactly equal to (5)
Now we can see what each value represents. This is also another way to save time. So instead of writing;if b_!= goto $notequal
we can just write;if 0x5 goto $notequal

Saving some time. Pretty useful, huh? From this point on, I'll only be using 0xX, with the if line. I thought I'd warn you, just so it doesn't look like I've totally changed the way I script without notice.

Now checkitem. Another command, not correctly coded. In pokescript its coded like this.
[checkitem] [item number]
But it should be like this;
[checkitem] [item] [amount]
So can you guess what the #raw's are for?
The amount! As always, it's reversed.
As an example, let's say we wan't to check for 10 Masterballs. It would appear like this.

Code:

checkitem 0x1
#raw 0x0A 0x00
compare 0x800D 0x1
if 0x4 goto $got

But wait, I haven't explained the compare yet, have I? The compare checks for "Yes, you've got item(0x1)" or "No you don't(0x0)"
And by now you should be able to tell what the if should do by now.

Now, removeitem. It obviously removes an item from your bag. Like giveitem and checkitem, it is set out in the same way.
[removeitem] [item no.] [amount to remove]
Do I need to give any more explanation? This should be enough info on it.

Copyvar

A little command that's pretty easy to explain. It just copies what's stored in one variable to another variable. Which we will use more and more often, as we progress through the tutorial.
Here's the explanation.
Let's let 0x8008, be "A" ; and let 0x800D, be "B"
[code]copyvar 0x8008 0x800D[/v]
Variable "B" copies onto variable "A"
I know, it's reversed, and the second variable copies to the first variable, but as long as you can remember it. You'll be fine.

Copyvarifnotzero

Here is what some might say, a little "add-on" to the copyvar command. The name says it all doesn't it. Copy Variables, if not equal to zero.
But we can also use this like setvar.Example 1(Variable Copy)

Since this is a pretty complicated command, and has a lot of uses. I'm just going to give an explanation of the command, but not give examples of the different ways to use it. In the following few sections you'll see some way's of using it. Setvar is pretty simple naming, set to variable. It sets a certain value, ranging from 0x0 to 0xFFFF, to a certain valuable. It's just set out simply like this.
[setvar] [variable] [value]
Here's just a sample view of how the command appears.

Code:

setvar 0x8008 0x1

If it's still hard to think about, try thinking of it as a boxset 5. Depending on whether or not we choose "Yes" or "No" it assigns a certain value to 0x800D. With setvar we can choose the variable and the value that is assigned.
You'll see more of this from this point on.

Randomisation

Another #raw. #raw 0x8F. With this command, the rom will choose a random number depending within the range of 0x0 to the value you set with the arguement, and then assign it to 0x800D (LASTRESULT). So here's a little example.

So again, you may have noticed, the value after #raw 0x8F is reversed!.
By now, I shouldn't need to explain this anymore. That should be about it. I'll show an extra example if you need, but I shouldn't need to explain anymore.

Luckily, we've also got lesson 1 on setvar.
First we assign the value to the variable 0x8004. Using this command, this value is the Pokemon we want to check for. In this case it's Pikachu.
Now we have special2. special2 is set out like this.
[special2] [Variable to store value] [event to call]
The event we use is 0x17C; this checks if the Pokemon that we have set to 0x8004, is in our party. If it is in our party, a 0x1 is assigned to the variable, which in this case is 0x800D(LASTRESULT) ; if it's not in our party 0x0 is assigned to the variable, thich in this case is 0x800D(LASTRESULT).
Now the following compare and if act in the same way as the compare and if used with the checkitem. If you've forgotten, here's a quote of myself.

Quote:

Originally Posted by thethethethe

The compare checks for "Yes, you've got item(0x1)" or "No you don't(0x0)"
And by now you should be able to tell what the if should do by now.

There you go, Lesson 1 on setvar, and special2.

Special PART 2

That's right, we're adding to the [i]special[i/] command. Well, actually, not really, I'm just going to tell you about waitspecial command, which is of course, a #raw.#raw 0x27. Wooohoooo! Another #raw.
Let's just use special 0x9D, which in Fire Red, shows the "Old Man Cathes Weedle" scene. But look at how we are going to use it.

Code:

special 0x9D
#raw 0x27

Simple as that. No arguments, just #raw 0x27

Movesprite

This will obviously move a sprite from one place to another instantaneously.
It's set out like this.
[movesprite] [People Number] [X Co-ordinate] [Y co-ordinate]
So the people number is the same as it ahs been since the beginning of this tutorial.
The X co-ordinate is the X co-ordinate of the tile that we want to move the Overworld to.
Now obviously, The Y co-ordinate is the Y co-ordinate of the tile that we want to move the Overworld to.
Here's just a simple example of the command. We'll use, people number = 4; X co-ordinate = 12; Y co-ordinate = 5

Code:

movesprite 0x4 0x0C 0x5

And if you want another example. People Number = 9; X co-ordinate = 3; Y co-ordinate = 10

Code:

movesprite 0x9 0x3 0xA

That's all there is to it.

Setvar Lesson 2

I'll show an example of this command, that I have used in my hack Legend of Dragons. It's three scripts.Script 1 (Right) tile

So What we're doing here is we are assigning a certain value depending on which tile we stand on, that we will be able to call upon later.
I'll explain the goto a little later. But for now, let's look at what's in Script 1 under $script. We've got the usual, checkflag 0x[flag] to prevent the event from repeating itself.
Now we've got some compare lines.

The pointers give away what they are there for, don't they? They're checking depending on which value was set, we will go to a different set of movements. This is a great way to save space, and instead of us compiling that big ugly script 3 times, with slightly altered movements, we can compile that once, and two neat scripts. Also that value will not change until you set a different value to that variable. The rest of Script 1 is pretty straightforward. Let's get back to that goto.
I haven't actually explained goto yet, have I? We've only seen it with if. Well at this point, if you've followed the rest of this tutorial, it should be obvious what the command does. It will goto a specified point, whether is be a $pointer or a 0x[hex address]. The command is set out like this.
[goto] [pointer]
Now we've covered that, let's get back to what we were looking at. The beginning of scripts 1, 2 and 3.
Look at the similiarities between each one.

Code:

#org $start
setvar 0x4003 0x0
goto 0x8017CC
end

Code:

#org $start
setvar 0x4003 0x1
goto 0x8017CC
end

Code:

#org $start
setvar 0x4003 0x2
goto $script
end

Obviously, 0x8017CC, is $script. But how did I get that pointer.
Let's compile script 1 into the rom. After it's been burnt to the rom, in bufrite, we should see a list of the different names between the pointers.
We should have something like this.

We need to take that pointer that is after $script. That is our pointer that we will use with script 2 and script 3.
So if I were to use these pointers as an example, my Script 2 would be this.

Code:

#org $start
setvar 0x4003 0x2
goto 0x80083C
end

I'd say that's all on setvar.... for now.

Resetvars

Another #raw. This command doesn't reset every variable, just 0x8000, 0x8001 and 0x8002.
It's just a little command #raw 0x2E. It doesn't need any extra arguments. All it needs it this:

Code:

#raw 0x2E

Money Commands

This is a pretty big section, so I'll split it up into 6 sections for each of the money related commands, all #raw's.

givemoney [#raw 0x90]

takemoney [#raw 0x91]

checkmoney [#raw 0x92]

Showmoneybox [#raw 0x93]

Hidemoneybox [#raw 0x94]

updatemoneybox [#raw 0x95]

I'll explain them in the order they were listed order listed.

Givemoney

The "name" gives it away. This command, #raw 0x90, will give the player a designated amount of money. The command is set out like this.
Let XX, be the money value reversed
[#raw 0x90] [XX] [XX] [XX] [XX] [#raw 0x00]
The final [#raw 0x00] actually determines whether it updates your money account. The reason I've left it at [#raw 0x00], and not a simple explanation of what it is, is because if it were changed to #raw 0x01, the money balance does not change and therefore defeats the purpose of the giving the player money. I'll move onto explaining the money now.
I'll give you an example to show what's happening. We'll use the amount 10,000. so let's convert 10000 to Hex, which gives us 0x2710. Since we need four bytes, let's write 2710 as 00 00 27 10, and now reverse it, to get 10 27 00 00.
So here's our command.

Code:

#raw 0x90 0x10 0x27 0x00 0x00 0x00

That's a long line but you should be able to understand what's happening. I'll give another example, just incase you need it.
Money amount = 500 [hex = 0x1F4]

Code:

#raw 0x90 0xF4 0x01 0x00 0x00 0x00

I'd say that's enough information on #raw 0x90.

Takemoney

Like, the givemoney, the name gives the function away. This command takes money from the player.
Takemoney, of course, is a #raw command. It's #raw 0x91. The command is set up in an almost identicle manner to the #raw 0x90. I'll show the setup again, just incase you forgot already.
Let XX, be the money value reversed
[#raw 0x91] [XX] [XX] [XX] [XX] [#raw 0x00]
The final [#raw 0x00] has the same function as what it does with #raw 0x90.
Just incase you wanted it, here's an example.
Money amount = 600 [Hex = 258]

Code:

#raw 0x91 0x58 0x02 0x00 0x00 0x00

Tadah. You've now learnt the give, and takemoney commands.

Checkmoney

This command of course checks if your account for a designated amount of money. Ofcourse Checkmoney isn't a coded command, and is #raw 0x92. It's set up in the same way as the previous two commands, but there is a defference. I'll show how it's set up.
[#raw 0x92] [XX] [XX] [XX] [XX] [#raw 0x00]
Looks the same, doesn't it? That's because it does look exactly the same. The difference is the reason for the [#raw 0x00] at the end is for something different than the other two.
[#raw 0x00] would mean "Check Money account," [#raw 0x01] would mean "Don't check Money account". So if you were to use [#raw 0x01], it just defeats the purpose of the command, and there would be no point to it.
Now, how do we call upon the amount. Remember the countpokemon command? We check in that same way. Using the compare and if lines.
Here's also a little example, just in case that wasn't explained very well.
Conditions:
Money amount = 1000 [Hex = 3E8] ;
Need at least 1000 to continue in script

This breaks away from the style that the other money commands are written in. This command is #raw 0x93. It' set out like this.
[#raw 0x93] [X co ordinate] [Y-co-ordinate] [#raw 0x00]
Okay, of course the first byte is always the command. Then it's followed by the X co-ordinate and the Y-co-ordinate on the screen. Personally, I just the co-ordinates, (0,0). I think by now, you can just trust me and just use [#raw 0x00] for that last byte. There is a reason. But if you remember the reasons for the previous commands, just believe me and use the [#raw 0x00].
Here's a little example of what how it is set out.
X and Y co-ordinates - (0,0)

Code:

#raw 0x93 0x00 0x00 0x00

This box will appear in the top left hand corner of the screen.

HideMoneyBox

This one is also different from the rest of them. This command is #raw 0x94, and it's set out like this.
[#raw 0x94] [X co ordinate] [Y-co-ordinate]
First byte, obviously the command. The second and third arguements, are just the co-ordinates of the shown money box.
If I were to write this to counter-act the effect of my previously shown script, my hidemoneybox line would appear like this.

Code:

#raw 0x94 0x00 0x00

Nice and Simple.

UpdateMoneybox

Last money command. #raw 0x95. It's simply set out like this.
[#raw 0x95] [X-Co-ordinate] [Y-co-ordinate] [#raw 0x00]
Like the #raw 0x94 command, the X & Y co-ordinates need to compliment the co-ordinates of the #raw 0x93. And since, I feel there is now no point in explaining this last command, let's just call it a buffer. Well, I guess, I'll just show an example.

Code:

#raw 0x95 0x00 0x00 0x00

I guess, now I can move onto some differnt commands now.

Addvar

"Add to Variable" yet another #raw. Before I explain what it does, I'll show you how it's set out.
[#raw 0x17] [Variable Reversed] [Variable Reversed] [Value Reversed] [Value Reversed]#raw 0x17 will add the designated value to the value that is already stored within the designated variable. What a mouthful. If that's a little complicated I'll simplify it.
As an example, let's say the varaible 0x4036 already has the value 0x1 stored into it, and we want to add 0x3 to it, to make it 0x4.
So I'll put it into a scripted example.

Code:

setvar 0x4036 0x1
#raw 0x17 0x36 0x40 0x01 0x00

You'll notice all the reversing. Of course, Everything is reversed within a byte value.
That's pretty much all there is to it, it's up to you to find a use for it.

Subvar

Of course, since we can add to a variable, we must be able to subtract from the variable. It's set out in the exact same way as #raw 0x17. The only difference, subvar is #raw 0x18
[#raw 0x18] [Variable Reversed] [Variable Reversed] [Value Reversed] [Value Reversed]
Since, it's just the opposing function to #raw 0x17, I think I can just go straight through to the example.

Code:

setvar 0x4004 0x6
#raw 0x18 0x04 0x40 0x03 0x00

In the example, it takes 0x3 from what is stored in the variable 0x4004.

DontFaceplayer

A relatively useless command. But I thought, it migh be worth knowing.
It's just #raw 0x69. There's no other arguments. As I said, it's an almost useless command. But just something to add to your memory banks.

Pokepic

#raw 0x75. The name may be a little misleading. This command, can bring up an image of a designated Pokemon. The command is set out like this.
[#raw 0x75] [PokemonNo. reversed] [Pokemon No. reversed] [X-coordinate] [Y-co-ordinate]
Okay. We obviously need to begin with the command. It's then followed by the Pokemon number, which needs to be in hex and then converted. This is then followed by the X and Y co-ordinates of where you want the image of the pokemon to appear. So here's a little example to help clarify things.
Conditions:
Pokemon = Dratini
Co-ordinates = (10,3) Center of Screen.

Code:

#raw 0x75 0x93 0x00 0x0A 0x03

I'd say that's about it for now but I'll show a bigger example, in the next section.

ClosePokepic

Without using this, you're Pokepic Box, will remain open until you leave the map, and the map has time to reload.
The command is just #raw 0x76. There's no need for any arguments.
Well, here's an example of the two commands combined in a fragment of a script.

So try it in a rom. Did it work?
It didn't, did it?
Here's the reason why. It need to be followed by this command.

Doorwait

This command needs to follow both #raw 0xAC and #raw 0xAD. Without this command following, they don't work. this command, #raw 0xAE doesn't need any arguments. Here's an example, with the "Door open" command.

Code:

#raw 0xAC 0x10 0x00 0x0D 0x00
#raw 0xAE

Door Close

This is ofcourse, #raw 0xAD. It's set out in the same way as the #raw 0xAC command. I'll show you the set-up again, just in case you've already forgotten.
[#raw 0xAD] [X co-ordinate reversed] [X co-ordinate reversed] [Y co-ordinate reversed] [Y co-ordinate reversed]
I'm going to show an example of using all three commands.

There are 6 coin commands, and they are very closely "related" to the money commands, as they have similiar arguments. Well, I'd better list the different commands.

Check Coins

Give Coins

Take Coins

Show coin counter

Hide Coin Counter

Update Coin counter

I'll work my way from the top down, I guess.

Check Coins

This is a pretty simple command, and isn't as difficult as long as the check money. It checks to see if you have a certain amount of coins. It's set out like this.
[#raw 0xB3] [Amount reversed] [Amount reversed]
Since we can only hold a maximum of 9999 [hex = 0x270F] coins we only need to use the double byte value (word). So here's a short little example.
Check for 3000 coins ; If higher than, continue

Code:

#raw 0xB3 0xB8 0x0B
compare 0x800D 0x1
if 0x4 goto $continue

Give Coins/Take coins

Since they have similiar aguments, I thought I'd just put these two together. The command for givecoins is #raw 0xB4 and the command for Take Coins is #raw 0xB5.
This is how they are set out.
[command] [Amount reversed] [Amount reversed]
I guess, I'll give an example of both and we can move onto the other three commands.Give CoinsGive 1000 coins

Code:

#raw 0xB4 0xE8 0x03

andTake CoinsTake 1000 coins

Code:

#raw 0xB5 0xE8 0x03

Show coin Counter

This command, will display a little box with your coin count. The command for this is #raw 0xC0. It's set out in a similiar way, to the "show money box," except you can drop off the last argument. If you wanted to see it again, this is how the command is set out.
[#raw 0xC0] [X-Co-ordinate] [Y-co-ordinate]
As an example, the co-ordinates (0,0) will appear like this.

Code:

#raw 0xC0 0x00 0x00

Not that hard, is it?

Hide coin Counter

This command obviously hides the coin counter that was brought up with the #raw 0xC0 command. This command is #raw 0xC1. It's set out in the same way as #raw 0xC0. But if you want to see it again, here it is.
[#raw 0xC1] [X-Co-ordinate] [Y-co-ordinate]
Just remember that without this command, the counter will remain, until the map is reset.
I might save the example for the next section.

Update coin Counter

This will of course update the coin counter, and show any changes within your "coin balance." This is done with the #raw 0xC2 command. How's this set out? I bet you would be able to guess correctly. The same way as the #raw 0xC1 and #raw 0xC2, and just for the fun of it, I'll show the example again.
[#raw 0xC2] [X-Co-ordinate] [Y-Co-ordinate]
So here's that I promised. I'll make it a little bigger than what I normally do. I should n't have to explain out this script, you should be able to understand it.

Okay, the title may be a little hard to understand. This section is dedicated to assigning Names of Pokemon, Names of Items and Numbers to \v\h02 and others of the sort.
Okay here's a list of the commands, that we will go over.

Display Pokemon Name [#raw 0x7D]

Display First Pokemon Name [#raw 0x7E]

Display Item Name [#raw 0x80]

Display Attack [#raw 0x82]

Display Value of Variable [#raw 0x83]

Like always, I'll start at the top and work my way down.

Display Pokemon Name

With this, we will assign a certain Pokemon's name to a\v\hXX. To do this, we will need the command setvar. That's right, we are going over another use of the command. As you should ave read in the list this command is #raw 0x7D.
It's set out like this.
[#raw 0x7D] [\v\hXX] [Variable reversed] [Variable Reversed]
So how's setvar involved? We need to assign the Pokemon's Number to the variable, that we plan on using with the command. I'm going to use 0x800D. Just to refresh your memories, what is 0x800D?

Spoiler:

LASTRESULT

So here's the example. We are going to assign Charizard's name to \v\h02.

This command is set out a little differently, to the one above. Since we are just getting the name of you First Pokemon in your party, there is no need for the variable. We can just set it out like this.
[#raw 0x7E] [\v\hXX]
There's just two bytes needed for it to work.
So since it's such a short command. I'll just show an example. In the example, we're going to show how to assign the First Pokemon in party's name to \v\h02.

This command is #raw 0x80. It's set out in the exact same way that #raw 0x7D. But it's still worth showing. In case you've forgotten how #raw 0x7D is set out, here's how #raw 0x80 is set out.
[#raw 0x80] [\v\hXX] [Variable reversed] [Variable Reversed]
Since, there really sn't too much need for a second explanation, I'll move straight into the example.

Notice how I've added "s" straight after \v\h02. If you don't know why, it's so that the message will appear like this.

Quote:

Do you have any Pokeballs?

Display Attack

I bet you could probably guess how this command is set out. It's done the same way as #raw 0x80 and #raw 0x7D. It's set out like this.
[#raw 0x82] [\v\hXX] [variable reversed] [Variable Reversed]
I think the only things is, I haven't given you a list of the attacks yet, have I?
Anyway, here's the list. This will come in more handy a little later.HEX Values

I just thought, I'd make it a little more confusing.
The message actually says:

Quote:

Can Charizard use Overheat?

Display Value in Variable

This is just used to display a number. Its set out the same way as three, of the previous four commands.
So it's set out like this.
[#raw 0x83] [\v\hXX] [Variable reversed] [Variable Reversed]
But the downside of this command is that it can only display a numbers from 0-65535 [Hex = 0x0 - 0xFFFF]. There is a limit.
So let's show an example. We're going to show, the number 50000 in \v\h02.

Try this in a rom.
The first message should appear as a normal boxset 6. But then we use #raw 0xCA. This makes our second boxset 6 become a signpost box. But what's this #raw 0xCB doing here? #raw 0xCB converts the box back into a normal boxset 6. This is just a little playful command, that gave us a break from the commands that are having four and five arguments.

Callasm

This command, is used to call an ASM function that you have added to the rom. I'm not going to write an example, I'm going to use the example of the command used with Mastermind X's "Shiny Hack".
This is his hex script:

with a bit more of an explanation.
He has called the ASM function twice. Once, to turn it on, and once to turn it off.
To turn it on, it needs that buffer following the command, and to turn it off, it isn't needed. I think he's explained everything else.

Okay, it's been a while, but here's some more that I've decided to add.

Get Player Position

#raw 0x42, can be used to get the player's X and Y poitions on the map stored into designated variables.
The command is set out like this:

Quote:

[42] [xxyy] [aabb]
xxyy: Variable for x position
aabb: Variable for y position

So here's an example. With this we'll store the Player's X Position to 0x4000, and the Player's Y position into 0x4001.

Code:

....
#raw 0x42 0x00 0x40 0x01 0x40
....

Repeat Trainer Battle

This is a simple command that will begin the Last Trainer battle commenced. It's done simply with command #raw 0x5D.
So we can easily use this in a script by simply doing:

Code:

#raw 0x5D

Lock All

Okay, here's a little fix to an error I've made earlier in this tutorial. This command was described as 'Don't Face Player', which is incorrect. This command is similar to lock, only it locks down everyperson on the map.
We use this command with:

Code:

#raw 0x69

Release All

This command is used as the opposite to 'Lock All'. It's simply used only with #raw 0x6B. This command will release all sprites on the current map.
Here's how it can be used:

Code:

#raw 0x6B

Wait Until Key Pressed

This command can be used as a pause. The command #raw 0x6D is used as a wait until a key is pressed before it continues.
It's used like this:

Code:

#raw 0x6D

Display Yes/No Box

This command, #raw 0x6E is somewhat pointless when there is boxset 0x5. It acts in the same way as boxset 0x5 where with a compare, yes = 1 and no = 0. It's only reason for use might be to have some flexibility as to where you want the box to be placed.
The command is set out like this.

Quote:

[6E] [xx] [yy]
xx: X co-ordinate
yy: Y co-ordinate
So in our script, we might use it like this.

Yes, it's something people want to use. So here's a brief guide on the multi, and two other commands that normally accompany it.
I'll show an example first, which will make it easier for me to explain how it's used.

Okay, so #raw 0x67 is usually referred to as msgbox2. The following four bytes refer to the pointer to text. You'll have to look at a later section to know how you can add extra commadn to a default Pokescript.#raw 0x66 is similiar to command #raw 0x68. This command is special and is used with #raw 0x67 to close it.
Now onto the multi command. YAY! Well, it's set out like this:

So the first two parameters are easy to use. Simply like other commands, they are just the X and Y co-ordinates on the screen.
The third parameter is the options that appear on the multi list. Sorry, it's for Fire Red...

Now from the example script, you should be able to tell that the selected result from the multi is stored into the variable 0x800D.
Which you should be able to see I copied to variable 0x8000, to see if it would confuse anyone. I hope it didn't. Note that the copyvar was not needed and you can just compare with 0x800D. But you should already know that.
The following compares should be fairly obvious as to what they do. They compare what option has been selected. 0x0 = is the highest option, 0x1 the second highest, and so on until the final option.

How about a string now.

Name Pokemon

Okay, here's a working name Pokemon sequence. Although this one will only work if the Pokemon is given into the party. Okay so here's a script where it can be used. I'll explain it in the code.
But before I do that, Pokemon's party position is [Position] - 1. Okay. So first in line is 0x0. And Sixth would be 0x5. Okay now the script...

Okay, so here's another string like the Name Pokemon above. It simply adds a Pokemon to the 'Seen' section of your Pokedex.
This one is fairly easy to do. Here's the script, it'll make it easier for me to explain.

Code:

setvar 0x8004 0x5
special 0x163

See nice and short.
Pretty basic too. We prepare the Pokemon we want to set to 'Seen' to 0x8004. So in this case, I'm preparing Charmeleon to appear as Seen.
Special 0x163 only finishes the job and actually sets it as Seen in your Pokedex.

Okay, only a little Command update, but the main reason for the update was to give some information on editing the Pokescript commands Database.

Editing the Database

Ever wondered whats included in the folder where Pokescript is installed, or more importantly, whats in the PkmAdv Folder.
We should have 6 files... includes.psh; install.psc; items.psh; stdpoke.psh; texttable.psh and Commands.psh.
Okay, of these files, I only wouldn't touch Install.psc. Don't touch it.
See those .psh files, we can open those in Notepad. So let's open stdpoke.psh. We have a file 'defining' a lot of Pokemon. Well these actually mean that we can use some commands like this.

Code:

givepokemon pkmn_Raichu 0x5 0x0

And if we wanted to look at items.psh, and now we know we can write that previous line as this.

Code:

givepokemon pkmn_Raichu 0x5 item_netball

You can edit these files to allow these items to be controlled as whatever you want them to be. You could just rename item_pokeball to simply pball.

Okay, well that's all a bit of fun, but let's now open up commands.psh in notepad.
As soon as it's opened you'll have some information on how commands have been written by Pokescript.
Well here's my basic rundown on the different possibilities.

If you can understand any of that, you can edit the database.
If not, here's mine, with lots of changes. You'll have to look at all the files to see exactly what I've done, as I've changed and added quite a bit.

I see why this took you so long, it's a very handy tutorial, and explains alot of things.
I got a few pm's about adding this to the tutorials list, which i'm going to, plus add a bold and underline . It's very helpful.

Thank you!Thank you!Thank you!Thank you!Thank you!Thank you!Thank you!This makes ALOT more sense now. Scripting is my one hacking nightmare, but I feel a lot more familiar with it now. I can actually get work done now... >_>

Sorry if my statement in my signature had room for misinterpretation. I merely meant that the flood of new tutorials had nothing new to offer. They only covered the general commands like messages/movements/giving pokemon/giving items. They didn't offer any new ideas, or in this case, "new" commands. I admit, I've added to the 'pile' of scripting tutorials here at PC, but I've offered up lots more here than what any of the others did. Hopefully you see where I'm coming from now.

Always a perfectionist...
Pokemart's there. I think you showed me that, didn't you?
I was going to include Multi with what I've posted, but then I thought I'd cover a few more things before I got to it. Actually, I might write that part up now. I've yet to play around with some of the commands, like all the warps which I'm testing out, get player position, the casino, create sprite,etc. I've still got to test a few of these out. But don't worry, I will get to them.

Quote:

Originally Posted by derv1205

Hi bud, hey, when i put setflag 0x829 for the PokeDex Menu, all the script works perfectly, but
when i put start, and try to enter the PokeDex it doens open :S

Ummm. I'm not too sure why that would happen. Maybe if you don't have a pokemon it won't work. I'm not too sure, I'd need to know a little more...

How come when ever I use the Shop or save in an area around Event placed people, My character turns into that person and I can only control it? My Regular character becomes immobile and I'm controlling the shop keeper o_o;

Hi, you where right bud xD lol, I have to have a pokemon for the Dex to open
...
hey, i insert this in PokeScript and put it in a minisprite, but when i talk him the game restarts
I tried it in Ruby and FireRed

Hey the4 , I was reading through this tut on the special2 section, but there was one question I had to post. Is there a way to remove a pokemon from your party? Not just relocating them to your PC , but basically removing them from the game. There was something going on in my hack where I wanted to imput the option to choose between keeping or releasing a pokemon that you've already purchased, but I now realize removing a pokemon isn't the same as releasing an item.

__________________

Hey guys, I'm still alive. Not really sure if I want to continue Twisted Path though.

I don't actually think you can remove a Pokemon, I remember in shinygold you cant access your pokemon anymore, but that was just a simple command. If this was possible I would be interested in it aswell. But since there is nothing identical to that feature in an actual game, it would be extremely hard to decipher.

It would be a shame if that wasn't possible. If not, then is there a way to simulate trading with NPC's in the games? I'm not sure if it was in R/S, but I remember being able to do that in the Color/Metal Generations (I've never played FR or LG, so I dunno if it was there).

__________________

Hey guys, I'm still alive. Not really sure if I want to continue Twisted Path though.

Help

The PokéCommunity

Meta

Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, or The Pokémon Company International. We just love Pokémon.