The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.
New threads in this forum are to be approved by a moderator before they are displayed.


Closed Thread
 
Thread Tools
  #1    
Old February 29th, 2008, 12:07 AM
Leon Blade's Avatar
Leon Blade
Beginning Trainer
 
Join Date: Apr 2007
Gender:
Nature: Adamant
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.

Overview:
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:
Code:
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:
Code:
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.
Spoiler:
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.
Spoiler:
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:
Code:
#ORG
This is a keyword I guess you could call it. It's the standard way of starting all Scripts. Think of it like this:
Code:
begin
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:
Code:
$StartScript
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.

Spoiler:
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:
Code:
$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.
Spoiler:
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:
Code:
#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?
Spoiler:
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:
Code:
Lock
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:
Code:
Faceplayer
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:
Code:
#ORG $StartScript
Lock
Faceplayer
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:
Code:
message
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:
Code:
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:
Code:
$Talk
This means we are referring to our $Talk variable. Now add this:
Code:
$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:
Code:
$Talk 1 =
Now were setting our $Talk variable equal to something. Lets now write in a message we want to show:
Code:
$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:
Code:
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.

Spoiler:
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:
Code:
$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:
Code:
Hello,^
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:
Code:
boxset
This command tells us what message box to use. The different types are in the spoiler.

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:
Code:
boxset 6
Alright so lets see what we have so far:
Code:
#ORG $StartScript
Lock
Faceplayer
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?
Spoiler:
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:
Code:
release
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
Code:
#ORG
So now we will end it with
Code:
end
Coincidently enough, yes its end.

So lets see what we have and go over it just one last time:
Code:
#ORG $StartScript
Lock
Faceplayer
message $Talk
$Talk 1 = Hello,\lthis is my first script in PokeScript!\pIt's fun to script!
boxset 6
release
end
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
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:
Code:
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
Code:
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.
Spoiler:
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:
Code:
 - 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:
Code:
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
Code:
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!
Spoiler:
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
__________________
I wish Jack Skellington was a Pokemon. Then I would play the game. I just like hacking.

IF YOU NEED SCRIPTS JUST ASK ME.

Either PM me or email at [email protected]

Now This is A Pokemon!
Now That is a pokemon!
  #2    
Old February 29th, 2008, 01:45 PM
cooley's Avatar
cooley
///Keepin' it simple
 
Join Date: Feb 2007
Location: United States
Age: 19
Gender: Male
Nature: Impish
Send a message via Windows Live Messenger to cooley Send a message via Skype™ to cooley
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!
__________________

  #3    
Old February 29th, 2008, 03:27 PM
thethethethe
Gym Leader
 
Join Date: Jun 2007
Location: Melbourne, Australia
Gender: Male
Quote:
Originally Posted by cooley View Post
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. 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.
__________________
Gone.

Last edited by thethethethe; February 29th, 2008 at 03:49 PM.
  #4    
Old June 4th, 2008, 12:06 AM
andrejoshua
Beginning Trainer
 
Join Date: May 2008
Gender:
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?
  #5    
Old June 4th, 2008, 01:10 PM
cooley's Avatar
cooley
///Keepin' it simple
 
Join Date: Feb 2007
Location: United States
Age: 19
Gender: Male
Nature: Impish
Send a message via Windows Live Messenger to cooley Send a message via Skype™ to cooley
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.
__________________


Last edited by cooley; June 4th, 2008 at 01:21 PM.
  #6    
Old June 4th, 2008, 10:27 PM
Christos's Avatar
Christos
Project Shinx
 
Join Date: Feb 2006
Location: Spain, Went's room
Nature: Serious
Send a message via Skype™ to Christos
andrejoshua, please don't post in threads that are over a month old.
__________________
I DON'T HAVE THE POKECOMMUNITY VIRUS(ALSO KNOW AS PC VIRUSE)
What I mean by this is, I'm not strict like MOST people *cough* Admins/Mods *cough* on this site. And no not all Admins/Mods are like that, but MOST are,
Post this in your sign. if you are PC Viruse free!
Closed Thread
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 04:15 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
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, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.