PDA

View Full Version : [Tutorial] Scripting Guide for Beginner Hackers


Νιτραμ
December 20th, 2007, 12:21 PM
Scripting Guide for Beginner Hackers
Yep, that's what beginners were waiting for.

Introduction
Some welcome stuff...

Welcome to this guide!

What will we do here? We will learn basic scripting and maybe, only maybe, advanced bits. This is a document to help you create more complex hacks, not only plain map or graphics changing ones. You know, we all have seen them and they aren't good. It's now your turn to change it. Every part of this guide will be in spoiler. If you need to e.g. go to bed cause it's too late, it's easier to just open a spoiler containing the desired section than scrolling whole page ;)

Contents
What will you learn here?
We will start with basic message displaying commands and later on we will progress to displaying player's and rival's name. We will learn to compare results in a YES/NO script. And we shall do a checkgender thingy, just for fun ;) This will be divided into two parts.

After that, we will start messing a bit with movement commands, meaning by explaining each and we will make a movement script.
As we want to make complex scripts we will start combinig our knowledge.
We will continue with flags. We will explain all three commands around flags. You will find out which ones they are down in the tutorial. We will also explain some pre-defined flags we will use in later scripts, as they will be unnecessary till you have Pokémon - we will use those flags when messing with giving a Pokémon.
We are almost in the giving item/Pokémon part, but we are still not there yet. Now we will play with special commands (and we will explain the national Pokédex trick) and then continue at the most anticipated part.
No, I won't let you go to giving Pokémon/item yet. We will have one feature not related to scripting before. Y ou will have the ability to test yourself after each section. You will get a task to make a script combining your current knowledge. You can complete each task and divide scripts into spoilers. I will check them later and tell you if you have the script correct. You may choose any of tthese tasks and let only one be reviewed. This is recommended.
Now you will learn about the part you've been waiting for: Giving a Pokémon. This is self explanatory, so I will give you further information in prper section.
We have the giving item part in fromt of us, we will mess with them a bit just for fun.

Now we will play with playing sounds. It will be fun and useful for a radio concept.
Now we will learn about changing weather. It will look dramatic ;) At least we should hope so :laugh:

Now you know everything you need for start, here is the final scripting task. It will be pretty hard, so you should be well-prepared and you will pass. I ask each of you who read this to make the script as a test after learning. If you complete the task well, you might earn a certificate of a well-trained beginner scripter. I will decide if I issue these as it may take more time than I planned, so I might only write it.NOTE: For quick release of this guide, I did only a few things and released them immediately. I will add chapters and to easily recognize, finished parts will be in bold.

Introduction to scripting, basic message commands etc.
Our "Hello World!" tutorial ;)

Let's start!

We all know that each and every tutorial needs to start with completely primitive things. And this tutorial ...will have a little exception. We will leasrn some advance bits in the very start of the tutorial. But first, we will say something about the first and most important line in the script. The offset.

Offsets and pointers

When making a script, the data needs to be stored in a free space of a ROM. The location of each and every byte is marked by an offset. It's a hex value representing the byte itself. It marks its position in the "row" For example a byte number 255 will have an offset 0x0000FF in common Pokémon Advance ROM.

That 0x tells the script parser that the offset isn't just random combination of letters and numbers, it's a specific number, unique in whole ROM. You cannot find two same offsets in a ROM, just many offests pointing to other one multiple times. These are called pointers. They are usually used when you need a separate offset for a part of script.

To let you understand better, I will show you in-game example. No video, though. It's recommended to look at it, but it's not needed, really.

Example

You suddenly become a very advanced scripter - use your imagination.

Now, you need to make a movement script - we will talk about these more deeply in the next section. You need to make a person move 3 steps left and one down. You need every single byte and so you search for the specific movement data... BINGO!

You found the data at offset 0x425FAC - this, in reality, contains completely different data and is used here only for demonstrational purposes.

So you point the command saying "Move a sprite XY using data at offset..." to the specified offset.
Defining an offset

We went too far when speaking about the first line. But it's good for something, anyway...

The very first command standing before the script offset is #org. How the whole line 1 looks like??

#org 0x******

Asterisks are representing the hex values. If you need some free offsets, I would recommend to move around the 800000 and higher. For your first script, we will use the offset 0x800000.

Sometimes, you need to lock moving person and make it face the player. You will do this with these two commands:

lock

faceplayer

That was easy, wasn't it? Well... you should only use these commands when interacting with moving people. You define the movement (like walking etc.) in your desired mapping program - AdvanceMap for example. I won't explain an furter cause it will be in my tutorial for absolute beginners, this one expects you to know the basic operations with AdvanceMap.

Message command

I won't explain that much as before. Just to warn you, we will start using the "pointer" term regularly, along with "offset". The command makes the game display text. The text will be stored at separate offset. The command uses a pointer to display the text stored in the other place. Basically, the script can start at offset 0x800000 and the message command points to the offset e.g. 0x100000 - again, it doesn't contain text data in real ROM. Back to the topic.

msgbox 0x******

Asterisks represent the offset. We will use 800100, as 800000 is the script start. It's space-wasting, but still, better than overwriting the data. Now, every message needs a boxset. We will use two or three types of boxset.

0x2 is normal boxset that closes after the text ends and you press a key. I think the boxset 0x6 does the pretty same thing. And 0x5 is the YES/NO boxset, we will talk about it in the last parts of this section.

