PDA

View Full Version : [Tutorial] Pokescript Tutorials


Irish Witch
March 29th, 2007, 08:45 AM
I have noticed a lot of poeple asking here and there for a 'Dumbed Down' or simple scripting tutorial. I am now going to attempt to make such a tutorial however (ever the spam bot) I will be writing this for MY script editor - PokeScript, which is available in the toolbox.

First - Go to my thread in the toolbox (http://pkmncommunity.com/showthread.php?p=2426342#post2426342) and download the latest release of PokeScript and the PkmAdv database.
The database needs to be installed to the same folder as PokeScript (usually c:/pokewitch)

Note: You must have Release 11 May or Later due to Bug in Defines handler
Update: Corrected misuse of Fanfare command in Sections 3 and 4. Use Jingle command instead.
Update: 14/6/07 - Corrected typos in 'sample codes' that should have been picked up on by anybody actually reading the tutorial instead of copy-pasting.

This first post will contain a list of Terms, some resource files and and full index of the threads...

PLEASE DONT ASK QUESTIONS IN THIS THREAD
There is now a thread titled "Pokescript Tutorials: Discussion" for questions about the tutorials or help editing them.

This thread is divided into the Following sections:

FORWARD
A. Keywords
- Hex Number
- Offsets[/index]
B. Resources

( The above will change as more tutorials are added here )

1. My Name Is (http://pkmncommunity.com/showpost.php?p=2426342&postcount=2)
1.1 Getting Started
1.2 Displaying a Message
1.3 Writing to the rom
1.4 Plugging it into the map

2. I'll give you this for this! (http://pkmncommunity.com/showthread.php?p=2426404&postcount=3)
2.1 One time only. (Using Flags)
2.2 Yes Or No
2.3 Recieving Items
2.4 Checking for Items
2.5 Removing Items

3. Would you like this Pokemon?! (http://pkmncommunity.com/showthread.php?p=2426404&postcount=4)
3.1 Vanishing Sprites
3.2 GivePokemon
3.3 NamePokemon
3.4 Enable Pokedex
3.5 CountPokemon (Proffesional Give Pokemon Script)
3.6 SelectPokemon (Name Rater Script)

4. In Motion! (http://pkmncommunity.com/showthread.php?p=2426404&postcount=5)
4.1 Preparing to Move
4.2 Subroutines
4.3 Applymovement
4.4 SetVar
4.5 Follow Me!

5. In The Gym! (http://pkmncommunity.com/showthread.php?p=2426404&postcount=6)
5.1 Overworld Sprites
5.2 Wildbattle
5.3 Find Your Trainer
5.4 Basic Trainer Battle
5.5 Dual Battles
5.6 Gym Leaders
5.7 Rebattling
5.8 Battle on Sight

Coming Soon:
6. Pokemarts
- This may even apear before the motion scripts thanks to discussions help in the Script Debugging/Discussion Thread.!
Forward

Keywords
Here are a list of keywords you might encounter while using the script and what they mean. Hopefully it will same some explaining later on.

Hex Numbers
A hexadecimal number (or hex number) is a number where each digit goes not from 0-9 but 0-f and is a key part of handling numbers inside of a computer environment. Hex numbers are usually identified by having the characters "&H" or "0x" written in front of them

YOU DONT NEED TO USE HEX
Throughout our scripts we will be alternating between hex and decimal.. if you are writing a decimal number leave the 0x off. Most of the numbers listed in the resource files are in decimal.

Offsets
There are three kind of offsets used in this tutorial. They look like this:
In all of the following the number represents one of 15 buffers (or banks) inside which scripts, text and movement data can be placed. Changing this number allows you to isolate sections of script (such as text) from other sections (such as code)

#ORG $Offset 0
A Relative Offset This is any combination of letters and number starting with a $ symbol.. Emphasis on there being no puntuation in this kind of offset. In the case above this indicates the start of a script. The buffer if ommitted will be whatever the buffer was in the last #org statement and is usually 0.

#inline $Variable 1 = Hi I'm John!
$Variable 1 = Hi I'm John!
This is a Variable (or inline) offset. In this case the buffer must be written as Only information placed on the same line as an inline offset gets placed in the buffer. Normally this is 1.

#org 0x800100
This is an absolute offset. Prior scripting tools only allowed these types of offsets and they refer to a fixed location in the rom itself. Needless to say this meant guessing at the offset when using older scripting tools.

Resources
Attached below are files you can refer to when following these tutorials or links to programs we will use.
[indent]The Official Advanced Map Website (http:/lu-ho.s229.deinprovider.de/am/index.php?seite=home&PHPSESSID=f3c08f92c70f893b1402f204b3459481)
Advanced Battle (http:/fs06n4.sendspace.com/dl/3cf7dd06067dc6dc31cdb7c7a8fd281f/45e0ad5a/5rsbqc/A-Battle.rar)
Items.txt (http://members.westnet.com.au/comhloiche/downloads/items.txt) - List of inventory items (Ruby)
Poke.txt (http://members.westnet.com.au/comhloiche/downloads/poke.txt) - Pokemon (R/S/E/FR/LG)
FR-MOVE.txt (http://members.westnet.com.au/comhloiche/downloads/FR-Move.txt) - Movements Table(FR/LF)
ruby-move.txt (http://members.westnet.com.au/comhloiche/downloads/ruby-move.txt) - Movements Table(R/S)
trainers.txt (http://members.westnet.com.au/comhloiche/downloads/trainers.txt) - List of Trainers (r/s)

Irish Witch
March 29th, 2007, 09:20 AM
My Name Is....
The first in my re-vamped series of tutorials. Here we go into the process of thinking up your script, displaying message boxes and giving items.
So lets get this ball rolling.

1.1 Getting Started
Normally the first thing you do before creating any script is to create a set of guidelines. This is essential because more often than not the order that you perform the functions in your script have to be the opposite of those listed in your guideline.

In this case we're going to build up a give item script in a series of stages and our guideline should be something like this:

1. You activate a character on the map.
2. The character asks you a question
3. If you answer yes to the question then you recieve a LavaCookie
4. If you have already recieved then a message is displayed.

This is the basic list of what need to happen, but we're not going to tackle that straight away. We're going to start with just displaying a message and the basic layout of a script, followed with inserting that into your rom.

To create the script itself you have to open notepad from the startmenu.
The we begin almost every script the same way:
#ORG $ShowText
Lock
Faceplayer

The first command is our offset marking the beginning of a script segment. It's the equivelent of a sub or function command in other languages and is also used when performing goto and gusub commands.
The next two commands 'lock down' the character you activate in the game so that they won't move around while the script is running and makes them turn to face the player. Virtually every script will have these two commands in the beginning of them.

The next step is
1.2 Displaying a message
These commands will always be placed together. Anytime you want to display text on the screen you will come back to these commands:
message $NoCookie
$NoCookie 1 = I'm not made of cookies!\lYou only get one.
boxset 6

$NoCookie is a Variable name. You can use any word you want for a veriable name but there can't be any puntuation in it. The text itself is ordinary text. The only characters you cant write in it are [ ] ;

To write next line chacters, end of line characters and next page characters use the symbols \l \n and \p respectively.

And since that's all we're doing right now we'll finish this script of with
release
end

Simple enough. Release is the opposite of the lock command, and end finishes the script.
So here's a basic messagebox script:
#ORG $ShowText
Lock
Faceplayer
message $NoCookie
$NoCookie 1 = I'm not made of cookies!\lYou only get one.
boxset 6
release
end


In Notepad's File menu clisk "Save As" and select "All Files" from the Save As Types pull down list. Once you've done that save your file somewhere you can find it. Usually the same place as the rom your editing.

Now to put it into our rom.

1.3 Writing it into the Rom

Alright. Open Explorer (My computer or My Documents) and go to the location where you saved you're .RBC file from the last section.
click on the .rbc file with the right mouse button and click 'Compile'. A program will open up displaying a log of the compile. Some time I'll make a post explaining how to understand that but for now just close the window.
In the folder where the .rbc file was there will now be a file with a .buf extention. Open it with a double click.
The file will open in a program called bufrite. From here there are two ways to do this.
The direct way, and the Fun way. Please read the direct way first to save me having to explain stuff twice..

The Direct Way
The direct way is, well... Direct.
Without clicking anywhere olse Click on the book icon and you will be asked to open the rom (GBA FILE) that you want to put the script in. If you clicked on the one of the items in the listbox then hold down the shift key on your keyboard and slect the rest of the.
After selecting your rom A little window will open up telling you how many bytes it's about to write and where to start looking. This is the free space finder. By default it will start at hex 800000.
Click the torch button (The searchlight, get it) then select the first item in the list and click the button marked assign.

Finally click 'Burn' in the file menu, but before you close the program write down the number that apears next to the first offset in the list ($StartScript). You'll need it later!

The Fun Way
Alright. Going back to just after you select the destination there is different way to do this. If you look at the names in the list then you'll notice the variable names for the text are all listed at the bottom.
Select the items at the top that contain the scripts (not the text) and press the assign button.
Now you are only looking for space to put the first few items - (The scripts)
Do everything as you did with the direct way but now you'll notice the 'assign' button will read 'Reserve' and the checkbox inside the button will be checked. This safety will prevent you from overwriting anything during step two..

Having clicked reserve, now select the items on the bottom of the list that don't have offsets written next to them. This time either change the start offset to start at &h810000 or some other number, or if you're not going to write a lot of scripts then simply select the second item that apears in the list after clicking the torch. That way you can keep you'r scripts seperate from you're text!

Note: If you know where you wat to place your script (Like when your collowing this tutorial) then you can write it into the field next to the assign button.

1.4 Plugging it into the map

Last step.. I know this has been a long post but here goes.
Open Advanced Map (Or you can use Elite map, but I'll only speek for Advanced Map)
Open you're rom using the first button on the toolbar.
On the left hand side will appear a list of maps in groups. Open you're map and click on 'Event View', then click on a character. It is possible to change you're characters apearance at this time but I'm not going to cover that.
On the right hand side scroll down until you find the 'Script Offset' field. That's where you write the value you wrote down from bufrite. Save it, play it!

YOUR DONE
That a very basic script.

Lets move on and make the rest of the script we planned earlier.

Irish Witch
March 29th, 2007, 11:20 AM
2. I'll give you this for this!
Keeping the ball rolling from the last tutorial, lets begin our script in earnest.

We already now how we'll start our script so lets do the next part of our tutorial. This is actually the section we should have done first. For this script we'll Rename $ShowText to $GotCookie

2.1 One time only. (Using Flags)
Alright. When creating our script this function would normally go first because this is the start of our script.
Apropriatly our first few lines are:
#org $Startscript
Lock
Faceplayer

The last item on our list is actually a check to see if we've done this script already.
The ONLY way to store this value so that it won't be forgotten when you restart the game is by using the command setflag.

There are aproximately 6000 true/false flags available in the program however there are a large number inside the range of 0x300 - 0x400 and 0x800 to 0x900 that are used by the program itself so it's best to avoid these numbers. Flags are usually written in hex. So pick a value.
At this point in time we don't need to set the flag but we do need to check it using checkflag, and if true we go to another section of script.

since I'm going to use flag 0x200 the next two lines look like this.
checkflag 0x200
if B_TRUE goto $GotCookie

In the above if statement B_TRUE can also be written as 1 or 0x1. $GotCookie refers to the script we made earlier which will be placed at the end of the script we're working on now. If you've been reading along then we renamed the script for the purposes of our new script.

2.2 Yes Or No
Yes and no Questions are actually very similar to message boxes, mainly cause they both start with a message.
message $AskMe
$AskMe 1 = Would you like a Lava Cookie?
boxset 5

As you can see, the only difference here is in the boxset command. 6 displayed a normal textbox, but 5 also displays a "Yes/No" dialog so the user can select one.
Unlike checkflag the boxset statement can not be followed by an if statement. The way messagebox works is by placing you're response into a location in memory referred to as LASTRESULT. To find out what this is we need to use a compare statement first.
compare LASTRESUILT B_TRUE
if B_False goto $DontGet

Compare can also be used at a more advanced level to check other values in locations other than LASTRESULT and not only that but you can compare it to values other than 1 or 0 (B_True and B_False). For example, the command Countpokemon will return the number of pokemon in your party. At the moment though we don't need to worry about that cause we're nearly half way through our list of actions.
$DontGet will be another message script we will write later making a witty remark about your not taking a cookie.

2.3 Recieving Items
And finally we get to recieve our cookie. The value representing the cookie is 0x26. You can get item values from items.txt in the resource section of this thread.
It's a very simple command that has a built in check to make sure you have room in your bag. If your bag is full it will tell you and your script will end automatically.
The command is:
giveitem 0x26 1

Follow that with
setflag 0x200

to say we've completed the script all the way through and compliment the checkflag at the beginning of the script all that remains is the usual:
Release
end

So the overall code so far should read:

#org $Startscript
Lock
Faceplayer
checkflag 0x200
if B_TRUE goto $GotCookie
message $AskMe
$AskMe 1 = Would you like a Lava Cookie?
boxset 5
compare LASTRESUILT B_TRUE
if B_False goto $DontGet
giveitem 0x26 1
setflag 0x200
Release
end

#ORG $GotCookie
Lock
Faceplayer
message $NoCookie
$NoCookie 1 = I'm not made of cookies!\lYou only get one.
boxset 6
release
end

#ORG $DontGet
Lock
Faceplayer
message $AllMine
$AllMine 1 = All the more for me!
boxset 6
release
end


That's your giveitem script.

2.4 Checking for Items

Time for a new script. This one will follow on from the script above and I'm going to play it out like this:
1. You activate the character on the map.
2. If you have a lava cookie she trades it for an UltraBall
3. If you dont have the lava cookie from the last script she tells you she likes lava cookies.
4. If you gave her the cookie then she thanks you[/i]

This is actually an expansion of the last script we made. The script will be almost identical so we'll breeze through most of it.
Because our last script used flag 0x200 this script will use flag 0x201 and we'll change the offset name $GotCookie to $GotBall both at the if statement and where we display the message so we'll change that in the above script now.
Then we put in a new command.
Checkitem 0x26

Checkitem will return a value indicating the number of items you have. This will be stored in LASTRESULT and can be checked using compare.
So, bare minimum we need to do this:
[i]Compare LASTRESULT 1[i]

But this is where things get interesting. Because this is a special item it is wholely possible for us to have got lavacookies for elsewhere, so what happens if we have two cookies in our bag?
What we need is an if statement that checks if the number is greater or lower than our desired number. So, here are the statements you can use for the IF command.
[indent]B_<< Lower Than (0)
B_== Equals (1)
B_>> Greater Than (2)
B_<= Lower than or Equal to (3)
B_>= Greater than or Equal to (4)
B_!= Not exactly equal to (5)

This brings our code to date as thus:
#Org $StartScript
checkflag 0x201
if B_True goto $GotBall
checkitem 0x26
compare LASTRESULT 1
if B_<< goto $NoCookie

2.5 Removing Items
Now assuming all goes well we need to ask the ever important Question.
message $WantBall
$WantBall 1 = Oh, You have a lavacookie.\pIf you give it to me I'll\lgive you this UltraBall...\pWhat do you say?
message 5
boxset 5
compare LASTRESULT 1
if B_FALSE goto $DontGet

Later on we'll change the text in these message functions to say something apropriate.
Now it's time to recieve the ball, and more importantly take away one of the cookies. You know the first command and the second one will seam obvious to you once you read it.
As per the last script if you don't have room in the ball pouch the script will stop at this point.
giveitem 0x2 1
removeitem 0x26 1

Simple no. Just like giveitem the properties for removeitem are the item number followed by the number of items to remove.
If we had wanted to make the price of the UltraBall 5 cookies then we could easily change the above lines like this:
compare LASTRESULT 5
if B_<< goto $NoCookie

and
giveitem 0x2 1
removeitem 0x26 5

And before you know it we're done. All that remains is
Release
end

and to adjust the text to something apropriate for our new script.

Here's your code:
#Org $StartScript
checkflag 0x201
if B_True goto $GotBall
checkitem 0x26
compare LASTRESULT 1
if B_<< goto $NoCookie
message $WantBall
$WantBall 1 = Oh, You have a lavacookie.\pIf you give it to me I'll\lgive you this UltraBall...\pWhat do you say?
boxset 5
compare LASTRESULT 1
if B_FALSE goto $DontGet
giveitem 0x2 1
removeitem 0x26 1
Release
end

#ORG $GotBall
Lock
Faceplayer
message $LikeCookie
$LikeCookie 1 = Thanks for the cookie!
boxset 6
release
end

#ORG $NoCookie
Lock
Faceplayer
message $LoveCookie
$LoveCookie 1 = I Absolutely LOVE Lava Cookies!\lThey're Just so Spicy!
boxset 6
release
end

#ORG $DontGet
Lock
Faceplayer
message $AAAW
$AAAW 1 = Aaw C'Mon. It's a fair trade!!\nI Love those things.
boxset 6
release
end


And Thats Part Two.
Burn these scripts and Your Done

Irish Witch
March 30th, 2007, 08:41 PM
3. Would You Like This Pokemon!

NOTE BEFORE USE: You must be using build 30/3/7 or later of the Database for this to work smoothly
UPDATE: Note on vanishing sprites. Must use Release before updating the screen.

I know you've all been waiting for it so here it is.
In this tutorial we are going to create three pokeballs that can sit on the ground or a table.
Each script will then perform the following activities.

1. You activate the pokeball
2. It Tells you there's a pokemon inside the pokeball and asks if you want it.
3. If you say no you put the pokeball back
4. If you say yes you get the pokemon and are asked to give it a name.
5. If you already have your first pokemon display a refusal

Naturally this script can be used for choosing your starting pokemon in a method other than Professor Birch's Bag so an optional sixth part is:

If you've been following the tutorial in order than most of our script above will be old hat.
However you will also notice that we actually have two scripts here.

3.1 Vanishing Sprites
The last thing that happens in the above script however is most important. The ability to make a person (or pokeball) disapear in response to the map is something you'll use much more than the give-pokemon command itself.
It can be used for over-world pokemon like Legendaries, to make obstacles apear and disapear from your path or even to make a character 'leave' the current map.
The process is simple enough and can even be applied to the scripts we have already made.

At the end of each script so far we have been using the command setflag. In advanced map (right underneath the script offset field) is a field called People ID.
To make the character vanish simply plage the number of the flag you set (leave of the 0x) into the peopl ID. It's that simple!
When you set the flag the character will vanish when the screen updates next. There is a condition. For this to work you must Release the sprite before updating the screen or it wont vanish.
By vanishing the sprite you can also leave the checkflag command off the beginning of the script.

3.2 GivePokemon
Since each of these scripts are almost identical We'll only go through it the once. We already know the bulk of this script and it's actually very similar to our giveitem script.
We start with the following
#org $StartChik
checkflag 0x800
if B_True goto $NoBall
message $Chick
$Chick 1 = Chikorita!\lThe Fire Bird.\pTake the Chikorita?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack

Here we deviate with two new commands. The first is Jingle. Jingle plays the sound you hear when you recieve an object. We left it out from the giveitem script simply to keep the tutorial short but we'll place it in here.
The second command is the one we've been waiting for.
givepokemon 152 5 0
jingle
message $GotChick
$GotChick 1 = You Recieved a Chikorita
boxset 6

Givepokemon has three properties. <Pokemon> <Level> and <Item Held>
The pokemon number can be retrieved from poke.txt in the resources section and the item held from the items.txt likewise. Your level can be any level you want but try to be realistic.
Your pokemons attacks and exprience are calculated by the computer automatically and the pokemon is placed in your party and added to the pokedex. We'll activate that later.

3.3 NamePokemon
Now lets give the pokemon a name:
message $NameChick
$NameChick 1 = Would You like to give Chikorita a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon


I know what your going to ask... Is that all there is to it??? Yes. Namepokemon is a specific command. It is designed to work exclusively with two other commands (Givepokemon and Selectpokemon).
This makes it very limited to use but at the same time very powerful. The goto command here is simply being used to bypass namepokemon and go directly to our next script.
We'll top this off by setting the flag to make the sprite vanish as we discussed earlier.
[/i]setflag 0x203
goto $GiveDex[/i]

And that's the script we're going to use. We need three of these (one for each Trainer) as per these spoilers.
At the end we're using an Absolute goto. You won't use these all that much but we're using it here to make all the script link up.
Lets move on...

#org $StartChik
checkflag 0x800
if B_True goto $NoBall
message $Chick
$Chick 1 = Chikorita!\lThe Fire Bird.\pTake the Chikorita?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 152 5 0
jingle
message $GotChick
$GotChick 1 = You Recieved a Chikorita
boxset 6
message $NameChick
$NameChick 1 = Would You like to give Chikorita a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon
setflag 0x203
goto $GiveDex

#org $StartShrew
checkflag 0x800
if B_True goto $NoBall
message $Shrew
$Shrew 1 = SandShrew!\lDesert Mole.\pTake the Sandshrew?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 27 5 0
jingle
message $GotChick
$GotShrew 1 = You Recieved a Sandshrew
boxset 6
message $NameShrew
$NameShrew 1 = Would You like to give Sandshrew a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon
setflag 0x203
goto $GiveDex

#org $StartWing
checkflag 0x800
if B_True goto $NoBall
message $Chick
$Wing 1 = Wingull!\lThe Ocean Bird.\pTake the Wingull?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 152 5 0
jingle
message $GotGull
$GotGull 1 = You Recieved a Wingull
boxset 6
message $NameGull
$NameGull 1 = Would You like to give Wingull a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon
setflag 0x203
goto $GiveDex

3.4 Pokedex
No matter which pokemon you select we then need to proceed to the following tiny script.
It only does one thing at the moment but we'll be building on this in the next tutorial.
It is a very simple script to give you the pokedex, turn on the 'Pokemon' option in the menu (also known as the party menu).
The first two commands are done using system flags:
setflag 0x800 will set turn on the pokemon menu and
setflag 0x801 will turn on the pokedex

So here's our Final Script

#org $StartChik
checkflag 0x800
if B_True goto $NoBall
message $Chick
$Chick 1 = Chikorita!\lThe Fire Bird.\pTake the Chikorita?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 152 5 0
jingle
message $GotChick
$GotChick 1 = You Recieved a Chikorita
boxset 6
message $NameChick
$NameChick 1 = Would You like to give Chikorita a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon
setflag 0x203
goto $GiveDex

#org $StartShrew
checkflag 0x800
if B_True goto $NoBall
message $Shrew
$Shrew 1 = SandShrew!\lDesert Mole.\pTake the Sandshrew?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 27 5 0
jingle
message $GotChick
$GotShrew 1 = You Recieved a Sandshrew
boxset 6
message $NameShrew
$NameShrew 1 = Would You like to give Sandshrew a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon
setflag 0x204
goto $GiveDex

#org $StartWing
checkflag 0x800
if B_True goto $NoBall
message $Chick
$Wing 1 = Wingull!\lThe Ocean Bird.\pTake the Wingull?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 152 5 0
jingle
message $GotGull
$GotGull 1 = You Recieved a Wingull
boxset 6
message $NameGull
$NameGull 1 = Would You like to give Wingull a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon
setflag 0x205
goto $GiveDex

#org $GiveDex
setflag 0x800
setflag 0x801
message $Pokedex
$Pokedex 1 = I hope You like your new pokemon.\pWhile your on your journeys I have\la favour to ask you.\pProf OAK and I are trying to make an\lindex of everything pokemon.\pTake this pokedex with you and it\lwill log all the pokemon you see and catch.\pIt would greatly help our studies!
boxset 6
jingle
message $GotDex
$Gotdex 1 = You got the Pokedex!
boxset 6
end

#org $PutBack
message $PutBack
$PutBack 1 = You put the pokeball back.
boxset 6
end

#org $NoBall
message $Lastball
$Lastball 1 = You already have your pokemon.\nDont be so greedy!
boxset 6


Note: Bufrite will switch to the log view after you write this script to the rom. If you scroll up to the beginning of the log it will look something like this:

- Pushed startpokemon.$startchik to 800000
#PROCESS: D:\PokeWitch\POKEMON SAPPHIRE VERSION.GBA F:2 for read
---------------------------------------------------------------
- Pushed startpokemon.$startshrew to 80007A
- Pushed startpokemon.$startwing to 8000F4
- Pushed startpokemon.$givedex to 80016E
- Pushed startpokemon.$putback to 800188
- Pushed startpokemon.$noball to 80018F
- Pushed startpokemon.$chick to 800195
- Pushed startpokemon.$gotchick to 8001C3
- Pushed startpokemon.$namechick to 8001DC
- Pushed startpokemon.$shrew to 800205
- Pushed startpokemon.$gotshrew to 800231
- Pushed startpokemon.$nameshrew to 80024A
- Pushed startpokemon.$wing to 800273
- Pushed startpokemon.$gotgull to 80029E
- Pushed startpokemon.$namegull to 8002B5
- Pushed startpokemon.$pokedex to 8002DC
- Pushed startpokemon.$gotdex to 8003E9
- Pushed startpokemon.$lastball to 8001B8

Those puch commands are listing the locations in the rom that each offset is written to. The values for $Startchik, $StartShrew and $StartWing are the ones we'll attach to the pokeball. These numbers go into the 'script offset' field, and the end of each of these scripts we've calles a setflag. That flag goes into the 'People Id' field as discussed in the vanishing sprites section. Here is a list of the flags for quick reference:
$Offset = Flag
$StartChik = 0x203
$StartShrew = 0x204
$StartWing = 0x204

In the next tutorial we'll be modifing this script a little more using movement commands but before we do that I want to introduce two more commands.

3.5 CountPokemon
The countpokemon function doesn't take any properties. It's job is to return the number of pokemon in your party and can be used for a couple of purposes.
Later on we'll use it in conjunction with the trainerbattle commands but right now I'm going to provide you with a straight up give pokemon command. In it we'll insert the following code snippet.
countpokemon
compare LASTRESULT 6
if b_True goto $FullParty

In the above script we're using the command to make sure there is room in your party for the new pokemon. The start pokemon scripts don't need this check because you can only do them once at the very beginning of the game. This script though will make sure you dont 'lose' the pokemon by marking the script as done even though you don't have room for the pokemon in your party.
Using the other methods for the if statement it is also possible to do things like this:
Must have more than one pokemon to enter
compare LASTRESULT 1
if b_>> goto $EnterRoom
Must have EXACTLY two pokemon to battle
compare LASTRESULT 2
if b_!= goto $DualBattle
Cant have more than 3 pokemon to enter
compare LASTRESULT 3
if b_<= goto $EnterBattle

etc etc...
Here's the script in a handy spoiler tag to save room:

#org $GivePoke
checkflag 0x206
if B_True goto $HowPoke
message $WantPoke
$WantPoke 1 = I have a pokemon here that's too\lpowerful for me.\nWould you take care of it?
boxset 6
countpokemon
compare LASTRESULT 6
if B_True goto $FullParty
givepokemon 27 5 0
jingle
message $GotPoke
$GotPoke 1 = You Recieved a Pokemon
message $NamePoke
$NamePoke 1 = Would You like to give your Pokemon a name?
boxset 5
compare LASTRESULT 1
if b_False goto $NoName
Namepokemon

#org $NoName
setflag 0x204
end

#org $HowPoke
message $Banter
$Banter 1 = How's that pokemon of mine?
boxset 6
end

#org $FullParty
message $Error
$Error 1 = You don't have any room in your party.\pGo to a pokemon centre\nand deposit one of your pokemon\lusingthe computer.
boxset 6
end


3.6 SelectPokemon
This is probably the least useful of pokemon related commands (at this point in time). This command displays the 'Select a pokemon' dialog that get's displayed before trading or when you talk to the name rater. At the moment not enouogh in known to use this command for anything other than renaming at the moment and the command has no properties so all I can show you is a completed script for renaming a selected pokemon.


#org $GivePoke
message $ChangeName
$WantPoke 1 = Hi! I'm the Name Rater\pI Rate pokemons name and\nallow people to change them.\pWould you like to rate the name of\lyour pokemon?
boxset 5
compare LASTRESULT 1
if B_False goto $Later
selectpokemon
message $NamePoke
$NamePoke 1 = Alright, what name shall we give it?
boxset 6
Namepokemon
message $MuchBetter
$MuchBetter 1 = You're right.\lThat's a much better name.
boxset 6
end

#org $Later
message $Banter
$Banter 1 = Ok.\lLet me know if you change your mind?
boxset 6
end


And that's it for this Tutorial
See you Next time!

Irish Witch
April 9th, 2007, 12:11 AM
4. In Motion!

I'm going to continue on from the previous tutorial here with a motion tutorial. People seam to have a lot of trouble with this subject and really motion scripts seam to become necessary long before battle scripts anyhow.
Before we start this we need to do some extra fore-planning. Open up advancedmap and open up Professor Birch's Labratory (Ruby/Saphire).
For the purpose of this tutorial we will be using this map however the process can be adapted for any map.
Later on you will also need Ruby-Move.txt or FR-Move.txt from the resouces section at the beginning of the thread.

4.1 Preparing to Move

Creating motion is whole dependant on the map you are using. Attached below is a screen capture of Professor birchs labratory for reference. For the purposes of this tutorial set up your map to resemble this.
The [s] boxes around the entrance are script objects, all the other [s] boxes are 'signposts'. The difference between these are that signposts must be on a solid object and are interacted with like a person where script objects are intended to be walked on to trigger them.
The three pokeballs are actually 'people' with their sprite number set to 59. The position of the signposts are irrelivent but the pokeballs and the script objects must be set up like in the map to work with this tutorial.
You can change the number of each script objects etc using the event manager at the bottom right of the screen.

http://img.photobucket.com/albums/v330/Comhloiche/Fun%20Stuff/th_InMotion.jpg (http://img.photobucket.com/albums/v330/Comhloiche/Fun%20Stuff/InMotion.jpg)
During the course of our script we will be moving both Professor Birch and Brendan so before creating our script we are now going to go through and make notes on these two people. Click on each character and write down the following values (May differ from mine) If they do differ you'll have to modify these values to match yours:
Professor Birch:
- People No: 2
- 8 Spaces from [s] at entrance

Brendan:
- People No: 3
- Also 8 spaces from [s] at entrance
- 4 spaces from [s] next to pokeballs.

While we're here we are also going to make sure of something. Set the field "Movement" for both characters to "None". This will stop the character moving around so that the movement commands work the same every time.
Having moved the signposts around we can change the text they say at a later date using the methods used in tutorial 1. What well be focusing on right now is making the following happen.

This Script will replace the one giving us the pokedex in the last tutorial.
After we get the pokeball do this:
1. Move the character back in front of professor oak and display the text giving us the pokedex.
(Between 3 and 5 steps left, 1 step upward)
2. Give us the pokedex.

Sound simple but in practice not so simple. We've already done the first step and made a script to give us the pokedex so what we need to do now is put the movement text in prior to displaying the text.
To do this we must make make allowances for there being three pokeballs and therefore three possible movements. This is done using a series of checkflags and a really cool method referred to as a subroutine.

4.2 Subroutines
This is a subject I could have covered at an earlier date but we didn't have the need for it. Subroutines are the scripting equivelent of an if-and or if-else statement. the last line of a subroutine is Return not end and when you script reached this line it goes back to the line after the gosub. Here's an example of what I mean.

#org $IF_OR
checkflag 0x203
if b_True gosub $Move1
checkflag 0x204
if b_True gosub $Move2
checkflag 0x205
if b_True gosub $Move3
end

' Each $Move script ends with a 'return' statement



#org $IF_AND
checkflag 0x203
if b_True gosub $TestFlag2
end

#ORG $TestFlag2
checkflag 0x204
if b_True gosub $DoMove
return

' $DoMove script ends with a return statement

These two methods above while dislexic compared to some programming languages allow you to perform a function at hand and then return to the original script. The GivePokemon script in the last tutorial could have easily utilised subroutines fo the rename section had we wanted to but it wouldn't have influenced the way the code worked, just the neatness of the script.
This spoiler contains the equivelent code of the above script if written in something like BASIC. This is just for those of you curious about the methods because pokescript has nowhere near this flexibility as yet (I may figure out how to do this, but not yet.)
IF_OR:
if checkflag(0x203) then
' Move 1
endif
if checkflag(0x204) then
' Move 2
endif
if checkflag(0x205) then
' Move 3
endif

IF_AND:
if checkflag(0x203) then
if checkflag(0x204) then
' DoMove
endif
endif

For the record, the if statements we have been using up to this point are the equivelent of If_Else statements

In this case we're using the the code for an If_or statement which when plugged into our give-pokedex script looks like this:
#org $GiveDex
setflag 0x800
setflag 0x801
checkflag 0x203
if b_True gosub $Move1
checkflag 0x204
if b_True gosub $Move2
checkflag 0x205
if b_True gosub $Move3
message $Pokedex
$Pokedex 1 = I hope You like your new pokemon.\pWhile your on your journeys I have\la favour to ask you.\pProf OAK and I are trying to make an\lindex of everything pokemon.\pTake this pokedex with you and it\lwill log all the pokemon you see and catch.\pIt would greatly help our studies!
boxset 6
jingle
message $GotDex
$Gotdex 1 = You got the Pokedex!
boxset 6
end

Now on to the actual movement scripts.

4.3 ApplyMovement
Alright. Believe it or not momvement isn't actually very difficult once you understand the commands. The trick is all in knowing the numbers your working with. The command itself to make the movement happen is this:
Applymovement <People No> <Offset>
pausemove 0

Remember at the beginning of the tutorial we wrote down some figures from our map. Well the people number goes into the apropriate field here just like before, or if you want to control the player then use the value 0xFF.

NOTE: Your character can NOT be locked for applymovement to work. If you called Lock then you must call release before using applymovement. If you are applying movement to a character it should not be able to move around on it's own (as per the setup) so you shouldn't need to lock the character.

Offset refers to a section of script we'll write containing a list of the movements and Pausemove is a special command that has to be written that way every single time. This will allow the script to wait until the moments are over before doing anything else. You don't need to call it straight away but it will need to be called.

In the case of our above scripts we will be placing these commands inside our subroutines we called earlier.
#org $Move1
applymovement 0xFF $Ball1Move
pausemove 0
return

You will need to make one of these for each pokeball.

Movement Data
The offset on the other hand, that's different. Underneath our code we are now going to have to create a list of movements and unfortunately there is no shortcut for doing this.

Since I'm operating in ruby I'll be using the values in ruby-move.txt but if your using Fire-REd/Leaf-Green or Saphhire then you need to use FR-Move.txt (both available in resources).

The table should be easy enough to read, the only standard being this. If a word has a hunber next to it then that means the number of steps to take within one cycle. As an example:
Left 0 = Turn left (no stepping)
Left 1 = Step Left
Left 2 = Take 2 steps quickly.
Left 3 = Take 3 Steps REALLY quickly

This means that the number also acts like a speed control, but you need to keep in mind that a script reading
left1` left1 left1 left1
will take the same number of steps as:
left2 left2
but that the second script will take less time!

That said you can't use the actual keywords. To make this script you have to use the table as a look up chart. To write these values we have to use the keyword #Binary

Using the ruby chart this makes the above two commands look like this:
#Binary 0x06 0x06 0x06 0x06 0xFE
#Binary 0x0a 0x0a 0xFE

Back to our script.
The last value on each line is the 'end movement' marker. The end of your motion script must have this value. That said we're about to cheet with this script. The only difference between our three motion script is the number of steps left that we take at the beginning ofthe script so we're going to write it like this:

#org $Ball3Move
#Binary 0x06
#org $Ball2Move
#Binary 0x06
#org $Ball1Move
#Binary 0x06 0x06 0x06 0x01 0xFE

That's it. The first two offsets will add on the extra steps needed to make up the distance between you and the professor. Without the 0xFE on the end of these it then runs on into the next motion script until 0xFE is found.

And that polishes off the script from our last section. No matter what pokemon you choose you now go stand in front of BIRCH before being given your podedex.


#org $GiveDex
setflag 0x800
setflag 0x801
checkflag 0x203
if b_True gosub $Move1
checkflag 0x204
if b_True gosub $Move2
checkflag 0x205
if b_True gosub $Move3
message $Pokedex
$Pokedex 1 = I hope You like your new pokemon.\pWhile your on your journeys I have\la favour to ask you.\pProf OAK and I are trying to make an\lindex of everything pokemon.\pTake this pokedex with you and it\lwill log all the pokemon you see and catch.\pIt would greatly help our studies!
boxset 6
jingle
message $GotDex
$Gotdex 1 = You got the Pokedex!
boxset 6
end

#org $Move1
applymovement 0xFF $Ball1Move
pausemove 0
return
#org $Move2
applymovement 0xFF $Ball2Move
pausemove 0
return
#org $Move3
applymovement 0xFF $Ball3Move
pausemove 0
return

#org $Ball3Move
#Binary 0x06
#org $Ball2Move
#Binary 0x06
#org $Ball1Move
#Binary 0x06 0x06 0x06 0x01 0xFE

Lets make a slightly longer motion script this time.

4.3 Using SetVar

Alright. Still inside professor oaks lab lets make a script to do the following.

1. If you attempt to leave going straight down Brendan calls out to us.
2. Brendan comes down and leads you to the box next to the pokeball.
2b. Once there he gives you a GreatBall
3. If you try to leave through the right side of the exit you are moved accross to the left side so the script works normally.
4. Once you have recieved the ball you can't recieve another one.

This script will be attached to the [s] objects sitting over the exit. Just like the Pokeball scripts we'll be using a tiny script on each script points and then using subroutines in our common script. The difference is that here we'll be introducing the [i]Setvar command.
Unlike Flags, setvar commands are a case of simple check and uncheck. Instead setvar sets one of 60000 Intiger values allowing you to store a number instead of a yes/no.

Here's script for our left [s] object.
#org $LeftExit
setvar 0x4400 2
checkflag 0x800
if 0x0 gosub $UmPokemon
checkflag 0x207
if 0x0 goto $Followme
end

You can see clearly 0x4400 has been set to 2. $RightExit will set the same variable to 1.
The first checkflag is to make sure you don't try to leave without a pokemon and the second one makes sure this script wont repeat itself.

Let's move on to the main script:
#org $Followme
message $HeyWait
$HeyWait 1 = Brendan: Hey Wait!\p
boxset 6

Easy beginning. Now comes the comparison. To check which script object triggered this script we are simply going to use the compare statement and an if-gosub similar when we make the pokeball scripts.
compare 0x4400 1
if 0x1 gosub $AdjustLeft
compare 0x4400 2
if 0x1 gosub $AdjustRight

The adjust script we'll buid in a moment will be a simple script to move the player to the left. That way the stuff we're about to do will work regardless where the player was standing.

4.4 Follow Me
Making the player follow an npc isn't as difficult as it sounds. The only trick involved is making allowance for the characters being out of step. To do this we have to combine pausemove with the function pause. Pause, instead of waiting until all movements are over will wait for a specific time frame. You calculate this as 0x10 for each item in your movement script, plus 0x10 for the final 0xfe and another 0x10 for the initial applymovement command.
In the following code snippet therefore we'll do the following.
1. Start Brendan Moving.
2. Move the Player left 1 then move the player using the same script as Brendans script.
3. Wait until Brendan has finished moving.
4. Move brendan one more step so the player wont bump into him!
5. Wait till everybody stops moving

And that looks something like this:
applymovement 0x3 $Brendanwalk2
applymovement 0xff $StepRight
applymovement 0xff $Brendanwalk2
' This move set goes: Up0 Up2 Up2 Up2 Up1 left0 left1 left1 left1
$BrendanWalk2 1 ; 0x05 0x09 0x09 0x09 0x05 0x02 0x07 0x07 0x07 0xfe
pause 0x110

applymovement 3 $StepRight
$StepRight 1 ; #Binary 0x07 0xfe
pausemove 0

We've done something new here to. If you look at the script then we're no longer defining out motion script like this:
#org $StepRight
#Binary 0x07 0xfe

This is cause we are now using the same technique that stops us from writing strings as:
#org $MyText
= Any old text we want!

Both of the above would normally be placed at the end of your script after all the code but thanks to the power of inline offsets (or variable names) we can put both types of data with the script elements reffering to them. The only difference is that for movement data we use ; (semi-colon) instead of = (equals).
The Pause 0x110 causes the script to wait just long enough for brendan to stop but lets the player keep moving and the final movement below moves Brendan one final putting him square in front of the box and stopping the player from standing on the same space.
Please note that movements performed by applymovement will ignore solid objects and go straight through them.

And all that remains is to polish the script off with some small movements, a giveitem command and a setflag.

Here's our final script!

' ENTRY SCRIPTS
' -------------
#org $RightExit
setvar 0x4400 1
checkflag 0x800
if 0x0 gosub $UmPokemon
checkflag 0x207
if 0x0 goto $Followme
end

#org $LeftExit
setvar 0x4400 2
checkflag 0x800
if 0x0 gosub $UmPokemon
checkflag 0x207
if 0x0 goto $Followme
end

' YOU DONT HAVE A POKEMON
' -----------------------
#org $UmPokemon
message $WhatNoPoke
$WhatNoPoke 1 = BIRCH: Don't you want a Pokemon?
boxset 6
applymovement 0xff $TurnPlayer
$TurnPlayer 1 ; #Binary 0x05 0x09 0xfe
pausemove 0
end

' MOVE PLAYER ASIDE
' -----------------
#org $AdjustRight
applymovement 0xFF $MoveLeft
' This move set goes: Alert Left0 Left1 Right0
$MoveLeft ; #Binary 0x56 0x02 0x06 0x03
return

#org $AdjustLeft
applymovement 0xFF $FaceRight
' This move set goes: Alert Up0 Right0
$FaceRight ; #Binary 0x56 0x01 0x03
return

' FOLLOW ME SCRIPT
' ----------------
#org $Followme
message $HeyWait
$HeyWait 1 = Brendan: Hey Wait!\p
boxset 6

compare 0x4400 1
if 0x1 gosub $AdjustLeft
compare 0x4400 2
if 0x1 gosub $AdjustRight

applymovement 3 $BrendanWalk1
' This move set goes: Down2 Down2 Down2 Down2 Left0
$BrendanWalk1 1 ; #Binary 0x08 0x08 0x08 0x08 0x02 0xfe
pausemove 0

Message $Parting
$Parting 1 = Before you leave I have something\pThat might Help you later!
boxset 6

applymovement 0x3 $Brendanwalk2
applymovement 0xff $StepRight
applymovement 0xff $Brendanwalk2
' This move set goes: Up0 Up2 Up2 Up2 Up1
$BrendanWalk2 1 ; #Binary 0x05 0x09 0x09 0x09 0x05 0x02 0x07 0x07 0x07 0xfe
pause 0x110

applymovement 3 $StepRight
$StepRight 1 ;#Binary 0x07 0xfe
pausemove 0

message $Rummage
$Rummage 1 = Brendan Rummages in the box
boxset 6

applymovement 3 $FaceLeft
$FaceLeft 1 ; #Binary 0x02 0xfe
pausemove 0

message $UltraBall
$UltraBall 1 = Here it is!\nThis is an Ultra Ball!\pIt's one of the most powerful balls\lin existance and will catch just about\pAny pokemon. Use it wisely.
boxset 6
giveitem 0x2 1
release
end


Congragulations....
Now here's a couple of challenges for you.

Challenge 1
With all your knowledge make a script that allows the player to aproach a person from any side and still perform the same follow me script.
Hint, Variables set with Setvar aren't cleared when a script ends. You can easily set the value and then call the script when you activate a person.
Additional: Recent investigation shows this may require special commands not covered. Please watch this space!

Challenge 2
In the script list (if you go high enough) are sprites that take up more than one square such as boat sprites and truck sprites. If you move the player too close to these sprites then the sprite will cover the trainer hiding them. Use this knowledge to create a boat or truck script!

Go on. Give it a go!

Irish Witch
April 9th, 2007, 02:44 AM
5. In The Gym!
It's been a long haul and I know this is the one people have been waiting for. As such this will probably the be last tutorial for a little while.
With it you can populate a gym with trainers or create legendaries throughout the world. We'll be covering each of these in turn in revere order.

5.1 Overworld Sprites
This script has to be one of the easiest to make and therefore it's very tempting to use it a lot but trust me.. You shouldn't. That's what wildbattles are for and they are set us using advancemap.
We already learned in 'In Motion' how to make a person disapear from the map. This script is going to create a wild pokemon which will hang around outside the Gym we will be creating later.
It's script will go something like this:
1. On talking to the pokemon it gives off a cry and makes the apropriate sound.
2. If you have the gym badge a wildbattle then commences
- If you beat the pokemon it will vanish.

Now. As discussed in "A Simple Pokescript Tutorial" the usual run is to perform the above functions in reverse, however this list actually comes in two part because 2b is dependant on number 2. This means that for once the first thing on the list is the first thing we do.

1. Pokemon Cry
Most of these commands will be familia to you. There's only one new command here and that's Cry.
Cry playes a sound from a bank of sound effects and takes one number only, the number of the pokemon. These numbers are the same as the numbers of the pokemon themselves making the script very simple. On this case we're going to make a Charmeleon. You can get this from the file in the Resources section.
#org $StartWild
lock
faceplayer
cry 5
message $charCry
$charcry 1 = Charmeleon:Raarg!
boxset 6

The above is pretty much the normal text box script. If all we were doing was making a pokemon sprite that didn't have to battle then we could just put an end statement after this and leave it at that. We have out message, we have our variable and we have the command 'boxset' to display the message.
In this case we're using pokemon 5 - Charmeleon. It's a simple command and adds that little bit of life to the pokemon.

Next comes our check. After defeating the Gym leader you get a badge and this badge is turned on and off by the setting of a flag. The flags for these badges are these ones:
0x807 - First Badge - Stone Badge
0x808 - Second Badge - Knuckle Badge
0x809 - Third Badge - Dyamo Badge
0x80A - Fourth Badge - Heat Badge
0x80B - Fifth Badge - Balance Badge
0x80C - Sixth Badge - Feather Badge
0x80D - Seventh Badge - Mind Badge
0x80E - Eighth Badge - Rainbow Badge

So our next step is to check one of these flags. For the purpose of this tutorial we're checking the Knuckle badge which means the next three lines look like this:
checkflag 0x808
if 0x1 goto $WildBatt
release
end

Thats the Pokemon event. Not all that difficult, all we need to do now is the actual battle so lets move right along.

5.2 WildBattle
Here's the start of this powerful but very short script.
#org $Wildbatt
lock
wildbattle 5 20 1

That's it. wildbattle. The command has three properties, <pokemon> <level> and <mode>.
Again, the pokemon is the same number as the givepokemon command and the same number as the cry command. That doesn't change at any point in the program. Wherever you see that command you can use that value. In this script we're going to use a level 20 charmeleon. The pokemons attacks and abilities will be sorted out by the computer as though it were a normal wild battle like you get when walking through the grass. The only thing you need to think about is the mode.
This mode determines the field the battle is taking place on.
0 = grass
1 = water
2 = rock
3 for desert
You can play with these all you want but remember that the field the pokemon plays on will influence it's strength as well as the strength of the players pokemon. Also these values may mean different things in Fire-Red/Leafgreen then they do in Ruby/Saphire.
Either way is provides a good way to balance or unbalance the battle that's going to take place. The battlefield can also be changed by the weather on the map and this can be set from advancedmap in the 'Header View' tab.

Last but not least, if you loose you battle your script will stop here and you'll wake up near the last pokemon center. That's built into the command so you don't need to worry about it. If you win the battle however then the pokemon must vanish; to do to this we set a flag just like we did with during the 'In Motion' section.
Remember you must release the character before setting the flag. Another trick here is to simply use the command fadescreen 0 without the original fadescreen 1 to create a kind of blink effect.
The resulting script looks like this:


#org $StartWild
lock
faceplayer
cry 5
message $charCry
$charcry 1 = Charmeleon:Raarg!
boxset 6
checkflag 0x808
if 0x1 goto $WildBatt
release
end

#org $Wildbatt
lock
wildbattle 5 20 1
release
setflag 0x500
fadescreen 0
end


And that's your Overworld-Pokemon. Just make sure to set your pokemond PEOPLE ID in advanced-map to the flag at the end (0x500 in this case).

5.3 Find Your Trainer
Now we begin the processs of creating trainerbattle scripts. To fully explore the Trainerbattle command We're going to create three battle script which we can put inside a map of our choosing. These will be:
1. A simple Trainer battle.
2. A two-on-two battle.
3. A Gym Leader

We'll do these in order of complexity (top to bottom). The scripts aren't all that difficult, it's just keeping track of which one your using.

But first thing first.
You will also need to download a copy of Advanced Battle from the download site (http://fs06n4.sendspace.com/dl/3cf7dd06067dc6dc31cdb7c7a8fd281f/45e0ad5a/5rsbqc/A-Battle.rar). This program will allow you to view the pokemon each trainer has and edit the the trainers stats. We wont be doing any editing today and I'll be telling you the trainers number for our scripts but this is a really handy program and much more stable than the one provided in the Elitemap package. The file "advancebattleevo.exe" is the english version of the program, the other is in German.

Please note that Advancebattle displays the trainers in Alphabetical Order. If you want to change this to number order then save the file "trainers.txt" from the resouces section into "inis/Dutch" in the Advanced Battle folder. and rename it to "Trainers.ini" Replacing the file there.

All of the battles we're about to use work with the same command, and the first few are actually quite simple so we're just going to breeze through them.
Here's the actual command.
Trainerbattle <mode> <Trainer> <Challenge> <Defeat> <Optional>

The Reason we're covering it in sections is because the usage of the command changes slightly depending which mode you use. The modes are listed as this:
0 - Normal Battle
1 - Gym Battle
4 - Re-Battle Dual (Not Logged)
3 - Re-Battle Gym (Not Logged)
4 - Dual Battles
5 - Re-battle Normal (Not Logged)

Lets start at the very beginning shall we.

5.4. Basic Trainer Script
Alright. This is actually a very quick little script. so I'm simply going to give it to you and explain it afterwards.

[code]#org $Trainer1
lock
faceplayer
[i]trainerbattle 0 395 $MadChall $MadDefeat
$MadChall 1 = Madeline: I am mighty... I hope!
$MadDefeat 1 = Madeline: Oh poor Numel!!!!
message $MadTalk
$MadTalk 1 = I thought having a fire pokemon\iwould help make me stronger.\pI Guess I was wrong.
boxset 6
release
end

Believe it or not the command is that simple. 395 is the number for trainer Madeline (Parasol Lady with a Numel,) the pointers display the text to show before and after the battle and the final message is displayed if you talk to her again after the battle. This script is ready to put on a player as it is!
Heck, make two or three variations of these and you can populate your Gym with trainers...

5.5 Dual Battles
Now we are going to introduce the use of the <optional> property.
Under our previous script this <optional> was left out as it wasn't used. Here it will act as a pointer to text like this:
[i]trainerbattle 4 258 $AMChall $AMDefeat $AMNoBattle
$AMChall 1 = Anna: The others say we're not tough\lenough for this Gym.\pMeg: Well Show Em!
$AMDefeat 1 = Anna: I guess they were right!\pMeg: Dont worry, We'll improve.
$AMNoBattle 1 = Meg:On no.\pAnna: You can't battle us with\ljust one pokemon!

You can clearly see the mesage here. This check is done automatically by the program and failing to have a minimum of two pokemon will cause the script to stop right there.
Otherwise it's almost identical... Make sure you use two sprites on the map and give them the same script, or you can create two versions of the script that say different things but use the same trainer number.

The complete code:
[code]#org $Trainer2
lock
faceplayer
trainerbattle 4 258 $AMChall $AMDefeat $AMNoBattle
$AMChall 1 = Anna: The others say we're not tough\lenough for this Gym.\pMeg: Well Show Em!
$AMDefeat 1 = Anna: I guess they were right!\pMeg: Dont worry, We'll improve.
$AMNoBattle 1 = Meg:On no.\pAnna: You can't battle us with\ljust one pokemon!
message $AMTalk
$AMTalk 1 = Anna: You just wait and see!
boxset 6
release
end[code]

5.6 Gym Leaders
Finally things start getting complicated.
The gym leader script is required to perform a series of tasks (such as handing over gym badges) after you beat them. The initial script is very similar to the above ones so here it is:
[code]#org $Trainer1
lock
faceplayer
trainerbattle 0 114 $BernChall $BernDefeat $BernCode
$BernChall 1 = Bernie: I am might... I hope!
$BernDefeat 1 = Bernie: Oh poor Numel!!!!
message $BernTalk
$BernTalk 1 = Wow.. Colour be Burned!
boxset 6
release
end

In this script the last pointer for the trainerbattle command links to more code after the battle is over. If you loose then the script terminates without performing this code.
$Berncode can do anything you want but amongst that code you have to give the trainer a badge. This is done by setting the flag mentioned above.

Not all that difficult in reality is it. Here is the other half of the Gym Leader Script.

#org $BernCode
message $Congrats
$Congrats 1 = BERNIE: Your a pretty good trainer!\pAs leader of this Gym it is now my Duty to give you the Knuckle Badge.
boxset 6

setflag 0x808
jingle
message $GotBadge
$Gotbadge 1 = You recieved the Knuckle Badge!\pBERNIE: That badge will allow you to control\lall pokemon above level X\nAnd will also let your pokemon perform\lTASK outside of battle.\pWhile I'm at it you can have this!
boxset 6

giveitem 0x5f 1
message $FireStone
$FireStone 1 = That is a Firestone.\nIt will evolve some Fire type pokemon.\pAlso, There's a really strong pokemon outside.\nI couldn't catch it cause my pokemon\lweren't strong enough but you\ncan go for it if you want!
boxset 6
end



And that links up to the script we made earlier.

5.7 Rebattle
If you look at the battle types mentioned earlier you'll notice the 'Rebattle' values. Battles started with these types will take place every time you activate the trainer. You must aproach them to make these battles happen, but most trainers don't rebattle every time you aproach, only when the 'Rebattle' event allows them to. The way you check for this is with a compare command as trainerbattle will place the value '1' in LASTRESULT if the trainer is ready to battle again.

Moditying the 'Basic Trainer Script' from section 5.4 that makes the command look like this:
trainerbattle 0 395 $MadChall $MadDefeat
compare LASTRESULT 1
if B_TRUE goto $ReBattle

Just modify any of the script above to include that compare and you're ready to do a rebattle section. Rebattle scripts are identical to the normal scripts, the only difference being the lack of logging. You can also use the re-battle command on it's own without the check to make a trainer that will challenge you every time they see you, and the Pokemon League trainers are all made using Gym-Rebattle scripts.. Give it a go!

5.8 Battle On Site
Ok, this isn't actually pokescript related. To make a trainer battle you on site you need to configure it in Advancedmap. This means checking the box marked 'Trainer' and setting the 'View Range' field to a number of steps. This value must be written in hex.

Hope you Enjoy Your Gym.

~Teh Panda~
August 13th, 2007, 08:29 AM
i added this script to a girl in littleRoot

#ORG $ShowText
Lock
Faceplayer
message $hi
$hi 1 = hello, nice to meet ya!
boxset 6
release
end

when i begin to talk to her the screen turns red
plz help Irish Witch

AmaterasuOkami
August 13th, 2007, 11:06 AM
Can I translate this tutorial in French for the french forum PokéMountain with credits ?

SilverPlatinum
August 17th, 2007, 02:09 PM
wooooooooooooooooooooooooooooooow!!!!!!!!!!!!!!! you rock thx so much!!!!!!!!!!!!!!!!!!!!!!!!!!!

O.G. Duke
August 20th, 2007, 01:30 AM
A question! I want the sprite to vanish after battle with it ( Legendary pokemon), but I used the step in the tutorial ( Place the setflag value into the People ID ) it cant use for Legendary Battle...How can I do?

thethethethe
August 20th, 2007, 02:04 AM
This is because the map needs to be reloaded for the ID's to take place.

There is a certain binary movement that allows a sprite to dissapear, it is #binary 0x60.

Another option is to, do a fadescreen 0, right before the end of your script. If everything is released and done correctly, Fadescreen will in-essence reload the screen, which will make the ID take effect. It'll be a blink and they'll be gone.

:)

Don't worry you didn't miss this post, it's from the script discussion thread(sorry if this is not allowed, I'm not sure), sorry I just couldn't be bothered rewriting the answer.
so try putting this after the wildbattle command.
setflag 0x(???)
fadescreen 0
release
end

O.G. Duke
August 20th, 2007, 03:50 AM
Thanks, you helped me again!

crystalman101
August 22nd, 2007, 02:11 PM
When I right click the file, it doesn't say ccompile. What do I do?

Corona
August 22nd, 2007, 06:21 PM
When I right click the file, it doesn't say ccompile. What do I do?

Are you saving it as All Files and .RBC at the end?

crystalman101
August 23rd, 2007, 01:54 PM
Mine doesn't list rbc so what do I do?

thethethethe
August 23rd, 2007, 02:31 PM
Mine doesn't list rbc so what do I do?

in the save as screen just type (filename).rbc

crystalman101
August 23rd, 2007, 02:46 PM
in the save as screen just type (filename).rbc
I did that but I still don't see compile.

BOH
August 24th, 2007, 01:38 AM
i use the wild pokemon script

#org $StartWild
lock
faceplayer
cry 5
message $charCry
$charcry 1 = Charmeleon:Raarg!
boxset 6
checkflag 0x808
if 0x1 goto $WildBatt
release
end

#org $Wildbatt
lock
wildbattle 5 20 1
release
setflag 0x500
fadescreen 0
end

but when i compile the rom appeard this error message:

Error of run-time '13'. Type not correspondent

why?

p.s. i translate it from italian sorry for the mistake

Ooka
August 24th, 2007, 10:17 PM
#org $StartChik
checkflag 0x800
if B_True goto $NoBall
message $Chick
$Chick 1 = Chikorita!\lThe Fire Bird.\pTake the Chikorita?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 152 5 0
jingle
message $GotChick
$GotChick 1 = You Recieved a Chikorita
boxset 6
message $NameChick
$NameChick 1 = Would You like to give Chikorita a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon
setflag 0x203
goto $GiveDex

#org $StartShrew
checkflag 0x800
if B_True goto $NoBall
message $Shrew
$Shrew 1 = SandShrew!\lDesert Mole.\pTake the Sandshrew?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 27 5 0
jingle
message $GotChick
$GotShrew 1 = You Recieved a Sandshrew
boxset 6
message $NameShrew
$NameShrew 1 = Would You like to give Sandshrew a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon
setflag 0x204
goto $GiveDex

#org $StartWing
checkflag 0x800
if B_True goto $NoBall
message $Chick
$Wing 1 = Wingull!\lThe Ocean Bird.\pTake the Wingull?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 152 5 0
jingle
message $GotGull
$GotGull 1 = You Recieved a Wingull
boxset 6
message $NameGull
$NameGull 1 = Would You like to give Wingull a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon
setflag 0x205
goto $GiveDex

#org $GiveDex
setflag 0x800
setflag 0x801
message $Pokedex
$Pokedex 1 = I hope You like your new pokemon.\pWhile your on your journeys I have\la favour to ask you.\pProf OAK and I are trying to make an\lindex of everything pokemon.\pTake this pokedex with you and it\lwill log all the pokemon you see and catch.\pIt would greatly help our studies!
boxset 6
jingle
message $GotDex
$Gotdex 1 = You got the Pokedex!
boxset 6
end

#org $PutBack
message $PutBack
$PutBack 1 = You put the pokeball back.
boxset 6
end

#org $NoBall
message $Lastball
$Lastball 1 = You already have your pokemon.\nDont be so greedy!
boxset 6

This has probably already been pointed out, I just wanted to say it just in case, but if you give this event to proffessor Oak's aid, he doesn't lock or faceplayer, and it puts you in safari zone mode so the rest of the game you go around like you are in a safari zone.

http://i165.photobucket.com/albums/u54/Ooka_100/goodsaafarizone.jpg

And if you hit retire, it shows you leaving the safari zone in fushia city. How am I supposed to get out of fushia city without fighting anyone? It doesn't help to try to fight them either.

thethethethe
August 24th, 2007, 11:15 PM
This is because in Fire Red setflag 0x800 activates the Safari Menu. Change 0x800 to 0x828 for Fire Red, Leaf Green. Also change 0x801 to 0x829. This is for activating the Pokedex on the menu.

Ooka
August 24th, 2007, 11:43 PM
Just more problems, and still no lock or faceplayer

http://i165.photobucket.com/albums/u54/Ooka_100/anotherproblem.jpg

And still no pokedex

http://i165.photobucket.com/albums/u54/Ooka_100/moretrouble.jpg

thethethethe
August 24th, 2007, 11:59 PM
Just more problems, and still no lock or faceplayer

http://i165.photobucket.com/albums/u54/Ooka_100/anotherproblem.jpg

And still no pokedex

http://i165.photobucket.com/albums/u54/Ooka_100/moretrouble.jpg

Thats because there is no Lock or faceplayer in the script. And I can't help you with namepokemon, I've got it to work only once, (I accidentaly deleted that script) so I just leave that out.

mackoo
August 26th, 2007, 01:41 AM
Please help me - when I'm compiling script I have this:
http://img214.imageshack.us/img214/7538/ruby01es5.png
All fully works but they (people who have new scripts) are talking in japaneesee, I tried all roms - what's wrong??
Here is my log after burning:
#PROCESS: C:\Documents and Settings\Maciej\Pulpit\PokemonCyclone\Ruby.gba F:2 for read
-------------------------------------------------------------------------------------
- Pushed skrypt.$start to 0
- Pushed skrypt.$move to 43
- Pushed skrypt.$hi to 49
- Pushed skrypt.$rec to 63
#PROCESS: C:\Documents and Settings\Maciej\Pulpit\PokemonCyclone\Ruby.gba F:3 for read
-------------------------------------------------------------------------------------
- Pushed skrypt.$start to 800000
- Pushed skrypt.$move to 800043
- Pushed skrypt.$hi to 800049
- Pushed skrypt.$rec to 800063
#PROCESS: C:\Documents and Settings\Maciej\Pulpit\PokemonCyclone\Ruby.gba F:4 for read
-------------------------------------------------------------------------------------
- Adjusting skrypt.$hi in 0 at 8800049
- Adjusting skrypt.$rec in 0 at 8800063
- Adjusting skrypt.$move in 0 at 8800043
- Putting [jZ
- Putting [`ţ] at 800043
- Putting [ÂUaU
- Putting [Óaé
|
\- Processed 0 Lines


Sorry for ths emots that forum created :/

And my log after "copile script":

#PROCESS: C:\Documents and Settings\Maciej\Pulpit\PokemonCyclone\skrypt.buf F:2 for write
----------------------------------------------------------------------------------------
COMMENT BUFFER DROP 10 [NO COMMENT]
DROPPING 3 Pointers
$hi at buffer 0 position 4
$rec at buffer 0 position 46
$move at buffer 0 position 55
DROPPING 1 Offsetts
$start at buffer 0 position 0
DROPPING 3 Offsetts
$move at buffer 1 position 0
$hi at buffer 1 position 6
$rec at buffer 1 position 32
BUFFER 0 DROP: 67 [jZ
BUFFER 1 DROP: 58 [ `ţÂUaU
|
\- Processed 16 Buffers

|
\- Processed 820 Lines

|
\- Processed 0 Lines

Ooka
August 26th, 2007, 12:18 PM
Maybe you should post the script so more people could help you.

Briggsby
August 26th, 2007, 03:33 PM
Lol I created an account practically only for this purpose, but still the site looks GREAT! I'm sure I'll love it, and joyride your misspelling siggy is incredible...anyway:
If like me and crystalman101 did you don't have the compile option even if it's the right type of file, you can go on pokescript and click encode and select the RBC file, it will do exactly the same thing...hope this helps people...

thethethethe
August 26th, 2007, 11:06 PM
In the first post, there is something written, PLEASE DONT ASK QUESTIONS IN THIS THREAD. So could everyone, please do this. If you have a question, please post it in the Script discussion thread.

crystalman101
August 27th, 2007, 01:55 AM
Where's that? (Sorry, I'm new)

BOH
August 28th, 2007, 05:25 AM
sorry, nobody can help me?

i want a correct script for leggedary pokemon. the pokemon must disappear after the fight

tnx

Ooka
August 28th, 2007, 06:40 AM
You need to go to the Script Request thread please.

BOH
August 28th, 2007, 07:08 AM
can you link that thread plz?

foullump
August 29th, 2007, 04:37 PM
can you link that thread plz?

It's stickied in the rom hacking thread.
If you still have trouble go here (http://pokecommunity.com/showthread.php?t=80304).

cooley
August 31st, 2007, 08:49 AM
Will you make a Tutorial for Pokemon G/S Scripting?
Because I'm in need of one now.

spenceroone3
September 9th, 2007, 01:47 AM
Oh cool i needed to learn to compile thanx

psyduckmaniac
September 15th, 2007, 06:59 PM
omg. i spent 3 hours learning half of it but it works! great tutorial!

garra911
September 21st, 2007, 03:25 PM
when i compile it says "file not found or user canceled when i clearly didnt cancel or delete my rbc, what does it mean

♠εx
September 22nd, 2007, 09:18 PM
Does anyone have a complete list of LG Items, Pokemon and anything else.
I don't need the Pokemon list, just asking if anyone has a complete list of everything.

Thanks.

Darthatron
September 22nd, 2007, 11:14 PM
I believe its the exact same as FR list.

ryan123456789019
September 23rd, 2007, 11:22 AM
when i right click there is no compile button and yes i saved it has .rbc. also is the progream called poketscript or pokescript

cooley
September 23rd, 2007, 01:54 PM
when i right click there is no compile button and yes i saved it has .rbc. also is the progream called poketscript or pokescript
Then you didn't install 'pkmADV' database.

♠εx
September 23rd, 2007, 07:46 PM
Darthotron

The problem is there is no Item list for FR. >_<

thethethethe
September 23rd, 2007, 07:56 PM
Darthotron

The problem is there is no Item list for FR. >_<

Yes there is, its somewhere here in the tutorials section, Its actually called the 'FR/LG full item list.'

ryan123456789019
September 26th, 2007, 12:44 PM
when i compile it says "file not found or user canceled when i clearly didnt cancel or delete my rbc, what does it mean

i need help for that too so how do you do it

Binary
September 29th, 2007, 02:01 AM
y does it say invalid command everytime?

ryan123456789019
September 29th, 2007, 10:57 AM
yes it does say that every single time so i can not script till i fix it and i dont know how i need help

cooley
September 29th, 2007, 04:58 PM
yes it does say that every single time so i can not script till i fix it and i dont know how i need help

You have to use simple offsets and/or give it a simple name(#org $StartScript = #org $start, and Applymovement Aid script.rbc = aidmove.rbc)
Get it.

Elementologist
October 3rd, 2007, 07:14 AM
when i compile it says "file not found or user canceled when i clearly didnt cancel or delete my rbc, what does it mean
Exactly The Sme Thing Happens To Me Every Time. Also, the Choose offset floating window doesn't appear after I click burn

Wuggles
October 3rd, 2007, 07:58 AM
Uhm... you should do it this way:

1. open BufRite.
2. File > Import > click the Buf file
3. Destination > your hack
4. click on the blue book(assign) in the right-up corner
5. click on the lamp
6. doubleclick on the first offset
7. push Assign
6. File > Burn

That should work

cooley
October 3rd, 2007, 03:38 PM
My Poketscript works, but when it compiles, no matter
what offset I input into A-Map, it just freezes the game,

when I interact with this character, I've tried v1.0, and
v1.2(crossover) version.

Thanks, whoever helps with this problem,
~cooley~

OMNIPOTENT
October 4th, 2007, 09:31 AM
can't be a messed up rom? try some simple scripting on a clean rom. if neither that is working, try reinstalling... and go elsewhere asking for help, this is not the right section (i suppose rom hacking in general is)

cooley
October 4th, 2007, 02:33 PM
can't be a messed up rom? try some simple scripting on a clean rom. if neither that is working, try reinstalling... and go elsewhere asking for help, this is not the right section (i suppose rom hacking in general is)

Actually you're right, this was supposed to go in the pokescript discussions thread. Simple questions is for Rom hacing questions, not for program help.
Sorry Irish for Spamming your thread.
~cooley~

Elementologist
October 8th, 2007, 11:30 AM
Nope, It still doesn't work. It's Probably an installation issue. This has happened to me with every rom hacking tool until new versions were out. Thanks Anyway.

ZiJing
October 8th, 2007, 11:09 PM
How come every time I tried to compile a script,it says 'Run-time error: 6 Overflow' or something like that?

Derlo
October 17th, 2007, 09:47 AM
hey, when I make a script the command "jingle" don't work..
someone know who I need do to this command work?

thethethethe
October 17th, 2007, 12:43 PM
I don't like using jingle, I use this instead...
fanfare 0x13E
waitfanfare
It has almost the exact same effect.

Pieman
October 21st, 2007, 09:33 AM
For any of you that DO NOT get the "Compile Script" shortcut menu function, make sure your scripts end in .rbc. If they don't, open them, click "Save As...", select "All Files" from the file type box, and save as "somename.rbc". If that doesn't work, you most likely didn't install your file associations correctly.

1. Use the uninstall.reg (http://members.westnet.com.au/comhloiche/PokeScript/Uninstall.reg) file that you see on the pokescript website. Run it and ignore anything that it says about modifying the registry; this file is safe. It will clean out all file extensions related to PokeScript in the registry.

2. Uninstall Pokescript and any PkmnADV database you installed.

3. Download a fresh copy of Pokescript.

4. Install Pokescript.

5. Now download the PkmnADV database installer. SAVE IT TO THE SAME DIRECTORY YOU PUT POKESCRIPT IN.

6. Run the installer and extract the database to the same folder Pokescript is in. If it does not have the Pokescript directory in the location to install, then put the correct directory there.

7. Do not run the Pokescript installer again after the database installs. Close it.

8. Go to the Pokescript directory and run PokeScript.exe.

9. A log window should pop up that looks like this:
http://members.westnet.com.au/comhloiche/PokeScript/Install2.jpg

10. If your log window does not contain the four lines that start with "REGISTERED", you did something wrong, and the file associations are NOT registered right. Start over from Step 1. Otherwise, compiling scripts should now work. Try right-clicking a .rbc file that was properly saved. If "Compile Script" appears, then the associations are set correctly. Otherwise, make sure your user account has Administrative permissions, as a last measure.

IF ALL ELSE FAILS AND YOU STILL CANNOT COMPILE SCRIPTS, TRY THE MANUAL COMPILING METHOD. IF THAT DOES NOT WORK OR YOU WANT ADDITIONAL ASSISTANCE WITH THE FILE EXTENSIONS, ASK AWAY.

Derlo
October 23rd, 2007, 06:03 AM
I don't like using jingle, I use this instead...
fanfare 0x13E
waitfanfare
It has almost the exact same effect.

it is not that effect!!

it is the sound when a balloon appears!
which do you know is?

Dreaded Soul
October 27th, 2007, 10:40 PM
When I try to open Pokescript, it says:

Run-time error '-2147024770 (8007007e)':
Automation error
The specified module could not be found.

What's happening?!!

Haile Selassie IV
October 28th, 2007, 05:10 AM
Hi, I have a very strange problem with pokéscript. After I compiled my script and did everything etc... and I play my hack it will say it's lines and then an empty text bar.
It will stay like that for about a (1/2) minute. When I tried to compile the script you(IW) created for a wild battle with Charmeleon,I get nothing. I only hear the beep. After rapidly pressing the A button I get this:qÁr or something like that and it won't stop. What the hell did I do wrong?(In both cases)
Note: I dowloaded the Pokescript and Pokeadv from this forum.

Dreaded Soul
October 29th, 2007, 02:45 AM
When I try to open Pokescript, it says:

Run-time error '-2147024770 (8007007e)':
Automation error
The specified module could not be found.

What's happening?!!

OsherStyle
October 31st, 2007, 12:11 PM
How i change script? when i click ctrl+click on the man in the elit map, opn me a script, and then i change it, and it dont save the change! how i save?

EVIL DARK MEW
November 2nd, 2007, 05:10 PM
#org $StartWild
lock
faceplayer
cry 5
message $charCry
$charcry 1 = Charmeleon:Raarg!
boxset 6



Don't call on he lock command or the script will not work

Hi, I have a very strange problem with pokéscript. After I compiled my script and did everything etc... and I play my hack it will say it's lines and then an empty text bar.
It will stay like that for about a (1/2) minute. When I tried to compile the script you(IW) created for a wild battle with Charmeleon,I get nothing. I only hear the beep. After rapidly pressing the A button I get this:qÁr or something like that and it won't stop. What the hell did I do wrong?(In both cases)
Note: I dowloaded the Pokescript and Pokeadv from this forum.

this is most likely caused by an incorrect script..if you post it here i may be able to help.


How come every time I tried to compile a script,it says 'Run-time error: 6 Overflow' or something like that?

this is caused by invalid commands

Haile Selassie IV
November 3rd, 2007, 12:48 AM
I also posted this somewhere else:

Why do all my scripts end up into nothing? After I compiled my script, "used" my script and want to go away I get this:http://i144.photobucket.com/albums/r199/vo-dee/fout-1.png
The script works but afterwords I get this thing.

I also used a script from Irish Witch but that script doesn't say anything. And after rapidly pressing the A buton I get this:http://i144.photobucket.com/albums/r199/vo-dee/strangeness.png

Doesn't anyone know the problem? Ill post my scripts to.



This one I used beacause I wanted to be sure nothing was wrong with me own:
#org $StartWild
lock
faceplayer
cry 5
message $charCry
$charcry 1 = Charmeleon:Raarg!
boxset 6
checkflag 0x808
if 0x1 goto $WildBatt
release
end

#org $Wildbatt
lock
wildbattle 5 20 1
release
setflag 0x500
fadescreen 0
end

I first changed it into this:
#org $StartWild
lock
faceplayer
cry 151
message $mewCry
$mewcry 1 = Mew: Mew?
boxset 6
checkflag 0x808
if 0x1 goto $WildBatt
release
end

#org $Wildbatt
lock
wildbattle 151 5 0
release
setflag 0x500
fadescreen 0
end

This one is very strange, it will say I allready have one, but he gives me one(only one):
#org 0x831000
faceplayer
checkflag 0x20B
compare LASTRESULT 0x1
if 0x1 goto 0x831100
message 0x831200
boxset 0x4
givepokemon 0x4 0xA 0xD7
setflag 0x20B
release
end

#org 0x831100
message 0x831300
boxset 0x4
release
end

#org 0x831200
= You have won a CHARMANDER!

#org 0x831300
= Sorry, you already have one.

This one also screws up:
#org 0x800000
lock
faceplayer
checkflag 0x10A
if 1 jump 0x800050
special 0x16F
setflag 0x10A
fanfare 0x13E
msgbox 0x800100
callstd 0x6
waitfanfare
release
end

#org 0x800050
msgbox 0x800070
callstd 0x6
release
end

#org 0x800070
= Like your new POKéDEX?

#org 0x800100
= Your POKéDEX was upgraded!

Even this will screw up in the end:
#org $lukenetty
lock
faceplayer
message $berichtje
$berichtje 1 = Plaats hier je tekst!
callstd 6
release
end

NOTE: You can use scriptED scripts in Pokescript. Some did it for me once but he has removed all his hacking tools.
NOTE2: They all end up like this except Irish Witch's wildbatte: http://i144.photobucket.com/albums/r199/vo-dee/fout-1.png

IW's wildbattles turn into this after rapidly pressing A: http://i144.photobucket.com/albums/r199/vo-dee/strangeness.png

giova90
November 14th, 2007, 11:52 AM
the link find not found ,can you re-post the ruby move!!!!
where do i find this things(like ruby move for poketscript)?
i'm sorry for my bad english!!!:'(

thetribemaster
November 15th, 2007, 07:16 PM
I cant get pokescript because the link is broke. and BTW where is Irish Witch?

♠εx
November 15th, 2007, 11:15 PM
Irish Witch's site is down, so you cant get it from there.
You'll have to ask someone or find an alternatice link for it.

giova90
November 16th, 2007, 09:23 AM
exactly i need these!!!someone can post it..or send me?

thetribemaster
November 16th, 2007, 03:05 PM
Yes me too cause I cant get rubikon to work cause i dont have a decent HEX editor and Scizz is dissapeared (here and his site) so I cant get diamond cutter.

EVIL DARK MEW
November 16th, 2007, 03:33 PM
I also posted this somewhere else:



Doesn't anyone know the problem? Ill post my scripts to.



This one I used beacause I wanted to be sure nothing was wrong with me own:
#org $StartWild
lock
faceplayer
cry 5
message $charCry
$charcry 1 = Charmeleon:Raarg!
boxset 6
checkflag 0x808
if 0x1 goto $WildBatt
release
end

#org $Wildbatt
lock
wildbattle 5 20 1
release
setflag 0x500
fadescreen 0
endI first changed it into this:
#org $StartWild
lock
faceplayer
cry 151
message $mewCry
$mewcry 1 = Mew: Mew?
boxset 6
checkflag 0x808
if 0x1 goto $WildBatt
release
end

#org $Wildbatt
lock
wildbattle 151 5 0
release
setflag 0x500
fadescreen 0
endThis one is very strange, it will say I allready have one, but he gives me one(only one):
#org 0x831000
faceplayer
checkflag 0x20B
compare LASTRESULT 0x1
if 0x1 goto 0x831100
message 0x831200
boxset 0x4
givepokemon 0x4 0xA 0xD7
setflag 0x20B
release
end

#org 0x831100
message 0x831300
boxset 0x4
release
end

#org 0x831200
= You have won a CHARMANDER!

#org 0x831300
= Sorry, you already have one.This one also screws up:
#org 0x800000
lock
faceplayer
checkflag 0x10A
if 1 jump 0x800050
special 0x16F
setflag 0x10A
fanfare 0x13E
msgbox 0x800100
callstd 0x6
waitfanfare
release
end

#org 0x800050
msgbox 0x800070
callstd 0x6
release
end

#org 0x800070
= Like your new POKéDEX?

#org 0x800100
= Your POKéDEX was upgraded!Even this will screw up in the end:
#org $lukenetty
lock
faceplayer
message $berichtje
$berichtje 1 = Plaats hier je tekst!
callstd 6
release
end
NOTE: You can use scriptED scripts in Pokescript. Some did it for me once but he has removed all his hacking tools.
NOTE2: They all end up like this except Irish Witch's wildbatte: http://i144.photobucket.com/albums/r199/vo-dee/fout-1.png

IW's wildbattles turn into this after rapidly pressing A: http://i144.photobucket.com/albums/r199/vo-dee/strangeness.png

Do not call for a lock before a battle script...

IT WILL NOT WORK.

Why would you try scripted scripts with pokescript...???

thetribemaster
November 16th, 2007, 05:50 PM
Irish Witch's site is down, so you cant get it from there.
You'll have to ask someone or find an alternatice link for it.

OMG, there is noone else!!! I even searched the DEEP WEB and found nothing!
So it'll have to be sent by someone that already has it.

EVIL DARK MEW
November 16th, 2007, 07:18 PM
OMG, there is noone else!!! I even searched the DEEP WEB and found nothing!
So it'll have to be sent by someone that already has it.

i already made a thread for it ..hopefully a mod approves it soon.

saiyanlogo
November 19th, 2007, 01:03 PM
Does anyone know how to make a shiny wild battle poke script?
I googled it and look and didnt see one...

Derlo
November 21st, 2007, 09:39 AM
Which the command to enable the animation of the door in FR?? I already sought but I didn't find.
EX: in the begin of the game when the PROF. OAK takes you for LAB for surrendering your first PKM.
Thank you.

derv1205
December 18th, 2007, 11:14 AM
Hi, i want some help n.n , i insert this script in a pokeball:
#org $StartMaku
checkflag 0x800
message $Makuhita
$Makuhita 1 = Makuhita!!\nThe fighting pokemon.\pTake the Pichu?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 335 5 0
jingle
message $GotMaku
$GotMaku 1 = You Recieved a Makuhita
boxset 6
message $NameMaku
$NameMaku 1 = Would You like to give Makuhita a name?
boxset 5
compare LASTRESULT 1
if B_False goto $GiveDex
Namepokemon
setflag 0x203
goto $GiveDex

#org $PutBack
message $PutBack
$PutBack 1 = You put the pokeball back.
boxset 6
end

#org $GiveDex
setflag 0x800
setflag 0x801
message $Pokedex
$Pokedex 1 = I hope You like your new pokemon.\pWhile your on your journeys I have\la favour to ask you.\pProf OAK and I are trying to make an\lindex of everything pokemon.\pTake this pokedex with you and it\lwill log all the pokemon you see and catch.\pIt would greatly help our studies!
boxset 6
jingle
message $GotDex
$Gotdex 1 = You got the Pokedex!
boxset 6
end, it works all, i receive the pokemon, but two things:
1) When i select YES tu put the name look the icon and the "???????"
and after that, NOTHING happens.
http://i215.photobucket.com/albums/cc147/derv1205/PokemonRubyU_02.png

2) When i put NOT when they ask me to put the name, i receive the
pokedex, but only there the script to receive the pokedex activates. :S
http://i215.photobucket.com/albums/cc147/derv1205/PokemonRubyU_01.png (Here i press "X")
http://i215.photobucket.com/albums/cc147/derv1205/PokemonRubyU_06.png
http://i215.photobucket.com/albums/cc147/derv1205/PokemonRubyU_10.png
So i have to MAKUHITAS -.-" and other thing, the pokeball didn't disappear :S
http://i215.photobucket.com/albums/cc147/derv1205/PokemonRubyU_11.png
PD: I didn't change the name in the first, i just put OK ^^
Help me please ^^

And one more thing ^^, in the script of Gym Leader,
-When i join the to scripts that are in the first page, i joined them and when i try them in the
rom, there is no Numel, there is only a Zigzagoon, and they never give me my Badge neither the
FireSton :S , only i defeat the girl and then Nothing...
-How do i choose the pokemons they will use after inserting the script?
Thanks

0m3ga_S1nn3r
December 22nd, 2007, 03:46 PM
ok so when i put the script in on AdvanceMapv1.82 and when i playe the game the writing is some wierd giberish language and it doesnt want to stop could some one help with this please.
.

cooley
December 22nd, 2007, 04:37 PM
Can Everyone Stop Spmming the ******* Thread. If you read, it says "DO NOT ASK QUESTIONS IN THIS THREAD". You should have guess that, since no one is answering you.

Try the simple Questions thread, or the Scripts Sharing and discussion thread.

0m3ga_S1nn3r
December 23rd, 2007, 01:28 AM
Hi, uhmm well i was wondering if you guys could tell me if this script is good or not cause its my first script so....here it is

#org $Startscript
Lock
Faceplayer
checkflag 0x200
if B_TRUE goto $Gotten
message $AskMe
$AskMe 1 = Hello, I've got this item that\pI dont really need\pWould you like it?
boxset 5
compare LASTRESUILT B_TRUE
if B_False goto $DontGet
giveitem 0xC8 1
setflag 0x200
Release
end

#ORG $Gotten
Lock
Faceplayer
heckflag 0x200
if B_TRUE goto $Good
message $Gotten
$Gotten 1 = Did this item help you?
boxset 5
compare LASTRESULT 1
if B_False goto $TooBad
release
end

#ORG $DontGet
Lock
Faceplayer
message $DontGet
$DontGet = Fine then you wont be getting\pthis LEFTOVERS!
boxset 6
release
end

#ORG $Good
Lock
Faceplayer
message $Good
$Good = YAY! I knew one day I could\phelp someone inneed!\p Here, I'll give you this\p
boxset 6
giveitem 0x19 99
release
end

#ORG $TooBad
Lock
Faceplayer
message $TooBad
$TooBad = Aww well, thing's happen.
boxset 6
release
end

how do we add sinnoh Pokemon to pokemon Emerald

jk-pingx
January 1st, 2008, 01:09 PM
ummm i was wondering if there was something wrong with the give item script because when i put yes it gives me the item but when i select no it still gives me the item. any suggestions?

HeroBlue
January 6th, 2008, 12:25 AM
There's a slight problem; when i save the notepad file as .RBC, as it's said that there should be a .buf file too, but there isn't. Also i got no "compile"-command in the .RBC-file.
There should be someone who knows this, heh.

UBCS
February 13th, 2008, 08:30 AM
I can't get this script to work.

Hellsing
February 13th, 2008, 01:37 PM
There's a slight problem; when i save the notepad file as .RBC, as it's said that there should be a .buf file too, but there isn't. Also i got no "compile"-command in the .RBC-file.
There should be someone who knows this, heh.

Pieman has an excellent tutorial on that, why doesn't anyone check it?
And most of these question aren't even related to pokescript, not to mention you aren't allowed to ask questions. Seriously, you'd think cooleys post would have stopped all this spam.

KoolGamesX
February 21st, 2008, 10:31 AM
Wow!Hope this helps!Thanks!

wingzro17
February 22nd, 2008, 09:45 AM
Is there a way to heal pokemon?

jamie.ds
February 22nd, 2008, 10:03 AM
hmm k thank you i shall try using this.

Leon Blade
February 23rd, 2008, 04:45 PM
Is there a way to heal pokemon?

Hello Wingzro17,

Yes there Is a way to heal Pokemon!
The keyword is: special I just forgot what you pass in lol.

GKS
March 3rd, 2008, 04:29 PM
Thanks a lot for this tutorial, it is a really good source if you want to script!

Fubb
March 28th, 2008, 03:07 AM
I tried t but it disdn't work! i even tried coppying and pasting YOUR script.
Please Help!!! When i test it out my character gets stuck and nothing appears!

BTW i am using leaf green and when i right click on the script it doesn't say compile.

Razer Rage
April 3rd, 2008, 07:46 PM
I must say this is a very good tutorial, but...I can't seem to find either Pokescript of PkmAdv Database. Where are they?

EDIT: Never mind, I found them via Google.

martauros
April 19th, 2008, 12:59 AM
irish witch, none of this links are working,
i think you should upload itto the new page

Dr Gregory House
April 19th, 2008, 03:14 AM
hi,

i just made this script, and it locks the player but then that's it...what's wrong with it?
also if you could tell me the values to put in to advance map...
THANKS


#org $start
lock
faceplayer
playsound 0x113
applymovement 0x8 $move
nop
trainerbattle 0 0x19E $before $after
playsound 0x113
message $beaten
boxset 6
applymovement 0x8 $move1
nop
release
end

#org $move
#raw 0x1F 0x1F 0x1F

#org $before
$before 1 = Hey \v\h01\...this gym was \ntoo easy...let's battle!

#org $after
$after 1 = Nice battle.

#org $beaten
$beaten 1 = How could you? Ugh...\nI'll beat you next time.

#org $move1
#raw 0x1D 0x1F 0x1F 0x1E 0x1F 0x1F 0x1E 0x1E 0x1E 0x1E 0x1E 0x1E

Master_Track
April 19th, 2008, 03:24 AM
after playsound you have to use "nop".

like
playsound 0x113
nop
applymovement etc...

and your applymovement "move" is wrong, there is 0xFE missing at the end, it can't happen if you don't write it.

and the second time you don't use playsound, but fadesound 0x113, again with nop in the next line.

oh, and the 0xFE is missing at the second movement too ;)

Dr Gregory House
April 19th, 2008, 04:58 PM
yeh i just made those changes but it still doesn't work...
do you think you could perhaps make a working copy and post it up?
i also don't know what variable ID's and such to put in advance map
thanks

Nikkie.
April 19th, 2008, 06:29 PM
I've learn to script prity fast xD i like this tutorial as its organised.

Nexed! xD

D-puff
April 25th, 2008, 02:58 PM
Wow, thanks! this tool is excellent, and the tutorial is very well made. Theres just one thing i cant figure out (unless i passed over it in the tutorial). Is there some sort of macro for the players name? so like if i say

"Oh, hello ---, how are you?"

Is there a way i can replace the '---' with whatever you named your character? Thanks in advance.

Edit- never mind, found it out. Again, awesome program...but the RSE movements file is gone! can someone upload/post the codes please?

Edit 2- alright, never mind, found that too. Apparently this isnt the place to ask code related questions, so i wont again here =p

cloudffvii2696
May 7th, 2008, 02:07 PM
Thanks! this guide helped me out a lot
but I still can't get my scripts to work....
It will freeze my game at some point.

Perfect_Palkia_10
May 10th, 2008, 03:20 AM
Hi. Great tutorial. I'm just wondering if anyone can check this? Its for a Gym Leader but when I win I don't get the badge

PhaizeD
May 10th, 2008, 01:10 PM
I'm having a slight problem with the script for giving an item for another.

Even though I have the lavacookie, it sends me to the nocookie message.

I even tried copying Irish Witch's script and it still sends me to the nocookie message.

Is there a problem with the script that a beginner wouldn't notice or something?

If anyone could tell me what's going on, It'd be much appreciated.

MoonlightUmbreon
May 17th, 2008, 03:45 AM
Hi, I'm just starting to learn how to script, and I just need to know a code to make someone say the player's selected name, like...

Hello ALEX, did you enjoy yourself?

I know how to make them talk, I just don't know how to make them say the player's name. Any help appreciated, thanks.

Master_Track
May 17th, 2008, 04:20 AM
message $whatever
$whatever 1 = Hello \v\h01, did you enjoy yourself?
boxset 6
release
end

^^

the hero is \v\h01, the rival is \v\h06.

MoonlightUmbreon
May 17th, 2008, 04:23 AM
Oh thanks, that's really helpful! ^^,

Da GaMeFrEaK
August 5th, 2008, 07:41 PM
Uh... Yeah, I'm new to this whole quoting thing, But I would like to place a complaint about the vanishing sprites thing by IrishWitch. Every Time I would make an item, It works out fine until I actually receive the item. The Sprite is supposed to disappear when you get the item. But mine won't disappear until I "refresh" the map. I also need the command that makes the person talking say the player's name. All replies will be extremely helpful. Other than that the rest of the tutorial was great!

Can someone make a simpler tutorial of Chapter 4 of Irish Witch's tutorial that's easier to understand? I would appreciate it. Irish Witch's tutorial is a little hard to understand...for a thirteen-year-old.

cooley
August 5th, 2008, 08:08 PM
Uh... Yeah, I'm new to this whole quoting thing, But I would like to place a complaint about the vanishing sprites thing by IrishWitch. Every Time I would make an item, It works out fine until I actually receive the item. The Sprite is supposed to disappear when you get the item. But mine won't disappear until I "refresh" the map. I also need the command that makes the person talking say the player's name. All replies will be extremely helpful. Other than that the rest of the tutorial was great!

Can someone make a simpler tutorial of Chapter 4 of Irish Witch's tutorial that's easier to understand? I would appreciate it. Irish Witch's tutorial is a little hard to understand...for a thirteen-year-old.
Why don't you go look more often?

thethethethe's Pokescript tutorial (http://www.pokecommunity.com/showthread.php?p=3759085)

Seriously, this tutorial shouldn't be revived...She's not coming back, at least for a while I think...Just use the other existing tutorials.

OutOfOrder
August 15th, 2008, 12:56 AM
this is a lot of information on th pokescript!

all i need is some program that can translate all that stuff to XSE. I WANT to use POKESCRIPT, but i heard it does not work for EMERALD VERSION. If it does then i will use it... if it does not then i would like to get a program or just some way to translat POKESCRIPT to XSE.

Thanks in Advance!

V.L.
August 16th, 2008, 05:27 PM
Great tutorial, and I'm pretty sure I get how to script basic things now... But once I save something as a .rbc I can't compile it. It doesn't show up when I right-click. Anyone know what's wrong?

<~F.M.P~>
August 17th, 2008, 09:43 PM
This is a very good tut. pretty complicated for now also. I've got alot of learning to do!

SkoolHaxz
September 1st, 2008, 12:11 AM
Damn.
When i go test my work.
Words goes stupid!
Help me.
BTW With stupid i mean
Not normal words.

The Assassin
September 1st, 2008, 03:49 AM
Ok this is messed up...Once i burned the script the first offset says: $showtext to 80045E, so the the bit i type into the offset section in advance map is $80045E...so i put that in and advance map says: No script editer defined....help please?

cooley
September 1st, 2008, 06:58 AM
Damn.
When i go test my work.
Words goes stupid!
Help me.
BTW With stupid i mean
Not normal words.
Dumb**** #1

Ok this is messed up...Once i burned the script the first offset says: $showtext to 80045E, so the the bit i type into the offset section in advance map is $80045E...so i put that in and advance map says: No script editer defined....help please?
Dumb**** #2

Simple as that...

The Assassin
September 1st, 2008, 07:54 AM
Dude stfu....I am new to all this so i need all the help i can get..and it doesnt help when people like you take the piss...

Binary
September 1st, 2008, 09:40 AM
Ok this is messed up...Once i burned the script the first offset says: $showtext to 80045E, so the the bit i type into the offset section in advance map is $80045E...so i put that in and advance map says: No script editer defined....help please?

You don't need need to open the script. You just have to put the offset their. And if you want to open the script. Goto settings>Choose script editor. Simple as that.

The Assassin
September 1st, 2008, 09:46 AM
Ok i tried that and now my rom wont load up :s im not sure if i put the right offset in is it the one at the top once burned?


EDIT: The bunch of numbers next to $showtext?

EDIT2: And when i added the offset (the $showtext) it doesnt work because i added a talking script and they dont talk...

Da GaMeFrEaK
October 6th, 2008, 04:44 PM
Me again. I just have one quick question. If I were to make a script that made a trainer dissappear after the battle, what would I do? I tried the "fadescreen 0" command, but my script didn't even get that far. Instead of the trainer being the one I created, it turned out to be a Team Aqua Grunt. I'm using the PET program from Helmetedrodent, or whatever it is, but i'm trying to get around that. Is there a way I can do this by using the PET program, or do I have to use the one provided by IrishWitch?

Blazichu
October 8th, 2008, 04:24 AM
No need to revive month old threads.

*Locks*