• 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?".
  • 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.

RaiRai-kun's XSE Tutorial [Updated Big-Time!]

Status
Not open for further replies.

.Seth

.explorer.
1,644
Posts
15
Years
27zvgi1.png
Introduction
» My Greetings

Tutorial Version: 2
Author: Seth-kun

Introduction:
» Info about me and the tutorial:
Welcome, Welcome! I see you've found my XSE tutorial. Anyways, as long as you don't post it on other sites without my permission (just ask me, I'll likely say yes!), you can use it all you want. Heck, download it if you want.

What if I don't have XSE?
» You can get it right here.
Well, you don't have XSE? Well, here's a link to download it (right from Hackmew).
(URL coming soon. Just need Hackmew's permission.)

Some Basics
» Stuff you Need to know

•XSE is a scripting tool. A script is an event in the game. Talking to people: Scripts, Getting pokemon: Scripts, a lot of other things: Scripts.
•Scripts use commands in order to work. Like msgbox will show a message. Simple, no?
•Each script uses its own offset, or "thing" of data. You have so many per rom.
•There are also commands without names, they are known as raw's. Raws are usually the more complicated commands, or just don't have a name.


Part 1: Simple Stuff
» Ready to start learning how to script?

OK. First, I'm going to teach you all the basics, meaning you're about to learn the simplest of commands.
Good luck!

Sample
» Here is what you're about to learn.

Code:
#dynamic 0x######
 
#org @start
lock
faceplayer
msgbox @text
boxset 0x6
release
end

#org @text
= Hello.\nI'm RaiRai-kun.
Well, that is about what your first script will be.
Just edit the text where you need to.

Explanation of Compnents
» Learn the commands!

#dynamic 0xoffset
#Dynamic - Tells the start of the script
offset-- The combination of numbers/letters that refers to a point of data within the rom.

#org @start
#org - Tells the start of a pointer

@start - This is A pointer. Meaning pointers can be @pie, @text...anything! I just like to use start because that's the start of the pointers, and the Base of the script. The base (as I call it) is just where everyone pointer in the script is referenced.

lock
This literally "locks" the player until you "release" the player.
A variation - lockall locks EVERYBODY on screen, so everyone stands still until you do releaseall.

faceplayer
- Makes the sprite with the script face you.
NOTE: Can only be used when the script is reference by a Sprite.

msgbox @text 0x#
msgbox - makes a message box appear. To make text appear, you must use a pointer on the same line as msgbox with a pointer reference.
NOTE: @text is a pointer, (description above)
That # is what boxset you are using.
0x6
0x# - Tells the type of message box by using the value directly after it (i.e. yes/no, simple...etc.) NOTE: This must come right after the pointer after the msgbox command it is referring to.
0x6 - This comes directly after the pointer on the line with •msgbox. It tells the type of msgbox.

release
- This releases the player.
A variation - releaseall releases every sprite on screen from the lockall command.
end
This tells the end of this part of the script. NOTE: You must add end to every part of the script. When you use end for the Base of the script, that is where the actual "script" ends.
#
Extra Stuff
» More commands under "Simple Stuff"


This section teaches all about those tricky "\" commands. Theses are used to make message scripts appear correctly. Anyways, here is a list of the commands and what they do.

\p - This makes the text from the msgbox go to another box, which appears after you press A.*

Example:
Spoiler:


\n - This makes the text from the msgbox go to the next line of available space in the msgbox.

Example:
Spoiler:


\h - This is used to show hex symbols. Well, not hex symbols. But symbols (certain characters, rather) that are shown using hex.

Anyways, here is a list of usable hex commands.
Spoiler:


\l - This is used the same as \n except you can't use it until you use \n.

Example:
*See: \n*

\c - This is used to make text colored. If you want to change colors, just use the command again to switch back.
Here is a list of colors for FireRed. I'll work on finding R/S/E's. (And LeafGrean's.)
Spoiler:


\v - This is used exclusively with setvar. There are two values that you can use if you don't use setvar, however.
Those are \v\h01\, which is player, and \v\h06\, which is rival. Alternatively, you can use [player] and [rival] to display the player's and the rival's names respectively.

Congratulations!
» You've learned about basic messages!


Congratulations, one who is young in learning scripting! You've learned about basic message scripts! Now, if you want to continue learning, let's move on to Complex Messages!


Part 2: Complex Messages
» Ready for bigger and better messages?

Now, since you've learned some good basics, let's dive a little further. You're about to learn complex messages. A good example of a complex message is the yes/no message.
Let's get started.

Sample:
» What you're about to learn:


Code:
#dynamic 0x######
 
#org @start
lock
faceplayer
msgbox @yesno 0x5
if 0x1 goto @yes
if 0x0 goto @no
release
end
 
#org @yesno
= Yes or no?
 
#org @yes
= You pressed Yes!
 
#org @no
= You pressed No.
OK. We've got a few more things to learn in this one.
Before we delve into the yes/no message, I want to teach you some things about multiple messages.

Multiple Messages
» What if I want more than one message per script?


Well, that's actually a very easy question for me to answer.
Basically, when you want to add more messages you just use the msgbox code so many times you need a message.

Here's an example.
Spoiler:

I suppose since I've told you about multiple message, I should tell you about combining commands.

You see, in a script we use multiple commands, so how do we make one script where it uses all the commands we need in one script? Well, it's actually very simple.

Here is an incomplete script:
Code:
#Dynamic 0x######

#org @start
lock
release
end
Now, you see, between that lock and release, that's where those msgbox and boxset commands go, right? Exactly. Now replace msgbox/boxset with any command and there you go. And, after one command is finished (like msgbox/boxset, for instance), you can add another one. Say a givepokemon command or something. Any command.
It's that simple.

Explanation of Components
» Anyways, back the Yes/No...


Seeing as we already have the sample (It's right up there ^), let's learn the commands.

0x5 - OK. A new boxset. Not really a command, but you need to learn it. Basically, just put it after the pointer after msgbox and it gives the set of boxes for a message, then a small yes or no box.

if 0x1 goto @yes - This is relatively simple. 0x1 means yes and 0x0 means no (in this situation, at least). So, if that's true, then if 0x1 goto @yes means "if "Yes" is chosen, then "goto" @yes (Remember, "@yes" is a pointer, meaning it could be @ anything.) So, it basically redirects you to the message @ the pointer @yes.

if 0x0 goto @no - This is basically the same thing as the command above, but in reverse. So, it reads "if "No" is chosen, goto "@no". See, simple.

Congratulations!
» You've learned "Complex Messages"!


Well, look's like you've learned some new stuff. Now, put it to work! :)


Part 3: Flags
» It's About Time

Well, I see it's time to learn about flags. Flags are ways of tracking events in roms. Basically, when you set a flag (using the setflag command) you say such-and-such event has happened. When it comes to checking the flags (by using checkflag and specifying the flag to be checked) you check to see if the event has happened. If you need to say an event has happened, but now it hasn't, you use clearflag.
And that's basically it for flags, but let's see it in a script.

Sample
» Let's look at a flag in a script

Code:
#Dynamic 0xoffset
 
#org @start
lock
faceplayer
checkflag 0x(I will use 828)
if 0x0 goto @give
if 0x1 goto @sry
release
end
 
#org @give
givepokemon 0x1 0x10 0x0 0x0 0x0 0x0
fanfare 0x13E
waitfanfare
setflag 0x828
msgbox @yay
boxset 0x6
release
end
 
#org @sry
msgbox @sorry
boxset 0x6
end
 
#org @yay
= You got Bulbasaur!
 
#org @sorry
= I can't give you anymore.
Now, I will say that this script had the command "givepokemon", but we're not going to worry about that. You see, flag 0x828 is the flag that is set when you recieve your pokemon. It activates the pokemon menu. (No point in having a menu you can't use until you can use it.) That's why I used the givepokemon command in this script. Now, let's look at how I made the script.

Explanation of Components
» Let's learn the commands for Flags.


setflag 0x### - This sets a certain flag. All you do to use this command is replace "###" with a hex number (number/letter combo).

checkflag 0x### - This is used to check and see if a certain flag has been set. We use if 0x1 goto @true and if 0x0 goto @false here. Basically, it's like (for 0x1), "the flag has been set, goto @(pointer name)". And for 0x0, "the flag has not been set, goto @(pointername2)".

clearflag 0x### - This clears a certain flag if it has been set.

I know there are some commands in there that you don't know, but those will have sections later on. That's why they aren't covered here. They just happen to be in my sample script.

Extras for "Flags"
» Some helpful lists and more! :)


Lists of Commonly used Flags:

FireRed/Leafgreen:
Spoiler:


Ruby/Sapphire:
Spoiler:


Emerald:
Spoiler:


Congratulations!
» You've learned about Flags!


Well well, what can I say? Great job for learning this much! Now, use what you've learned! :D


Part 4: Giving Pokemon and Items
» Well, time to get a little more advanced.

Giving pokemon and items is a crucial piece of code that every hack has to have if it even wants to get out of the first town! Face it, you need stuff in pokemon games.

Sample 1:
» What you're about to learn


OK. Let's look into the givepokemon command first, because I'm sure that's just about what everyone wants to know so they can get a high-level pokemon in order to cheat through a hack. Anyways, here is the script.

Code:
#Dynamic 0xoffset
 
#org @start
lock
faceplayer
givepokemon 0x1 0x5 0x0 0x0 0x0 0x0
setflag 0x828
release
end
Explanation of Components 1:
» Explanation for "givepokemon"


Basically, givepokemon is just the command and a setflag.
The Commands:

givepokemon - This is the command. It's used like this: "givepokemon 0x(pokemon number in hex) 0x(level, also in hex) 0x(item number in hex, 0 means no item) 0x0 0x0 0x0".
setflag 0x828 - This is the setflag that activates the pokemon menu.

Extras
» Extras for "Givepokemon"


The only extra I have for givepokemon is just a list of pokemons' hex numbers.
Anyways, here is the list.
NOTE: THESE ARE IN HEX!
Spoiler:


Sample 2:
» Sample for "giveitem"


Here's the sample for giveitem:
Spoiler:


Explanation of Components 2:
» Explanation of "giveitem"


The sample script really provides how to use the command, so I guess you can just look at the sample. (I'm not lazy, it's just already there.)

Extras 2
» Extras for "giveitem"


The only extra I can give you is just a list of item codes.
So, here's the list:
NOTE: THESE ARE IN HEX!
Spoiler:


Part 5: Other Commands
» Other cool commands

Well, these are just a few other commands I know, so feel free to learn them, or just try em' out.

CheckGender
» A command that gives results based on your gender in the game


Sample of a Checkgender Script:
Code:
#dynamic 0xoffset
 
#org @start
lock
faceplayer
checkgender
if 0x0 goto @boy
if 0x1 goto @girl
release
end
 
#org @boy
= You are a boy.
 
#org @girl 
= You are a girl.
Checkgender basically checks the gender (0x0 for boys, 0x1 for girls) of the player and gives a result based on 0x0 or 0x1.

Warp
» A command that warps the player


Sample Script:
Code:
#Dynamic 0x######

#org @start
warp 0x3 0x0 0x0
end
Warp teleports the player to a warp spot anywhere in the game.
Here's how you use it:
warp 0x(map bank #) 0x(map #) 0x(warp # of that map)

PokeMart
» If you need custom marts, use this


Sample Script:
Code:
#Dynamic 0xoffset
 
#org @start
lock
faceplayer
pokemart @values
release
end
 
#org @values
 
binary 0x(number) . . . 0x0
This calls for the pokemart, which does what a pokemart does. Anyways, when you want to use pokemart, add that binary command with 0x# 0x#...etc.
That number is the item code.
And Here is a list of such codes:
Spoiler:

GiveEgg
» Need PokeEggs, you've found the command, at least!


GiveEgg is a rather unique command that allows the user to make sprite give the player pokemon eggs.
Basically, to use the command, you choose the pokemon you want.
Then take their hex number (like pikachu's is 19) and make it into a 4-digit number.
So, you end up with 0019.
Then we put that into the giveegg command.
But, we reverse the digits so it's like this:
19 00
So, we have this:
Code:
giveegg 0x19 0x00
And that's it!

ApplyMovement
» Need to make stuff (sprites) move?


ApplyMovement is a rather complex command that allows the movement of sprites, so it's rather crucial to any hack.
Anyways, here is a sample:

Code:
#Dynamic 0xoffset

#org @start
checkflag 0x828
if 0x0 goto @hey!
if 0x1 goto @end
end

#org @hey!
lock
msgbox @icant
boxset 0x6
applymovement 0xFF @back
waitmovement 0x0
release
end

#org @icant
= I can't go out of (name) town/nwithout a pokemon.

#org @back
#raw 0x00 0xFE

#org @end
release
end
OK. Let's go over all those commands.

applymovement 0xFF - this is the command that allows sprites (including the hero) to move during a script. The 0x## is the person number that applymovement moves.

waitmovement 0x0 - this makes the script stop completely until the above movements are completed.

0xFF - this is the player's person number.

raw 0x## ... 0xFE - This is the movements to be made.
0xFE is the end of the movements (remember this! ;) )

List of Movement Numbers:
Spoiler:


Congratulations!
» Other Commands has been taught!


Congrats for making it this far! :D
And thanks for reading! :)

Credits
» People who made this tutorial possible

•RaiRai-kun - For making the tutorial and the CSS.
•-Hackmew- - For making XSE! A many thanks to you, -Hackmew-!
•Everybody who taught me what I know on scripting! Thank you!
•Readers - Well, good luck with your new knowledge. Thanks for Reading! :D

27zvgi1.png
 
Last edited:

DarkFear

I will ^^
210
Posts
18
Years
  • Age 29
  • NZ
  • Seen Dec 22, 2010
Good, simple post and very easy to follow. Glad to see it is for XSE instead of PokeScript. I will for sure look back on this again when you have posted more info.
 
1,104
Posts
16
Years
I haven't read through it all, but I noticed just bad information in the giveegg section.
You can use raw's to give an egg, you can but what's the point?
giveegg 0x1 'Bulbasaur egg.

And #raw's aren't special commands, get your facts straight. #raw's are every command.
#raw 0x0F 0x00 0x00 0x00 0x80 0x08 'Message 0x800000
#raw 0x09 0x06 'Boxset 0x6/callstd 0x6
 

Ryousha

Waiting for Gen 4 Remakes
954
Posts
16
Years
Pretty useful, though it just shows out the whole script, though it shows other commands then darth's tut.
 

Ninja Caterpie

AAAAAAAAAAAAA
5,979
Posts
16
Years
Pretty usefull, but I have to say, those givepokemon scripts are missing stuff... when there's stuff you need, put it!
Such as the nicknaming, music, etc.
Anyway, this'll help noobs who want to use XSE...
It's sort of incomplete (in the sections you have put) but oh well...
Well, good luck on continuing it!
:)
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Looks very good. :)

