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

Percy's Scripting Guide

3,044
Posts
9
Years
  • Hey, there! I'm Percy, and I'm about to teach you scripting. Let's move on since I'm bad at introducing myself.
    I'm pretty sure you already know the meaning of scripting, right? Well, then, soon-to-be-scripters. Let's start learning scripting!

    Tools You're Gonna Need:

    XSE
    Advance Map 1.9.2

    I think you can find the download links here: http://www.pokecommunity.com/showthread.php?t=341758

    Be sure to get the 1.92 version of Advance Map.
    Oh, yeah, you need FSF (Free Space Finder): https://www.dropbox.com/s/kni6u0mp2nxvs6z/Free%20Space%20Finder.zip?dl=0

    It will find free space for you.

    Lesson 1:
    Basic Scripting

    Code:
    #dynamic 0x(free space offset)
    
    #org @pointer
    lock
    faceplayer
    msgbox @hello 0x6
    release
    end
    
    #org @hello
    = Hello to you!

    Let me explain line by line.
    #dynamic 0x(free space offset)
    With #dynamic, you simply state a start offset, say 0x800000, and XSE will automatically insert it in the first suitable instance of free space past that offset. (Said by Spherical Ice) And, in order to have an offset, open FSF, and open your ROM with it. Click Search and you'll gonna have an offset that is safe to use, whatsoever.

    #org @pointer
    This part is the pointer. It can be anything:
    @iamcool etc.
    Just remember not to duplicate any pointers, and don't include spaces, too!

    lock
    Easy, it locks the player, so it can't move and such.

    msgbox @hello 0x6
    If you want a message box to appear use the msgbox command. The @hello part is where we'll gonna store our text. The 0x6 part decides what message box it will show. There are 5 kinds of message box:

    Spoiler: 5 kinds of message box
    0x2 - If you use this kind of message box, you don't need lock, faceplayer, release.

    0x3 - For the sign posts. Like the 0x2 you don't need lock, faceplayer, and release.

    0x4 - A normal message box, you can use lock, faceplayer, and release in this. Its like 0x6 but this doesn't close. Just stick closeonkeypress on your script when you use the 0x4 message box, and the message box will close.

    0x5 - The Yes/No message box. Its kind of complicated to explain how this works right now, so maybe in Lesson 2 or something.

    0x6 - Normal message box. You can use the lock, faceplayer, and release commands.


    Now, back to explaining:

    release
    It releases the player from the lock command so that you can move again.

    end
    It ends the script. You must include this in every script you make.

    #org @hello
    Pointer to your text.

    = Hello to you!
    Ta-da! This is the text. In your XSE, press CTRL + T. It opens up the Text adjuster so you don't need to add the \n, \l, or \p. If \n is used, the message box scrolls up, same as the \l, but you may only use \l if you have used \n. \p is for new textbox. Now make your own basic scri

    Lesson 2
    Yes/No Messages

    This is the second part of scripting I learned, and when you learn it, you're gonna have fun with it. Anyway, let's start.
    Code:
    #dynamic 0x800000
    
    #org @start
    lock
    faceplayer
    msgbox @1 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @2
    msgbox @3 0x6
    release
    end
    
    #org @1
    = I am handsome?
    
    #org @3
    = No? What the [.]
    
    #org @2
    msgbox @4 0x6
    release
    end
    
    #org @4
    = Yes!
    There! If you don't understand some of the old commands we've done last lesson, just scroll up, and you'll see.
    Let's start explainin'

    msgbox @1 0x5
    Remember what 0x5 are for? Yes, for Yes/No message boxes. The message box is accompanied with one command ...

    compare LASTRESULT 0x1
    Get's the lastresult and the 0x1 beside it means yes. (said by tajaros)

    if 0x1 goto @2
    If you pressed yes, it will goto @2
    If you pressed no, it will ignore this part, and continue to @3.
    There!
    Start making Yes/No scripts!

    [a id]compilescript[/a id]
    Spoiler:


    If you have some trouble please post it here!

    -Percy​
    Contact me if you have trouble with this tutorial, or just post it here.

    PS: I'm gonna post lesson 3 soon enough! ;)
     
    Last edited:
    5,256
    Posts
    16
    Years
  • #dynamic 0x(free space offset)
    This part asks for what free space we'll use. This is the part where our script is contained. And, in order to have an offset, open FSF, and open your ROM with it. Click Search and you'll gonna have an offset that is safe to use, whatsoever.

    That isn't how the #dynamic operative works, you're thinking of #org 0x8(offset). With #dynamic, you simply state a start offset, say 0x800000, and XSE will automatically insert it in the first suitable instance of free space past that offset.
     
    3,044
    Posts
    9
    Years
  • That isn't how the #dynamic operative works, you're thinking of #org 0x8(offset). With #dynamic, you simply state a start offset, say 0x800000, and XSE will automatically insert it in the first suitable instance of free space past that offset.

    Haha, sorry. And, thanks, I'll edit the first post.
     
    212
    Posts
    9
    Years
    • Age 22
    • USA
    • Seen Jun 4, 2015
    When you were explaining the #org @pointer you said that anything can be the pointer and you put #iamcool. I understand that you probably meant @iamcool but that would probably confuse somebody new to scripting.
     
    204
    Posts
    9
    Years
    • Seen Jul 26, 2021
    Could you add how to edit inserted scripts in the fastest way? for example if i compile a scipt and then found out i forgot something, how to edit it the fastest way?
     
    3,044
    Posts
    9
    Years
  • Could you add how to edit inserted scripts in the fastest way? for example if i compile a scipt and then found out i forgot something, how to edit it the fastest way?

    Well, then edit the compiled script, and then hit the compile button, that should do it.
     

    Joexv

    ManMadeOfGouda joexv.github.io
    1,037
    Posts
    11
    Years
  • Well, then edit the compiled script, and then hit the compile button, that should do it.

    Yea but that could overwrite something. If you add a dynamic offset to the script hunk you are editing then doing the same to anything that points to the script so that all of your pointers are fixed. Something along the lines of this:
    Spoiler:

    To this:
    Spoiler:
     
    Back
    Top