We can use the boxset 0x* variant for the command, but I want you to know the older command name (I think). So the one mentioned above, or

callstd 0x*

Asterisk represents the boxset type. We will use 2 or 5 now, cause I have them tested and we will need no more. You will need to put only one thing if you want a simple script with oxset 0x2 or 0x6:

Now, when we know the basic things, we shall advance to 0x5 boxset and
comparing the answer. But, if you want this simple script, you should put in only one more command.

release

end

Now that it's nice! We have a script! But if you want the person speaking to be locked - not moving - and facing player, you should put in lock and faceplayer commands right after the #org command and release command right before end, as mentioned before. This is optional, so don't need to worry.

Now, when you define the offset of the message, you need to put one there. You do it this way:

#org 0x******
= Text goes here.

Don't forget to put a space between "=" and the text itself, or the message won't display. Change asterisks into the desired offset.

Scripting task 1
Create a simple message script. Use the lock, faceplayer and release commands.

21.12. 2007 - A little update!

Hey kids, we didn't finish yet ;) I am here to explain the 0x5 boxset a bit. It's the typical Yes/No boxset. To let the game recognize what did the player choose, you need to compare results.
We start with the boxset:

callstd 0x5

Now we add the comparing command:

compare LASTRESULT 0x*

LASTRESULT is a pre-defined command stating the last result to be compared to the value written in the script. Yes is 0x1, No is 0x0. You can replace the asterisk with 0 or 1 respectively then.
We have it compared, but now, what to do? We will put in a if and goto command. There is another command that you can use to return into the script, but we will learn about it later. So, now you need to put in:

if 0x* goto 0x******

The first hex value should state if yes or no. It means that if you compare the script to the Yes choice and want the script to go to another location if Yes wasn't chosen, you need to put 0 here. If you want to redirect the script after the player chose Yes, put in 0x1. And the 6 asterisks after the second hex value mean offset, as always.

Now, you know everything you need to successfully make a nice script with speaking and player interaction.

Almost everything. You need to know how to display player's name and rival's name with a variable. Scizz's Advance Text uses [PLAYER] and [RIVAL] command. As none of the compilers work with these (maybe PokéScript does, but I recommend not to use it although it might seem user-friendly) currently - HackMew's XSE should work with these, if my information is correct - we will need to use standard variables for now.
\v\h01 for player and \v\h06 for rival.

If you don't know how to put in the "\" sign, go to the character map or just copy it from here. Not confirmed on all keyboard sets, but Ctrl+Alt+Q might work. It does on Slovak keyboard I am using. I am from there and so I don't use naturally all English glyphs and signs such as apostrophes, so these shortcuts can be handy. Not working on English keyboard settings, tho. Maybe a useful thingy for non-English dudes and gals here at PC.

Okay, now we are really done with this tut, please wait till the holiday time ends (around 8th of January) and then, some more content might appear. Check this thread regularly for updates in the holiday time ;) The checkgender part will be here soon, maybe today evening ;) For now, a little scripting should be done from your side:

Scripting task 2
Create a Yes/No script. Use the lock, faceplayer and release commands.

derv1205
December 21st, 2007, 01:32 PM
Nice introduction, this tutorials would be in ScriptEd? , or in PoketScript?

/Circa
December 22nd, 2007, 12:18 AM
These scripts work in both programs, though I think there a some different commands and styles.

This is very detailed for just the basic commands Martin, well done.

cooley
December 22nd, 2007, 04:42 PM
Another scripting tutorial...If I was a Beginner I would Learn scripting that quick!
Good Job martin.

akash
December 23rd, 2007, 12:04 AM
Hey martin well I gave the offset for my first script as 0x800000 and then for my second script I gave the offset 0x800101 but then when I play the game both the scripts get mixed. Well take a look at it-

Well this is my first script for a boy:-
#org 0x800000
lock
faceplayer
message 0x800100
boxset 0x02
end
#org 0x800100
= Hello.\n ha!\p Aren't you \v\h01!\p Wow its a great plessure\n to meet you.\p Could I get your autograph\n \v\h01!\p Well, we have many things in common\n like.....\p our face meet.\n The other thing is \p Even I am a new trainer.\p Well by the way\n I am mathew and \p This is my best friend\n Pikachu\p Well I call it sparkie.
release
end

And here is my second script for a signpost:-
#org 0x8000101
message 0x800200
boxset 0x02
#org 0x800200
= Beware of pokemon.

Well the thing is when I talk to the boy he says everything correctly but in the end instead of saying 'Could I get your autograph' he says 'Could I get your beware of pokemon'. And when I try to go near the signpost the game hangs. So whats the problem with it. Thanks in advance.

Νιτραμ
December 23rd, 2007, 02:18 AM
Nice introduction, this tutorials would be in ScriptEd? , or in PoketScript?

I have nothing against Irish Witch and her programming efforts, but the scripting language is too far from the common ScriptED one. This guide will be for ScriptED and for HackMew's upcoming script compiler, XSE. Because both will work with same scripting language, but XSE will have enhanced command database. I will transition to XSE when it comes to the store xD

These scripts work in both programs, though I think there a some different commands and styles.

This is very detailed for just the basic commands Martin, well done.

Thank you. This guide was meant to be really detailed, beginners would never know what are they doing if they didn't know deeper meaning of the command itself.

Another scripting tutorial...If I was a Beginner I would Learn scripting that quick!
Good Job martin.