However... I would recommend adding more basic functions, though. Such as:
Code:
----#Include----

#Include filename.rbh		'This let's you include a "Standard" file, such as "stdpoke.rbh", which then means you can call the data stored in it. (With #Define)

				'#Include stdpoke.rbh

----#Define----

#Define Varible_Name Value	'This is used to store values, for later use... Such as wanting to name a flag, or varible:

				'#Define Var_Main 0x4000
				'This means, later in your script, when you want to call your main varible, but can't be bothered remember which one it was, you can use Var_Main, instead.

				'Here is an example:
[code]#Dynamic 0x800000
#Define Var_Main 0x4000

#ORG @Main
Lock
Compare Var_Main 1
If B_True GoTo @Part1
Release
End

#ORG @Part1
Message @Speak
BoxSet 6
Release
End

#ORG @Speak
= XSE sure is fun... >_>

----#Erase----

#Erase Start Length 'This is used to remove a certain amount of bytes from your ROM, giving you more free space.

'#Erase 0x800000 0xFFFF
'Will remove 65535 from the offet 0x800000

----#EraseRange----

#EraseRange Start End 'This has a similare ffect as #Erase, except you can choose the first and last bytes to erase.

'#EraseRange 0x800000 0x80FFFF
'Will clear all the bytes between 0x800000 and 0x80FFFF.

