View Full Version : [Tutorial] Leon Blade's Pokescript Tutorials

Leon Blade
February 29th, 2008, 12:07 AM
Leon Blade's Pokescript Tutorials

Hello and welcome to my tutorials!
I've seen lots of people post their tutorials on Pokescript and I notice that they really don't go into what there doing they'll just say, type all this stuff in and you get a message. But they really don't go into explaining what there showing you how to do.

In this tutorial I'll try to explain that to you, in the best way that I can. Somethings I'm not sure about, so don't blame me on that. But I'll try to give my best guess if needed. Please correct me if you see something wrong.

Alright lets begin the tutorial!

Part 1: Your First Script
So you want to learn Pokescript to enhance your hack to the game.
Scripting is key to making a good hack, map hacks aren't enough alone. You need to give the game new features, not just change some maps around.

So lets start out with the basics. In this first section you will learn how to display a message on the screen. Simple right? Heres some of the commands you will be learning:
lock: Locks the NPC, or the person, you talk to so they can't move
faceplayer: Sets the NPC to face the Player
message: Displays a message box on the screen with the message you choose
boxset: Specifies what type of message your showing(We'll get to that later)
release: Gives the NPC back control so they can move again or what have you

And some keywords and such you'll learn about:

Using the $ symbol
Using #ORG and end

Alrighty then, so lets start!

Section 1: Setting up the Script
Your going to want to open up Notepad or your favorite Script Editor such as Notepad++, SciTE, etc.
For you Notepad++ Users check out my post in the Tools section for the PokeScript Addon

Lets create a new file called FirstScript.RBC
Now you'll notice the file extension at the end RBC which stands for Rubicon (I believe). Essentially its just a file that PokeScript is familiar with and you have to have it in this format to Compile the script once your done with it.
Compiling is when PokeScript takes what you wrote and injects, or adds it to the ROM file so that you can use it in your ROM

Alright now that we got this setup were going to type in this:
This is a keyword I guess you could call it. It's the standard way of starting all Scripts. Think of it like this:
It's the beginning of our code and it's necessary to have it there.

On the same line put in a space and type:
Now, what does this mean?
Well basically, if you are familiar with PHP you might already know what this is.
The $ symbol is telling PokeScript that this is a Variable. It's an easy way for the user writing the script to refrence parts of there code without having to remember offsets. You can call this variable anything you want. It's just a temporary way of storing something for later. Instead of $StartScript you could put $ImCool or whatever you want to call it.

An offset is a 6-digit number that contains letters and numbers from 0-9 and A-F. This 6-digit number is an Address in the ROM which is coded in Hexadecimal, which is just another type of programming you could call it. It's a way of storing data in a way that the computer can recognize. Sort of like how you recognize English, the computer can recognize Hexadecimal.

You can think of an address like your mailbox. Your mailbox has your Mailbox number on it. And inside the mailbox is where all your mail goes. In Hexadecimal. Theres the 6-digit address, and inside the address you store data.

Once PokeScript compiles your code, it takes those variables and replaces them with offsets. Here is an example:
$StartScript > 800156
$NoRoom > 800308
$Noobs > 812009

It takes what you wrote as a variable, finds an offset that isn't being used, and replaces your variable with that offset.
You can think of it like this if your confused at all:
The offset is the address like I said in the previous Spoiler.
Which is like your mailbox address.
Inside your mailbox is all your mail.
Inside the Address or the offset is all your data.
In order for the Mailman to find your house, he can't just read your name on the mailbox, he has to know your address.
So with your ROM, it needs to know your offset, not the variable name you give it.
So in real life when you get a mailbox, they give you an address for where people can send your mail. So in PokeScript, they give the name an offset so that the game can read your data.
I hope this makes sense to you

Alright, so far we have this:
#ORG $StartScript

Section 2: Controlling the NPC
Now in a real life situation when you goto talk to someone what normally happens. Lets say they were walking somewhere. You go up to talk to them, chances are they stop walking to talk to you right?
Yeah I know or you could just walk with them but lets just keep it simple ok lol

So where going to go down to the next line in our code and type this command:
This lock command is telling the game to stop the NPC your talking to so it can't move around while your trying to talk to it.

Now were going to go down to the next line and type this:
Now when you see your friend and you go up to talk to them they stop, and they look at you right? So what this command does is, it has the NPC face the player so there face to face and it looks like they can have a conversation. If you left this out the player would be facing up at the NPC while the NPC could not be even looking at the player, which wouldn't be very realistic. So when working with NPCs and talking to people, you should use the Faceplayer command.

So now we have this in our code:
#ORG $StartScript

Now, so far if we were to talk to someone using this code as we have it. The NPC would stop moving if they were, and look at the player.
So were moving along now! Just a few more things left!

Section 3: Displaying a Message
Alright now you stop to talk to your friend, what are you going to do? Well your going to talk to them so lets type this in now:
This message command is telling the game your going to bring up a message for the Player to read. But your going to have to tell the game what you want to say. So were going to link the message to a NEW variable. So you would type this:
message $Talk
So you just add a space after message and type in $ and the variable name you want to use. I'm calling my variable talk.

So now we want to set this variable equal to some text that will show in the message right? Alright so lets go to the next line in our code and type this:
This means we are referring to our $Talk variable. Now add this:
$Talk 1
To be honest, I'm not sure what the 1 stands for. But I think it means to display the message right then. Don't quote me on this. Just know that you have to type the 1 after the variable name like that. OK, now we want to set the $Talk variable equal to a message right? So lets do this:
$Talk 1 =
Now were setting our $Talk variable equal to something. Lets now write in a message we want to show:
$Talk 1 = Hello, this is my first script in PokeScript! It's fun to script!
Great! Now if we were to test the message like this, we would have a problem. The message would look like this on the screen:
Hello, this is my first script in PokeSc
Or something close to that. The message will cut off. Why is this?
Well it's because the message box can only hold so many characters (letters, numbers, symbols, etc) in one line. Your going to have to guess or ask someone. But about as much as I have written up there will show.
So how do we advance on to the next line?
Well we need to type a \ and then a letter either P, L, or N which will continue the message on the next line. Messages can only hold 2 lines at once.
Read the spoiler below to figure out what letter does what specifically.

P: The P will display your line, and ask you to hit the A button to continue with the message. This will also create a brand new message box.

L: The L will will display your line, and ask you to hit the A button to continue with the message. However, the difference between P and L is that, P makes a whole new message box, not showing any text from before. And L will just skip down to the next line.

N: The N will display the line and imediently continue typing out the text onto the next line. You do not have to hit the A button to continue reading the message.

So lets make sure our message fits now. Heres that line from the code again:
$Talk 1 = Hello,\lthis is my first script in PokeScript!\pIt's fun to script!
Notice I didn't put any spaces after the \p or \l
I'll show you what it would look like. If you add the space instead of the message looking like this "This is a message"
It would look like this " This is a message" Note the space before the T. Thats why you shouldn't put a space afterwords. However, adding a space before the \ won't matter.

So heres what our message will look like. NOTE: the ^ symbol will stand for when you press the A button, and if I skip a line that means its a whole new message box:
this is my first script in PokeScript!^

It's fun to script!

Thats what it would be like when you tested it.
Ok so now we have to choose what type of message were displaying so we type:
This command tells us what message box to use. The different types are in the spoiler.

The boxset command has 3 different types, that I know of.
boxset 6: This will show you a regular message
boxset 5: This is a YES or NO message box
boxset 4: This will automatically close the message box once all of the message is shown

So we just want a regular message so we'll type this:
boxset 6

Alright so lets see what we have so far:
#ORG $StartScript
message $Talk
$Talk 1 = Hello,\lthis is my first script in PokeScript!\pIt's fun to script!
boxset 6

Section 4: Releasing the NPC
So when we talk to the NPC he will stop moving, look at you, and say that message.
Once your done talking to your friend in real life, they normally walk away or continue what there doing right?
Just say yes lol
So same with this, once were done talking to the NPC, we want to let him walk around again. So we will use this command:
This works with the lock command.
Lock stops the player from moving, and release lets the character move around again.

Section 5: Ending the Script
Alright then! This is the last line right here. In the beginning we started the script with
So now we will end it with
Coincidently enough, yes its end.

So lets see what we have and go over it just one last time:
#ORG $StartScript
message $Talk
$Talk 1 = Hello,\lthis is my first script in PokeScript!\pIt's fun to script!
boxset 6

So we walk up to the NPC, he stops moving, he faces us, says a little message to us, and then goes back on walking around.

Phew! Glad thats over huh? Yeah, that was a lot of typing for me to do lol.
So now lets go over on how to use it in your Game!
Yeah, were not quite done yet. Just hang in there, this is the easy part!

Section 6: Compiling your Code
Your going to want to use PokeScript to compile your code and use it in your ROM. To do this make sure any current work your doing on your ROM from Advance Map or whatever is saved. And just to be sure close out the program if you want.

Now your going to want to navigate to the directory you saved your FirstScript.RBC file in. And you want to Right-Click it. A menu should appear, and if you installed PokeScript correctly you should see the option called Compile Script. Your going to want to click that

If you don't see compile there read this spoiler
Here are some steps to take if you don't see Compile show up in the menu:
1: You haven't installed PokeScript at all. Make sure you have it installed on your computer
2: If you have PokeScript, make sure that PkmAdv is also installed correctly in the same directory as PokeScript. The default folder is C:\Pokewitch or something like that. There will be a folder called Pokewitch. Inside there should be BufRite and PokeScript, along with all those other files and folders. The other Key folder to have is called PkmAdv. If you don't have that in there, please download PkmAdv and install it in this same Pokewitch folder
3: If you are still experiencing errors, search the forum for more detail on how to get it working.

So once you click compile, PokeScript should come up with the title (LOG) Instant
And it should start showing you all this stuff as it compiles, you don't need to worry about that. It's just the compilers feedback. You may learn how to read this later on, but right now it's unnecessary.

Section 7: Burning your Script
When I say "burn" I mean writing it to the ROM. Once compiling is done a Buf Rite should come up and in the middle it should say something like this:
firstscript: $startscript
firstscript: $talk

Thats a list of all your variables that you made in your code. Buf Rite is going to convert those variables to free offsets in your ROM.
Now there are some better tutorials on this but I'll try to explain it the best I can.

Your going to want to click on the $startscript variable and click the little Book Icon(Assign).
The reason you want the $startscript is because its the main variable in the script. And you want to use that. Again I don't really know how to explain it, so look somewhere else on why exactly you pick it.

But you click that Assign button and a new window pops up asking you to "Open file ...." this is where you choose your ROM you want to burn this to.

Now a Search Dialog box comes up. This will find Free Space in your ROM to choose an offset from. Click on the Flashlight, that will preform the search. If your starting brand new with a fresh ROM file then the first result will most likely be the offset of 800000
Just select that offset and click Reserve at the bottom. You'll notice that the middle changed and it now looks something like this
firstscript: $startscript (800000)
firstscript: $talk
Because you Reserved that offset for the $startscript variable. Again this might not make much sense to you, so try to find a good tutorial on this.

Now to actually burn this. Click File at the top, and choose Burn. This will "push" all the variables into offsets and write the data to the offset.
In real life terms, this will give you your mailing address for your mailbox and put mail in the mailbox
Now there will be a whole list of things that comes up, this is all the output. Again you don't need to worry about this, but pay close attension to this:
- Pushed firstscript.$startscript to 800000
#PROCESS: C:\Documents and Settings\Jimmy\My Documents\Fire Red Scripts\1635 - Pokemon Fire Red (U)(Squirrels).gba F:4 for read
Your going to want to copy that offset you see. In this case 800000 because your going to use it in your ROM on an event.

Section 8: Making the Event
This is going to be a basic quick and simple tutorial on how to make the event for Advance Map
Your going to want to create a new event, if you don't know please read the tutorials on how. Select the event with your mouse, and over on the right you should see something like this:
Offset: $000000
This is were your going to want to place your offset. So leave in the $ and paste in your offset you coppied so it would be
Offset: $800000

Great! So now you can save and test your game!

Thats it for todays tutorial, I'm going to goto bed now... its 2:50 AM right now and once I'm done doing some quick editing it will be around 3:00 AM

I hope you enjoyed the tutorial as much as I had making it!
For the record, I enjoyed making this tutorial lol
Next time I'll work on boxset 5 and using the YES and NO.

If you have any questions or comments, please post them here. I'll be more than happy to hear what you have to say about this, and if theres anything I should improve on for Part 2.

Happy Scripting!
--Leon Blade

February 29th, 2008, 1:45 PM
Dude, This is like the 50th Pokescript tutorial!
Its a little bit more detailed though, and It makes sure you get it.

Hopefully everyone won't be using pokescript anymore, We'll all be using - Hackmew -'s XSE!

What we really need is all of the commands into one tutorial, then examples for each command, I'll even help!

February 29th, 2008, 3:27 PM
Dude, This is like the 50th Pokescript tutorial!
What we really need is all of the commands into one tutorial, then examples for each command, I'll even help!

There's going to be 51 soon. :laugh: All the commands, is what I'm doing. So far, I've written on about 80 of them. And if you've seen Mastermind X's list, there's 194, but some of those are useless, so I guess I'm only half way through. But enough on me.

Well, onto your tutorial. It's pretty good. You haven't covered much, but you have, it's in a lot of detail.But I found one error, you've got the boxset 4 description wrong. It's just a box that doesn't close, and remains on the screen, until you use a specific command that will allow it to close.
Other than that, pretty good.

June 4th, 2008, 12:06 AM
I can't burn the script because when i try to click burn, something pops-up like a box then it says floating pointer must be pushed like this:

Floating pointer must be pushed
enter offset of giveblast.$person:

Did I do something wrong?

June 4th, 2008, 1:10 PM
Yes, you did do something wrong.
What you did wrong was not getting XSE. This tutorial is useless now, until - HackMew - 's comprehensive scripting guide comes out.

June 4th, 2008, 10:27 PM
andrejoshua, please don't post in threads that are over a month old.