Thank you for your support. I will make a little banner to promote this guide, if you want, you can put it into your signature then.

Hey martin well I gave the offset for my first script as 0x800000 and then for my second script I gave the offset 0x800101 but then when I play the game both the scripts get mixed. Well take a look at it-

Well this is my first script for a boy:-
#org 0x800000
lock
faceplayer
message 0x800100
boxset 0x02
end
#org 0x800100
= Hello.\n ha!\p Aren't you \v\h01!\p Wow its a great plessure\n to meet you.\p Could I get your autograph\n \v\h01!\p Well, we have many things in common\n like.....\p our face meet.\n The other thing is \p Even I am a new trainer.\p Well by the way\n I am mathew and \p This is my best friend\n Pikachu\p Well I call it sparkie.
release
end

And here is my second script for a signpost:-
#org 0x8000101
message 0x800200
boxset 0x02
#org 0x800200
= Beware of pokemon.

Well the thing is when I talk to the boy he says everything correctly but in the end instead of saying 'Could I get your autograph' he says 'Could I get your beware of pokemon'. And when I try to go near the signpost the game hangs. So whats the problem with it. Thanks in advance.

You don't pay attentťion to script formatting. It doesn't matter, cause I will explain now ;)

Your first script is formatted in a different way than it should be. Fixed scripts with comments are here:

#org 0x800000
lock
faceplayer
message 0x800100 *Doesn't make any difference, but I would recommend using commands stated in the tutorial. But it's a matter of what are you used to.
boxset 0x02 *Would recommend simple 0x2
end *It shouldn't be there.
release
end

*The message should be here. Don't put it into the center of script, but 1 line after the script.
#org 0x800100
= Hello.\n ha!\p Aren't you \v\h01!\p Wow its a great plessure\n to meet you.\p Could I get your autograph\n \v\h01!\p Well, we have many things in common\n like.....\p our face meet.\n The other thing is \p Even I am a new trainer.\p Well by the way\n I am mathew and \p This is my best friend\n Pikachu\p Well I call it sparkie.


#org 0x8000101 800200 - Always leave at least 100 between two scripts.
message 0x800200 800300 Just fixing the offsets.
boxset 0x02
#org 0x800200 800300
= Beware of pokemon.

thethethethe
December 23rd, 2007, 04:34 AM
You don't pay attentťion to script formatting. It doesn't matter, cause I will explain now ;)

Your first script is formatted in a different way than it should be. Fixed scripts with comments are here:

#org 0x800000
lock
faceplayer
message 0x800100 *Doesn't make any difference, but I would recommend using commands stated in the tutorial. But it's a matter of what are you used to.
boxset 0x02 *Would recommend simple 0x2
end *It shouldn't be there.
release
end

*The message should be here. Don't put it into the center of script, but 1 line after the script.
#org 0x800100
= Hello.\n ha!\p Aren't you \v\h01!\p Wow its a great plessure\n to meet you.\p Could I get your autograph\n \v\h01!\p Well, we have many things in common\n like.....\p our face meet.\n The other thing is \p Even I am a new trainer.\p Well by the way\n I am mathew and \p This is my best friend\n Pikachu\p Well I call it sparkie.


#org 0x8000101 800200 - Always leave at least 100 between two scripts.
message 0x800200 800300 Just fixing the offsets.
boxset 0x02
#org 0x800200 800300
= Beware of pokemon.

I'll start with great tutorial Martin. It's really in depth and explains every clearly so that someone completely new to the concept of Hacking can understand.

Now onto akash's script, because of the bytes needed for the text, shouldn't the offsets you gave, be further apart?
The text of the first script would exceed that 100 gap that you made.
Sorry, about pointing this out, but I think it's better if you've actually given a working script, instead of a script with the same problem he had before.
I moved the message pointers to save a little more space.
#org 0x800000
lock
faceplayer
message 0x800010
boxset 0x02
release
end
#org 0x800010
= Hello.\n ha!\p Aren't you \v\h01!\p Wow its a great plessure\n to meet you.\p Could I get your autograph\n \v\h01!\p Well, we have many things in common\n like.....\p our face meet.\n The other thing is \p Even I am a new trainer.\p Well by the way\n I am mathew and \p This is my best friend\n Pikachu\p Well I call it sparkie.

#org 0x800150
message 0x800160
boxset 0x02
release
end
#org 0x800160
= Beware of pokemon.

Νιτραμ
December 23rd, 2007, 11:14 AM
Oh, sorry then, I just got used to putting 100 between each command... I usually don't pay closer attention to this... my fault. And thank you for support and fixing it :)


~Martin

изм
December 24th, 2007, 08:41 AM
Voila~~ Nice Tutorial i needed this will learn this soon~~ > lol :D

akash
December 24th, 2007, 09:09 AM
Thanks for the help. Well does anyone know how to make a give pokemon script and a trainer battle script in Script Ed using this tutorials commands.

TB Pro
December 24th, 2007, 09:58 AM
Ok here goes.
I am sooo a super n00b to scripting ^_^!
I tried out your tests and here they are
#ORG $800000
lock
faceplayer
boxset 0x05
compare LASTRESULT 0x00
If 0x01 goto 0x800001
release
end

#org 0x00
= Oh, Okay then.
release
end

#ORG 0x01
= Thank you so much!
release
end