----#FreeSpace----

#FreeSpace New_Byte '#FreeSpace 0x00
'Will make the new "Unused" byte "00"[/code]

There are more, but I'll add them in later. xD
 

cooley

///Keepin' it simple
1,148
Posts
17
Years
Sure, this is an XSE tutorial, but what's the point?
You said all of the commands, but those commands are the basic ones.

And one more thing, the "advanced commands" you've posted, are also classified as Basic, because they don't require you learn much. Why #raw for an Egg script? You just wanted to make it "look" advanced didn't you? Because XSE is fully compatible with the giveegg command.

Anyways, I'm sick and tired of these tutorials, where people just learn a thing, and they post it.
This is not just to you, but to every one. This is how it is. I'm a beginner hacker, and I learn how to edit a map, so I go and post a tutorial for how to edit maps. See?
I would give this thread about 3 weeks or so.

@Darthatron: You know the Dynamic labels are Case-sensitive, right? I see that you use CAPS in your scripts, though it doesn't matter. 0_0!
 
5,814
Posts
16
Years
  • Age 30
  • Seen May 19, 2021
Hey, Sethman! ^_^
I copied ur Give Pokemon script and and edited it a little.
I've been dying to know how to make the fanfare noise.
1 question.
How would u make it so that text appears be4 the noise happens?
 

