• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Sierra's MEGA-HUGE XSE Scripting Tutorial

TooSkilled

ROM Hacker/Shiny Hunter
3
Posts
13
Years
  • Age 26
  • Seen Dec 15, 2021
I am trying to make a starter Pokemon script. It should go: Try to walk out door, person is standing in front of it, you talk to them, they give you pokemon, they disappear. So far I have this
Code:
#org $start
lock
faceplayer
checkflag 0x828
if 0x01 goto @done
msgbox @get 5
@get 1 = You need protection.\pTake this EEVEE!
givepokemon 133 5 0x8B
setflag 0x828
release
end

#org @done
msgbox @given 5
@given 1 = Take care of EEVEE.
release
end
The error I am getting is "Unknown keyword get at Line 7"
Could I please get some help with this :)
 
28
Posts
12
Years
  • Seen May 1, 2022
I am trying to make a rival battle script, i took a break from scripting due to finals and family stuff and forgot a lot (since i was still a beginner when i left). I can not find a good XSE tutorial for doing it (i do not see how to make one in this guide). Can anyone direct me to a good link. By rival battle i mean you walk somewhere and a person walks over to you, battles you, and disappears. Thanks for any help.
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
I don't know if this problem was previously brought up.
I copied the exact message script code and put it in (with text alterations). When I played it on the ROM, all it would do is turn the person to me and play the little beep noise it normally does, but no textbox or anything.
What did/do I do?

#dynamic 0x800000
#org @start
lock
faceplayer
msgbox @1 0x6
release
end

#org @1
= Testing.

That generally happens if you are using the 1.0.0 version of XSE. Here is a link to version 1.1.1 which should run that script just fine.

I am trying to make a starter Pokemon script. It should go: Try to walk out door, person is standing in front of it, you talk to them, they give you pokemon, they disappear. So far I have this
Code:
#org $start
lock
faceplayer
checkflag 0x828
if 0x01 goto @done
msgbox @get 5
@get 1 = You need protection.\pTake this EEVEE!
givepokemon 133 5 0x8B
setflag 0x828
release
end

#org @done
msgbox @given 5
@given 1 = Take care of EEVEE.
release
end
The error I am getting is "Unknown keyword get at Line 7"
Could I please get some help with this :)

The problem is with the '@get' as it is not a command, but a dynamic offset which the command msgbox will be pointing to. Just transfer it to later in the script like this:

Code:
#org $start
lock
faceplayer
checkflag 0x828
if 0x01 goto @done
msgbox @get 5
givepokemon 133 5 0x8B
setflag 0x828
release
end

#org @done
msgbox @given 5
release
end

#org @get
= You need protection.\pTake this EEVEE!

#org @given
= Take care of EEVEE.

I am trying to make a rival battle script, i took a break from scripting due to finals and family stuff and forgot a lot (since i was still a beginner when i left). I can not find a good XSE tutorial for doing it (i do not see how to make one in this guide). Can anyone direct me to a good link. By rival battle i mean you walk somewhere and a person walks over to you, battles you, and disappears. Thanks for any help.

The basic goal of scripting tutorials like this one is to introduce you to a wide range of commands, what they do and how you construct them, rather than provide a working model where you just need to change things like the movement and flags. I would advise that you look at examples in the actual games to learn what that would look like.

That being said, an extremely basic rival battle script would look something like this:

Code:
#dynamic 0x800000

#org @start
checkflag 0x200
if 0x1 goto @skip
msgbox @talk1 0x2
applymovement 0x1 @moveforward
waitmovement 0x0
trainerbattle 0x1 0x20 @before @after @later

#org @later
msgbox @talk2 0x2
applymovement 0x1 @walkaway
waitmovement 0x0
hidesprite 0x1
setflag 0x200
release
end

@org @skip
release
end

#org @talk1
= Hey! I'm [RIVAL]!

#org @before
= I'm going to beat you!

#org @after
= Huh? I lost?

#org @talk2
= Whatever, I'll see you around.

#org @moveforward
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0xFE

#org @walkaway
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE
 