Yes,
I know there is something wrong about it but....
I dont know what <_>!
So plz Help!
And my other one
#ORG 0x800100
lock
faceplayer
msgbox 0x800200
boxset 0x06
release
end

#ORG 0x800200
= Hi,/nare you new to this town?
release
end
So if anything is wrong with this plz point it out!

Νιτραμ
December 24th, 2007, 12:51 PM
@Blazikendude

Switch the $ sign with 0x and write in lowercase - commands.
And when writing out whole message offset, 0x01 isn't enough. You need to fill all out.

I will fix this for you, but last time. No one will get errors fixed before. You need to learn from other scripts too.

First, you need to put more space into your script. I think that for your script, 100 between offsets should do. Meaning that as a starting offset you would use 0x800000 and as a message offset you use 0x800100. And when you write the message, you must write out WHOLE offset: 0x800100, not 0x100 or 0x01 - the wrong one.

@akash

This will be explained in this guide, too, don't worry. But I have holidays and cannot stay on the computer for long - look, it's Christmas Eve and I am sitting in front of computer and answering questions.

The giving scripts and battling ones will be explained here, too, but those aren't a thing for beginner. Please don't try to ask in Script request forum, you will learn this with a bit of help in this guide, but I am planning to finish this guide in a month or more, but maybe sooner. And as those things you ask for belong to hardest scripting parts - mainly hardest to explain, you will have to wait a bit. Sorry.

@TotoMud

Thanks for support :)

akash
December 24th, 2007, 11:56 PM
Well thats ok Martin thanks and by the way MERY CHRISTMAS. And could you explain the yes/no script. I really didnt understand that. Well I saw the commands that came with elite map pack. In that I saw the give pokemon command. It was givepokemon iSpecies bLevel iItem. So should I just type that command in the script or should I give it some offset.

Νιτραμ
December 25th, 2007, 02:30 AM
Dear akash,

as I said, I will make guide for the givepokemon command. I am pretty sure you don't know what to replace those variables with correct numbers. Anyway, you would have to add some blank binary data but I am not sure how many, so I will need to check when writing the specific part of guide.

The Yes/No script is pretty well explained in the first part of the guide, but I will make up one here for you. I will comment the Yes/No part, so you might understand better.

#org 0x800000
msgbox 0x800100
callstd 0x5
compare LASTRESULT 0x1 - if player chose yes.
if 0x1 goto 0x800200 - if he did so, he will be redirected to 0x800200
msgbox 0x800400
callstd 0x2
end

#org 0x800200
msgbox 0x800300
callstd 0x2
end

'-----------------------------------------------------------

#org 0x800100
= Pick of the two options.

#org 0x800300
= You chose YES.

#org 0x800400
= You chose NO.

Hope this will do. The script is pretty easy to make, but you shouldn't get confused with the compare command. Try to compile this script in ScriptED and see how it works, and if it works. Merry Christmas!

EDIT: Don't forget to delete comments and the divider to make script work properly.

EDIT2: Ah, I made a mistake and the person doesn't behave correctly. Who will fix this for me? ;) I will certify the first 5 people as an official guide users and I will provide more information about my progress to him/her ;)

akash
December 25th, 2007, 05:17 AM
Well thanks Martin. Well I have another question. In elite map it says Ctrl+click to view the script. Then when I ctrl+click the script ed opens but it will be totally blank. So can you help me with this.

Νιτραμ
December 25th, 2007, 11:44 AM
ScriptED Troubleshooting

1. Help! My script doesn't compile/ When trying to load the script from game, it stays blank!

Simple solution. I guess you're using Windows (not Wine on Linux, I don't know a solution for that OS, although I know it a bit, used before). You need to open a folder. Any. Open Settings/Preferences - I don't know which one is correct translation - and choose Folder Options. There, click on the second tab. Find a checkbox "Hide extensions of registered file types" or something like that. Uncheck. Done. It should be okay now, worked for me since Win 2000.

TB Pro
December 25th, 2007, 02:46 PM
Hey Martin you forgot to put
Lock and
Faceplayer in your script....

akash
December 26th, 2007, 08:36 AM
Hey Martin its still not working. Well do you have any other ideas. I am using script ed. I have got windows XP.