cooley

///Keepin' it simple
1,148
Posts
17
Years
Hey, Sethman! ^_^
I copied ur Give Pokemon script and and edited it a little.
I've been dying to know how to make the fanfare noise.
1 question.
How would u make it so that text appears be4 the noise happens?
I'll answer this.
If you mean like "Here you go" and the box stays open, then the noise happens than you can do this

Code:
#org @start
...                                'Script before the event
...                                'Script before the event
message @gotit
callstd 0x4
fanfare 0x(number)
waitfanfare               ' Optional, but it's good to have.
release
end
If you mean during the text, then Goto my Page and Post it there.
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
@Darthatron: You know the Dynamic labels are Case-sensitive, right? I see that you use CAPS in your scripts, though it doesn't matter. 0_0!
Yes, but I think it looks better. :P It's also easier to read, I believe.

@Seth the ROM master: Perhaps you should read the "Command Help", before you do anymore. :P

Also, cooley is right, those commands aren't advanced. :P (I don't see how I didn't notice it last night... :S)
 

Qwerty-117

Is looking for a VBScripter
66
Posts
16
Years
very easy to understand, to join the above argument, if they were advanced stuff, they arent now, i just scanned through it and i remember and understand everything, this is a very helpful tutorial, but can you change the decimal numbers to hex to save time for lazy ppl like me?
 