Last edited:

johnr754

I am JOHN, heck yeah!
78
Posts
14
Years
Whenever I try to compile this script:

Spoiler:

Whenever I try to compile it in Emerald, it says that it's missing #define or #parameter in line 8.
 

johnr754

I am JOHN, heck yeah!
78
Posts
14
Years
Okay, the script compiled. But when I tried to battle, instead, it made it's cry and dissapeared. When I re-entered, the sprite came back.

Here's my edited script:

Spoiler:
 
1
Posts
11
Years
  • Age 25
  • Seen Nov 30, 2012
This is a great tutorial, thanks for posting.
Only problen is I cant see what you have to change with Apply Movement comand so it works.
 
3
Posts
14
Years
  • Seen Mar 9, 2015
Can someone PLEASE tell me how to make a movement script never happen again?
I'm using the kind of movement script where you step on a tile to activate, i want it to stop happening after one time any help? :(
 

Satoshi Ookami

Memento Mori
14,254
Posts
15
Years
Okay, the script compiled. But when I tried to battle, instead, it made it's cry and dissapeared. When I re-entered, the sprite came back.
Does the OW have 200 in ID bar? It must have, otherwise it will keep on coming back.

Can someone PLEASE tell me how to make a movement script never happen again?
I'm using the kind of movement script where you step on a tile to activate, i want it to stop happening after one time any help? :(
setvar 0xsomething 0x1
And then put that something (which is 4 digit number by the way) into var number bar of the tile script.
 

Satoshi Ookami

Memento Mori
14,254
Posts
15
Years
I need to use your giveegg command. I kind of figured out that the list I have isn't the right numbers. Although they worked with just giving Pokemon.hmm?
You need to use numbers in hex.
For example if you want to give an egg with Caterpie (number 10) you need to use "giveegg 0xA 0x1" because A is 10 in hex.
 
142
Posts
15
Years
Okay Im getting confused, I followed the givepokemon script as shown, but everytime I talk to who Im suppose to recieve the Pokemon from, it just skips to the dialogue that takes place after receiving it, even though I never got it yet. What am I doing wrong?
 

Renegade

Time for real life...
995
Posts
12
Years
Okay Im getting confused, I followed the givepokemon script as shown, but everytime I talk to who Im suppose to recieve the Pokemon from, it just skips to the dialogue that takes place after receiving it, even though I never got it yet. What am I doing wrong?

Can you please post your script?
 
8
Posts
11
Years
  • Seen Apr 28, 2013
Glitching

So I have a very simple script ( not completed )
what it does it once you take a couple steps from your door, your rival shows and and leads you to pick pokemon.
however if I save this file, it glitches and gives me this.
Spoiler:


Instead of this!
Spoiler:


What seems to be the problem?
 
8
Posts
11
Years
  • Seen Apr 28, 2013
Never, never, NEVER replace existing scripts.
Repoint your script.
In other words, when you compile your script use #dynamic 0x800000 (or something) to find free space.
What is 0x800000 exactly? and I did use "Find Bytes" and used those on everything in that script :P
At this point I'm thinking, is it possible to overwrite itself if compiled multiple times?
 

tajaros

Hi I'm dawg
855
Posts
11
Years
What is 0x800000 exactly? and I did use "Find Bytes" and used those on everything in that script :P
At this point I'm thinking, is it possible to overwrite itself if compiled multiple times?

0x800000 is where a lot of free space in the ROM is found, almost all scripters use that free space to insert their scripts... :)

You know why your script is messed up? It's because you replaced an offset already used by the game... :) XSE provides safety and messes up the scripts if it's memory is larger than before... :)

Would you like me to explain more? Ok, .... :)

For example you have numbers 1-10 and in those ten numbers offset 0x16596D is placed, and then you add a number/(edit the script and the memory is larger than before) so it will be 11, in that case XSE doesn't allow that and just messes the script up so that it will still fit in 1-10... :) (That's what's in my mind.. xD)

Also if you don't want to script in offset 0x800000 you can use 0x900000, 0xA0000, and any above offset that have free space... :)