akash
December 27th, 2007, 08:48 AM
Hey well I found a script in my folder and then I just changed the offsets and tried to compile it. But it said "Type missmatch." So could anyone help me. Well here is the script.
#org 0x8004EC
lock
faceplayer
checkflag 0x101
if 0x1 jump 0x800550
msgbox 0x8005B4 ' This is a renowned fishing spot.\nAre you getting the itch to
fish?
callstd MSG_YESNO ' Yes/No msg
compare LASTRESULT 0x1
if 0x1 jump 0x800618
compare LASTRESULT 0x0
if 0x1 jump 0x80067C
end
#org 0x800550
message 0x810000 ' Yo!\nHow's your fishing?
showmsg
multichoice 0x14 0x8 0x32 0x1
compare LASTRESULT 0x0
if 0x1 jump 0x810064
compare LASTRESULT 0x1
if 0x1 jump 0x820000
end
#org 0x810064
msgbox 0x820064 ' Is that right! That's great!\nHaul in some big ones!
callstd MSG_NOCLOSE ' Non-closing msg
release
end
#org 0x800618
msgbox 0x8100C8 ' I hear you, and I like what\nyou're saying!\pI'll give you on
e of my fishing RODS.
callstd MSG_NOCLOSE ' Non-closing msg
copyvarifnotzero 0x8000 0x106
copyvarifnotzero 0x8001 0x1
callstd MSG_OBTAIN ' Obtained the XXXXXX!
setflag 0x101
msgbox 0x81012C ' And, as an added bonus, I'll even throw\nin a little fishing
advice!\pFirst, you want to face the water,\nthen use the ROD.\pFocus your mind.
..\nIf you get a bite, pull on the ROD.\pSometimes you can snag something\nimmed
iately, but with bigger catches,\lyou need to time the pulls on your ROD\lto hau
l them in.
callstd MSG_NOCLOSE ' Non-closing msg
release
end
#org 0x80067C
msgbox 0x810190 ' Oh, is that so?\nThat's too bad, then.
callstd MSG_NOCLOSE ' Non-closing msg
release
end
#org 0x820000
msgbox 0x8200C8 ' Oh, hey, don't get down on yourself!\nI'll give you a little
fishing advice.\pFirst, you want to face the water,\nthen use the ROD.\pFocus yo
ur mind...\nIf you get a bite, pull the ROD.\pSometimes you can snag something\n
immediately, but with bigger catches,\lyou need to time the pulls on your ROD\lt
o haul them in.
callstd MSG_NOCLOSE ' Non-closing msg
release
end
#org 0x8005B4
= This is a renowned fishing spot.\nAre you getting the itch to fish?
#org 0x810000
= Yo!\nHow's your fishing?
#org 0x820064
= Is that right! That's great!\nHaul in some big ones!
#org 0x8100C8
= I hear you, and I like what\nyou're saying!\pI'll give you one of my fishing R
ODS.
#org 0x81012C
= And, as an added bonus, I'll even throw\nin a little fishing advice!\pFirst, y
ou want to face the water,\nthen use the ROD.\pFocus your mind...\nIf you get a
bite, pull on the ROD.\pSometimes you can snag something\nimmediately, but with
bigger catches,\lyou need to time the pulls on your ROD\lto haul them in.
#org 0x810190
= Oh, is that so?\nThat's too bad, then.
#org 0x8200C8
= Oh, hey, don't get down on yourself!\nI'll give you a little fishing advice.\p
First, you want to face the water,\nthen use the ROD.\pFocus your mind...\nIf yo
u get a bite, pull the ROD.\pSometimes you can snag something\nimmediately, but
with bigger catches,\lyou need to time the pulls on your ROD\lto haul them in.

Thanks in advance.

thethethethe
December 27th, 2007, 11:36 PM
Hey well I found a script in my folder and then I just changed the offsets and tried to compile it. But it said "Type missmatch." So could anyone help me. Well here is the script.
#org 0x8004EC
lock
faceplayer
checkflag 0x101
if 0x1 jump 0x800550
msgbox 0x8005B4
callstd 0x5
compare LASTRESULT 0x1
if 0x1 jump 0x800618
compare LASTRESULT 0x0
if 0x1 jump 0x80067C
end

#org 0x800550
message 0x810000
callstd 0x4
multi 0x14 0x8 0x32 0x1
compare LASTRESULT 0x0
if 0x1 jump 0x810064
compare LASTRESULT 0x1
if 0x1 jump 0x820000
end

#org 0x810064
#raw 0x68
msgbox 0x820064
callstd 0x6
release
end
#org 0x800618
msgbox 0x8100C8
callstd 0x4
copyvarifnotzero 0x8000 0x106
copyvarifnotzero 0x8001 0x1
callstd 0x0
setflag 0x101
msgbox 0x81012C
callstd 0x4
#raw 0x68
release
end
#org 0x80067C
msgbox 0x810190
callstd 0x4
#raw 0x68
release
end

#org 0x820000
msgbox 0x8200C8
callstd 0x4
#raw 0x68
release
end

#org 0x8005B4
= This is a renowned fishing spot.\nAre you getting the itch to fish?

#org 0x810000
= Yo!\nHow's your fishing?

#org 0x820064
= Is that right! That's great!\nHaul in some big ones!

#org 0x8100C8
= I hear you, and I like what\nyou're saying!\pI'll give you one of my fishing RODS.

#org 0x81012C
= And, as an added bonus, I'll even throw\nin a little fishing advice!\pFirst, y
ou want to face the water,\nthen use the ROD.\pFocus your mind...\nIf you get a bite, pull on the ROD.\pSometimes you can snag something\nimmediately, but with bigger catches,\lyou need to time the pulls on your ROD\lto haul them in.

#org 0x810190
= Oh, is that so?\nThat's too bad, then.

#org 0x8200C8
= Oh, hey, don't get down on yourself!\nI'll give you a little fishing advice.\p
First, you want to face the water,\nthen use the ROD.\pFocus your mind...\nIf you get a bite, pull the ROD.\pSometimes you can snag something\nimmediately, butwith bigger catches,\lyou need to time the pulls on your ROD\lto haul them in.

Thanks in advance.

You're better off learning to write your own scripts than just taking them from other places. I haven't checked all the offsets, but if they're all ok(since, they're all so far apart), the script should work now.

akash
December 28th, 2007, 02:53 AM
Well ok thanks thethethethe. Man scripting is becoming a bit easy but still can't understand big scripts.

akash
December 29th, 2007, 10:59 PM
Hey can anyone tell me whats wrong with this script. It is an item script. Well here it is, the script-