.Seth

.explorer.
1,644
Posts
15
Years
@Darthatron: i know. I'll work on that but for me they are advanced :embarrass.
@cooley: i get what you are saying, I'll do that.
@qwerty: I will, nice idea btw. But if you mean the 0xoffset things those are hex format, but if you mean put numbers there, then i'll do that.
 

Qwerty-117

Is looking for a VBScripter
66
Posts
16
Years
@qwerty: I will, nice idea btw. But if you mean the 0xoffset things those are hex format, but if you mean put numbers there, then i'll do that.
i meant the pokedex numbers and item numbers etc, it'll only work for the first nine if they arent in hex, also, can you put up some flag values? like how you said 828 was the pkmn menu, but with some more... btw, do flag values only go to FFF?
hehehe... nice frog!
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
very easy to understand, to join the above argument, if they were advanced stuff, they arent now, i just scanned through it and i remember and understand everything, this is a very helpful tutorial, but can you change the decimal numbers to hex to save time for lazy ppl like me?
You don't need to use HEX numbers, if you want to use Decimal number sin XSE you can just use them. These will all lead to the same thing:
Code:
GiveEgg 251
GiveEgg 0xFB
GiveEgg &HFB
 
18
Posts
15
Years
  • Seen Apr 12, 2010
i need help, my game freeze when i am talking too one guy i made. I come up a little spot too the right and then it freez there. i need some help :)
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
i meant the pokedex numbers and item numbers etc, it'll only work for the first nine if they arent in hex, also, can you put up some flag values? like how you said 828 was the pkmn menu, but with some more... btw, do flag values only go to FFF?
hehehe... nice frog!
Flags goto 0xFFFF.
i need help, my game freeze when i am talking too one guy i made. I come up a little spot too the right and then it freez there. i need some help :)
Please, post the script, so we can help you.
 
67
Posts
15
Years
  • Seen Jan 24, 2015
I want to do a Pokemon 'Zoo', and when you talk to a Pokemon, it says something and then registers as 'Seen' In your Pokedex. (This is in Pokemon Emerald, BTW)
 
31
Posts
15
Years
  • Seen Dec 8, 2009
I have the following script to make Kyogre be able to be battled:
#dynamic 0x2403DD
#org 0x2403DD
checkflag 0x200
if 0x1 goto @done
if 0x0 goto @battle
lock
faceplayer
callstd 0x6
cry 0xA1 0x6
release
end

#org @battle
wildbattle 0x194 0x3C 0x8B 0x1
fadescreen 0x0
setflag 0x200
release
end

#org @done
hidesprite LASTTALKED
release
end

But when I take a step, it resets and I can battle it again... How can I fix this?
 
18
Posts
15
Years
  • Seen Apr 12, 2010
hey all. this is the script i used for my Fire Red.

#org $start
lock
faceplayer
message $1
boxset 6
release
end

#org $1
$1 1 =Hi.\nWelcome

If this doesnt work, can anyone link too a tutorial thats for fire red only?
 
Status
Not open for further replies.
Back
Top