So just input 0x800000 next to the dynamic command, so it will be dynamic 0x800000 don't worry if there's already a memory higher than that offset, XSE will find some free-space where your script fits and places it there... :)

If you want to edit older scripts you can just repoint their offsets, for example your first pointer has offset 0x8234A4 then replace it with a pointer like "@pointer" and anything else so that when the memory is bigger XSE will find free-space again... :)

(I don't know if this is right but, this is what in my head xD)
 
8
Posts
11
Years
  • Seen Apr 28, 2013


0x800000 is where a lot of free space in the ROM is found, almost all scripters use that free space to insert their scripts... :)

You know why your script is messed up? It's because you replaced an offset already used by the game... :) XSE provides safety and messes up the scripts if it's memory is larger than before... :)

Would you like me to explain more? Ok, .... :)

For example you have numbers 1-10 and in those ten numbers offset 0x16596D is placed, and then you add a number/(edit the script and the memory is larger than before) so it will be 11, in that case XSE doesn't allow that and just messes the script up so that it will still fit in 1-10... :) (That's what's in my mind.. xD)

Also if you don't want to script in offset 0x800000 you can use 0x900000, 0xA0000, and any above offset that have free space... :)

So just input 0x800000 next to the dynamic command, so it will be dynamic 0x800000 don't worry if there's already a memory higher than that offset, XSE will find some free-space where your script fits and places it there... :)

If you want to edit older scripts you can just repoint their offsets, for example your first pointer has offset 0x8234A4 then replace it with a pointer like "@pointer" and anything else so that when the memory is bigger XSE will find free-space again... :)

(I don't know if this is right but, this is what in my head xD)

So basicly dynamic 0x800000 = auto find bytes?
 
18
Posts
11
Years
  • Seen Aug 15, 2012
I'm sorry but it tried your give pokemon script a shot, it went horribly wrong.

I even fixed some part of the script though so no worry's, some parts are misleading.


Here's the script i have so far:

Code:
#dynamic 0x34EEC1

#org @start
checkflag 0x900
msgbox @1 0x5
if 0x0 goto @take
compare LASTRESULT 0x1
if 0x1 goto @done
msgbox @2 0x6
release
end

#org @take
givepokemon 0x6 0x24 0x0 0x0 0x0 0x0
fanfare 0x13E
msgbox @3 0x4
waitfanfare
closeonkeypress
setflag 0x900
msgbox @4 0x5
compare LASTRESULT 0x1
if 0x1 gosub @name
msgbox @5 0x6
release
end

#org @name
call 0x1A74EB
return

#org @done
msgbox @2 0x6
release
end

#org @1
= Oh you don't have a strong\npokemon to take on the trainers?

#org @2
= Nevermind then.

#org @3
= [black_fr]You received a Charizard!

#org @4
= [black_fr]Would you like to give a\nnickname to Charizard?

#org @5
= Have fun!

#org @6
= Did you beat them yet?


I just need some help with clearing the flag, whenever i talk to the person i got the Charizard from, i can get more of them, in other words it keeps repeating the script.

Any advice on how to stop the script after i got the Charizard?
 
Last edited:

Satoshi Ookami

Memento Mori
14,254
Posts
15
Years
Any advice on how to stop the script after i got the Charizard?
The problem is with checkflag command because it checks the flag but the result isn't used.

Code:
#org @start
checkflag 0x900
[COLOR="red"]if 0x1 goto @ending org[/COLOR] 
msgbox @1 0x5
[COLOR="red"]compare LASTRESULT 0x1[/COLOR] //You are testing whether the player chose yes
if 0x[COLOR="Red"]1[/COLOR] goto @take
if 0x[COLOR="red"]0[/COLOR] goto @done
msgbox @2 0x6
release
end

#org @ending org
//You need to add that ending org. It could be something like message box with "I've already given you a Charizard, don't be greedy."...

Oh yeah, and that offset you use with #dynamic looks... weird...
Oh and one thing... newest XSE does not work with LASTRESULT, you may need to change it to 0x800D.
 
Back
Top