#org 0x850000
copyvarifnotzero 0x8000 0xD
copyvarifnotzero 0x8001 0x1
callstd 0x6 ' PLAYER found one XXXXXX!
end

Thanks in advance.

/Circa
December 29th, 2007, 11:02 PM
You should stick too asking these in the scrapbox, but i'll do it anyway...

#org $begin
lock
faceplayer
giveitem 0xD 0x1
message $getitem
boxset 0x6
#raw 0x53
release
end

#org $getitem
= You found a XXXXXXX!

That is a basic item script..

thethethethe
December 29th, 2007, 11:53 PM
You should stick too asking these in the scrapbox, but i'll do it anyway...

#org $begin
lock
faceplayer
giveitem 0xD 0x1
message $getitem
boxset 0x6
#raw 0x53
release
end

#org $getitem
= You found a XXXXXXX!

That is a basic item script..

In Scripted there is no Give Item command. That's why akash's script is written like that. What's written in akash's script is what's done in by giveitem. This is a scriptED tutorial so a some things are going to be different to what you might know, pokescript-wise.

Hey can anyone tell me whats wrong with this script. It is an item script. Well here it is, the script-

#org 0x850000
copyvarifnotzero 0x8000 0xD
copyvarifnotzero 0x8001 0x1
callstd 0x6 ' PLAYER found one XXXXXX!
end

Thanks in advance.
Like Crashlink said, you should just have posted this in the script thread in the scrap box, especially since, this has been covered in the tutorial yet.

But It should be like this.....
copyvarifnotzero 0x8000 0xD
copyvarifnotzero 0x8001 0x1
callstd 0x0

Νιτραμ
December 30th, 2007, 07:30 AM
Oh, long time, no see, guys.

I would like to ask you to only post task-related scripts here, or I will ask a moderator to lock up this thread and there will be no guide. Blazikendude, you're right, I didn't put a lock and faceplayer, along with release command in the end, you will now recieve ocassional PMs with guide status. Akash, I have no clue what's wrong with ScriptED, why it isn't working. It happened to me till I didn't turn off the Windows feature mentioned in the troubleshooting. I cannot help you then.

Please, all of you, stay tuned on updates ;)

akash
December 31st, 2007, 03:48 AM
Well thanks thethethethe. And martin its ok cuz I downloaded PKSV. Well thanks anyways. HAPPY NEW YEAR.

Νιτραμ
December 31st, 2007, 12:34 PM
Happy new year, people! And look forward to the new part! Checkgender and start of tutorial 2!

thethethethe
January 7th, 2008, 04:25 AM
checkgender 0x*

Asterisk represents either 0 or 1 where 0 is male, 1 is female.


Just a little response to this statement. Checkgender only needs one byte to work, A0, If you were to add an extra byte to the end of it, it would just act as a nop and just be wasted space, wouldn't it? It wouldn't really do anything. The compare is supposed to be what checks if it's boy or girl. Like you said 0x0=male, 0x1=female.

But I guess, I'd better ask, does it work this way too, becasue that's whats important?

Νιτραμ
January 9th, 2008, 12:38 PM
Ah, I see. I know what you mean now. It seems that I just misplaced that. *corrects*

Thanks :)

And yes, it worked last time I used it that way. But anyway, I have wrong statemet there, and that's what I don't want.

EDIT/REPOST: The guide was accidentally deleted, a little problem occured. Now... The guide is restored - big thanks to Hiroshi Sotomura for his kindness and mainly for restoration of the guide.

Checkgender Guide
You might sometimes need to check if player chose male or female gender in the start. It can be handy when you want to call someone "dude" or "chick" - you know, it would be silly i a boy named e.g. Travis was called "chick" :D No, we cannot let that this way. There is a command that checks gender.

checkgender

You need to use compare command again.

compare LASTRESULT 0x*

Asterisk represents either 0 or 1 where 0 is male, 1 is female.

So, look at the example. If you wnat to put this into a script, don't forget to replace 0xoffset with valid offset e.g. 0xB00000

#org 0xoffset
lock
faceplayer
checkgender
compare LASTRESULT 0x1 - if player is female, then
if 0x1 goto 0xoffset2 - go to offset
... - if player is male, script continues normally.
release
end

#org 0xoffset2
...
release
end

As you should know basic message commands, I didn't put them into the example. If you want, you can try to make a script and then post it here to be checked.

TB Pro
January 11th, 2008, 03:01 PM
Okay,
Here goes!
I'm a little rusty sooo...
#org 0x800000
lock
faceplayer
checkgender
compare LASTRESULT 0x1
goto 0x800200
boxset 6
0x800000 = Hi, Man!/n Wats up?
release
end

#org 0x800200
0x800200 = Hey, Girl!/n How's it goin'?
release
end

/Circa
January 12th, 2008, 12:40 AM
I think your beginning to understand this...
I've also realised my old PokeScript scripts didn't work because they were made as ScriptEd scripts xD

I think it should look like this:

#org 0x800000
lock
faceplayer
checkgender
compare LASTRESULT 0x1
goto 0x800200
boxset 0x06
message 0x800100
boxset 0x06
release
end

#org 0x800100
= Hey dude!\n Whats up?

#org 0x800200
= Hey girl!\n Hows it going?

I didn't really know where to put the boxsets, so I experimented a little.

Νιτραμ
January 12th, 2008, 12:55 PM
You corrected it, but your correction needs a correction, too ;) Don't worry, it won't hurt that much.

#org 0x800000
lock
faceplayer
checkgender
compare LASTRESULT 0x1
if 0x1 goto 0x800200
message 0x800100
callstd 0x6
release
end

#org 0x800100
= Hey dude!\n What's up?

#org 0x800200
msgbox 0x800300
callstd 0x6
release
end

#org 0x800300
= Hey girl!\n How's it going?

It is better now. Mainly because you cannot put the goto command pointing directly to a message.
And I replaced boxsets with callstd. It will sure work with both ways, but I like callstd more :D

And I know now why there was amistake with the goto command, I forgot to put in the "if" routine. It's fixed in the guide, now.

And Blazikendude, FORGET EVERYTHING YOU LEARNED WITH POKéSCRIPT TUTORIALS. ScriptED's language is pretty much different so don't mix up the two. It may work in Pokéscript but it WON'T WORK IN SCRIPTED.

/Circa
January 12th, 2008, 08:19 PM
Thanks for fixing that, I was thinking about if the goto needed an "if", and it bothered me quite a bit xD.
I can tell that ScriptEd is alot different from PokeScript xD.

Νιτραμ
January 13th, 2008, 12:36 PM
And therefore I don't recommend using the two at the same time. You should choose if you want to stay with one or another, and that should be definitive. Personally, I have nothing against Irish Witch, but I don't like the mess Pokéscript caused amongst ScriptEd usera and therefore I strongly recommend to use ScriptEd instead. Everyone who isn't sure how to write out commands in ScriptEd can freely look in this guide and the content will expand with enough feedback.

/Circa
January 13th, 2008, 03:35 PM
Alright, can I use #raw and specials in ScriptEd?
That would help me replace commands I don't know.

TB Pro
January 13th, 2008, 04:45 PM
What does a #RAW command do anyway?
I never quite found out what they do.

/Circa
January 13th, 2008, 04:52 PM
Well, a #raw command is sought of like a hex command, instead of using the proper command in the program, you use a hex code if you don't know the actual command or if it wont work. In all programs there are no movements called ; left, right, up or down. They are #raw's. Atleast that's what I learnt O.o

TB Pro
January 13th, 2008, 05:05 PM
Oh!
Thank you Carshink!
You are the only person who atually awnsers my n00bish scripting questions!
Thank you so much!
Now are you saying that #RAW commands are movement commands?
Anyways,
I thank you so much!

thethethethe
January 13th, 2008, 05:45 PM
Alright, can I use #raw and specials in ScriptEd?
That would help me replace commands I don't know.

Of course. "special" is a command common between both scriptED and pokescript. And #raw can be used in both.
But Martin² might correct me here... but in pokescript, you can use #raw's like this...
#raw 0x53 0x0F 0x80
But it needs to be used like this in ScriptED...
#raw 0x53
#raw 0x0F
#raw 0x80

Oh!
Now are you saying that #RAW commands are movement commands?
Anyways,
I thank you so much!

#raw commands are anything. Movements are #raw's. All commands are #raw's. Let me put it this way. Here's a normal script.
#org 0x800000
#raw 0x6A
#raw 0x5A
#raw 0x0F
#raw 0x00
#raw 0x0D
#raw 0x00
#raw 0x80
#raw 0x08
#raw 0x09
#raw 0x06
#raw 0x6C
#raw 0x02
This script in #raw's will do the exact same thing as this script below. (I left out pointers)
#org 0x800000
lock
faceplayer
message 0x80000D
boxset 6
release
end
Scripting in hex is the same as Scripting in #raw's.

TB Pro
January 13th, 2008, 06:09 PM
Oh I see.
So #RAW's are just...
Anything.

Jayster23
January 13th, 2008, 11:57 PM
Im the biggest n00b at scripting so can you tell me where i can get the tools

/Circa
January 14th, 2008, 12:23 AM
Go to toolbox and then Temporary Tool Resource, scroll down and download my starter package. Though this isn't the place too ask it, if you searched a little i'm pretty sure you would of found it ..

Νιτραμ
January 14th, 2008, 06:35 AM
Okay guys, thanks for answering the questions, as I don't have time for this (exams). So, yes, you can use raws, but it should be written the way thethethethe stated. The one for ScriptED, of course. And I would like to ask anyone for not posting things unrelated to this guide and writing scripts (writing, not using scripting tools). I would be really grateful. Thanks guys (Crashink, thethethethe, Blazikendude) for being active here, I will release next part of guide this week.

~Martin

Scorp Con
February 6th, 2008, 12:52 PM
Awesome tutorial, I've being reading it yesterday... but how do you put the script into the rom (Windows XP)?

2and2makes5
February 6th, 2008, 05:23 PM
This is a great tutorial, but can you give a working example of a Yes/No script? For some reason, my script just leaves the question on the screen, and nothing happens. Here's my script so you can see what's wrong with it:

#org 0x800100
lock
faceplayer
msgbox 0x800110
callstd 0x5
compare LASTRESULT 0x1
if 0x1 goto 0x800120
msgbox 0x800140
callstd 0x2
release
end

#org 0x800120
msgbox 0x800130
callstd 0x2
release
end

#org 0x800110
= Can you pick YES or NO?

#org 0x800130
= YES!

#org 0x800140
= No!

This is just a test to see if I can get it to work. Thanks in advance! :)

Scorp Con
February 6th, 2008, 08:26 PM
#org 0x800000
Lock
Faceplayer
msgbox 0x800100
callstd 0x5
compare LASTRESULT 0x1
if 0x1 goto 0x800200
msgbox 0x800400
callstd 0x2
end

#org 0x800200
msgbox 0x800300
callstd 0x2
end

#org 0x800100
= Can you pick YES or NO?.

#org 0x800300
= YES!

#org 0x800400
= No!
Just fixed the offsets...

The offset should have at least 100 between each other...

Νιτραμ
February 6th, 2008, 11:29 PM
Awesome tutorial, I've being reading it yesterday... but how do you put the script into the rom (Windows XP)?

If you use ScriptED, there's no problem doing it. You need to set an option to show file's extension (Open some folder - best My Documents - Tools-> Folder options ->Appearance - I think - and there should be checkbox "Hide extensions of registered filetype". Uncheck it.)

Now, back to your ScriptED window and click on the Compile button. There will pop a browse dialog. Find your ROM and doubleclick it. There will pop a Notepad window with a script log, you should check if it didn't find any errors there.

Now, when it's written there, you need to open AdvanceMap. Open the map where you want your event be put in, click on the sprite or trigger and now, on the right side, there should be a sidebar. Find the box labeled Script offset. Write there $ followed by the script's offset number (e.g. $800000). Save your ROM, open it in VBA and test it.

If it goes okay, congrats. If not, post a screenie.


This is a great tutorial, but can you give a working example of a Yes/No script? For some reason, my script just leaves the question on the screen, and nothing happens. Here's my script so you can see what's wrong with it:

#org 0x800100
lock
faceplayer
msgbox 0x800110
callstd 0x5
compare LASTRESULT 0x1
if 0x1 goto 0x800120
msgbox 0x800140
callstd 0x2
release
end

#org 0x800120
msgbox 0x800130
callstd 0x2
release
end

#org 0x800110
= Can you pick YES or NO?

#org 0x800130
= YES!

#org 0x800140
= No!

This is just a test to see if I can get it to work. Thanks in advance! :)

You got this fixed by Madridista, and thanks for comment.
#org 0x800000
Lock
Faceplayer
msgbox 0x800100
callstd 0x5
compare LASTRESULT 0x1
if 0x1 goto 0x800200
msgbox 0x800400
callstd 0x2
end

#org 0x800200
msgbox 0x800300
callstd 0x2
end

#org 0x800100
= Can you pick YES or NO?.

#org 0x800300
= YES!

#org 0x800400
= No!
Just fixed the offsets...

The offset should have at least 100 between each other...


Your statmemnt is partly fine, mainly for short scripts. You won't need to do this always... cause when HackMew's XSE (a script editor that uses same language as ScriptED, but much better) will be released, you wil be amazed how easy will scripting be with dynamic offsets (I know Pokéscript already has that, but the dynamic offset ipmlementation will be better over here, and mainly, you will be able to easily use ScriptED language used in this guide).

Scorp Con
February 7th, 2008, 12:26 AM
I don't think u need a screenshot...

When I tried to talk to the person, nothing happeneds...

Script:

$org 0x800000
Lock
Faceplyaer
msgbox 0x800100
callstd 0x6
release
end

#org 0x800100
= Hi mate!

/Circa
February 7th, 2008, 12:52 AM
I don't think u need a screenshot...

When I tried to talk to the person, nothing happeneds...

Script:

$org 0x800000
Lock
Faceplyaer
msgbox 0x800100
callstd 0x6
release
end

#org 0x800100
= Hi mate!

Not really any problems, just a few typos.

#org 0x800000
lock
faceplayer
message 0x800100
callstd 0x6
release
end

#org 0x800100
= Hi Mate!

Scorp Con
February 7th, 2008, 12:49 PM
Ok, but still nothing happeneds...

That's how I putted into the room.
ScriptED -> Paste Script -> Compile -> Double Click on rom (FR) -> A-map -> Pallet town - > Events -> Click on sprite -> right hand side, Script offset, write $800000 -> Close it and save it

Νιτραμ
February 7th, 2008, 01:39 PM
@Crashink: msgbox was the first used in ScriptED. It can be used.

@Madridista. You use WinXP, right? So show the file extensions as I instructed you. It will work after next compiling.

Yoshimi
February 7th, 2008, 05:29 PM
Please stop posting stuff like whats wrong with your scripts.
As everyone else said, do that in the scrapbox.
And thanks Martin

Scorp Con
February 7th, 2008, 08:31 PM
I already did that (uncheck "Hide..."), and it still doesn't work...

Shadowz
February 8th, 2008, 08:10 AM
Im sorry for being such a noob but when i try to open scriptED, it says SmartMenuXp.ocx is not registered or invalid. What should i do?

Νιτραμ
February 8th, 2008, 10:46 AM
Search for it with Google. I really don't know.

As for NIN, this thread is made for showing pratcical tests I put into my guide and ask question with scripts. I don't have much time to do the complete guide, so I will answer questions instaed, and later, I will make a summary.

Madridista... sorry, I cannot help you. I don't know what's wrong.

wingzro17
February 9th, 2008, 10:51 AM
Thats like very advanced scripting using offsets.
Good job!

Νιτραμ
February 10th, 2008, 10:45 AM
OMG, that's the complete basics what's here. Offset is the main thing you need when want a script, advanced or not.