DC Forums

We have moved our forums:
http://www.dcforums.co.cc/forum/

Please re-register there, thank you.
GKS
There are many new features available. Some of them include: the advanced profile, reputation system, and the point system. Thank you for waiting patiently, enjoy the update. Plus we are still working on fixing a lot of bugs and stuff that are wrong with the theme.

    Shaded's XSE tutorial(basic)

    Share

    Shaded
    New Member
    New Member

    Number of posts : 1
    Status : Normal
    Warning :
    0 / 1000 / 100

    Reputation : 0
    Points : 0
    Registration date : 2009-01-13

    default Shaded's XSE tutorial(basic)

    Post by Shaded on Tue Jan 13, 2009 10:58 pm

    XSE is short for eXtreme Script Editor
    made by HackMew of the Pokecommunity forums.
    It is used to script events in various Pokemon games.

    I will be going over the basic commands today, intermediate and advanced will soon follow!

    Okay let's start shall we?
    Code:

    #dynamic 0xOFFSET

    Up there we have what should be your first line always. Where it says offset, that is the free space inside a rom, and you can usually get a tool to find the free space and give you a hexidecimal offset which is usually composed of 6 letters and numbers. For example, #dynamic 0x66FF33, the reason you have to use a free space finder tool is because a lot of offsets are taken up by actual scripts, if you use those, you can mess up those events!

    So now we add an extra line in and we have this.

    Code:
    #dynamic 0xOFFSET

    #org @Start

    Now things are starting to get a little warmed up, this is what we call a pointer, it is like a name for a section of a script that you can call or goto, we are giving it the pointer name Start but it doesn't matter what you use, because when you compile, all your pointer names will become hexidecimal. So when the script starts off it automatically goes to the our start section. We will do a basic npc talking script.

    The begginings of the talking script:

    Code:
    #dynamic 0xOFFSET

    #org @Start
    lock
    faceplayer

    This time I gave you two new commands, lock and faceplayer, because they are pretty straightforward, when you talk to a npc in pokemon you can't move anywhere until you finish the conversation. This is because of the lock command, faceplayer is the command that tells the npc to face the player. Simple Enough?

    We are almost done with the script!

    Code:
    #dynamic 0xOFFSET

    #org @Start
    lock
    faceplayer
    message @Hi


    We have a new command but we've seen this somewhere before, but of coarse that's a pointer to a message! It points the script to the message we want the npc to tell the player, again @Hi could be anything you want to name it. For Example: @lolcats, @talk, @speak... ANYTHING!

    Now we have the pointer, pointing to nowhere so lets add a message shall we,but before that we have to finish the rest of this section!

    Code:
    #dynamic 0xOFFSET

    #org @Start
    lock
    faceplayer
    message @Hi
    boxset 6
    release
    end

    #org @Hi
    = Hello!


    So this is the whole talking script, don't worry I will explain it bit by bit. Release is simple enough to understand, after the npc says the message, it releases the player from the lock command, so you are free to roam around again. Boxset is the command that tells whether it is a yes or no message, or wether it is a normal comment. Don't worry I'll go over yes or no messages next. The end command ends the script, it should always be the last command in a section. Below end we have a whole new section called Hi, this is where the message command gets it's message from, so when the script runs, the message command calls to see what is in the Hi 'section', and sees that it says Hello!, and relays the message unto the player. This section doesn't need an end command because it is a message.

    Yes/No messages!

    Now let's do the same thing again but with boxset 5 which is yes/no messages.
    Code:

    #dynamic 0xOFFSET

    #org @Start
    lock
    faceplayer
    message @hi
    boxset 6
    release
    end

    #org @hi
    = Hello!

    That is the original code, which I went over in the last section.

    This is a slightly modified code.

    Code:
    #dynamic 0xOFFSET

    #org @Start
    lock
    faceplayer
    message @first
    boxset 5
    compare LASTRESULT 1
    if b_true goto @hi
    compare LASTRESULT 0
    if b_true goto @bye
    release
    end

    #org @first
    = Do you like candy?

    #org @hi
    = Here's a rare candy!

    #org @bye
    = Aww too bad.


    This is kind of similar as the last script except now we have boxset 5 which makes the message have a yes or no, this should we followed by compare LASTRESULT which checks if the player pressed yes or no. "1" means Yes, while "0" means No, so basically the first line after boxset 5 says, check if the player selected "Yes", and the line after compare LASTRESULT, if b_true goto @hi, means that if the player checked "Yes", goto @hi, which is a pointer to go to the message @hi, you don't put message @hi in this case because you just don't. The next line is compare LASTRESULT 0, which means if the player selected "No" this is what happens. The pointer @bye, makes you go to the message bye, at the bottom we have two messages, both of them won't get displayed so it depends on the player's input. So when running the script, a npc says "Do you like candy" You answer yes or no, and according to your answer the script displays one of two messages.

    Now you might say, well I could just talk to the person again, and pick the option I didn't select before, and then I'll see both messages!
    This is were Flags come in, these prevent things from happening twice, and are very useful.

    So let's put the script we just had here:

    Code:
    #org @Start
    lock
    faceplayer
    message @first
    boxset 5
    compare LASTRESULT 1
    if b_true goto @hi
    compare LASTRESULT 0
    if b_true goto @bye
    release
    end

    #org @first
    = Do you like candy?

    #org @hi
    = Here's a rare candy!

    #org @bye
    = Aww too bad.

    Now I'll put the modified version here:

    Code:
    #dynamic 0xOFFSET

    #org @Start
    lock
    faceplayer
    checkflag 0x1001
    if b_true goto @chance
    message @first
    boxset 5
    compare LASTRESULT 1
    if b_true goto @hi
    compare LASTRESULT 0
    if b_true goto @bye
    setflag 0x1001
    release
    end

    #org @chance
    message @chance1
    release
    end

    #org @chance1
    = You had your chance.

    #org @first
    = Do you like candy?

    #org @hi
    = Here's a rare candy!

    #org @bye
    = Aww too bad.


    Now things get a little more complicated as always, at the beginning of the script I added checkflag, this checks if the 'flag' called 1001 has been raised, and if it has it goes to the chance section of the script, keep in mind that this section isn't a message and is a new section, but we do not need lock and faceplayer since we had that before. In this chance section it gives you the message, "You had your chance". Now you might be asking, well how do I know if the flag is raised or not. Well, if it isn't "set" the script goes on normally, with the message of "Do you like candy" yes or no. I added setflag 0x1001 right before the release, this means that if the flag isn't set it runs through the script normally, and shows you the message after pressing yes or no, after showing the message, it sets the flag,releases, and ends. So the next time you talk the flag is set meaning you keep getting the message "You had your chance". The command clearflag can be used to lower the raised flag.

    BONUS SECTION!
    Okay in the messages, there is a limited area in the little box in game, so there are commands that make the message go on the next line of the box or a whole new box.
    Here are some commands:

    \p Used to go to a new box in a message.
    \n Used to go to a new line in a message.
    \h Used to show hex symbols such as:
    Code:
    00=
    01=À
    02=Á
    03=Â
    04=Ç
    05=È
    06=É
    07=Ê
    08=Ë
    09=Ì
    0B=Î
    0C=Ï
    0D=Ò
    0E=Ó
    0F=Ô
    10=Æ
    11=Ù
    12=Ú
    13=Û
    14=Ñ
    15=ß
    16=à
    17=á
    19=ç
    1A=è
    1B=é
    1C=ê
    1D=ë
    1E=ì
    20=î
    21=ï
    22=ò
    23=ó
    24=ô
    25=æ
    26=ù
    27=ú
    28=û
    29=ñ
    2A=º
    2B=ª
    2C=·
    2D=&
    2E=+
    34=[Lv]
    35==
    36=;
    51=¿
    52=¡
    53=[PK]
    54=[MN]
    55=[PO]
    56=[Ke]
    57=[BL]
    58=[OC]
    59=[K]
    5A=Í
    5B=%
    5C=(
    5D=)
    68=â
    6F=í
    79=[u]
    7A=[D]
    7B=[L]
    7C=[R]
    A1=0
    A2=1
    A3=2
    A4=3
    A5=4
    A6=5
    A7=6
    A8=7
    A9=8
    AA=9
    AB=!
    AC=?
    AD=.
    AE=-
    AF=·
    B0=[...]
    B1="
    B2=["]
    B3='
    B4=[']
    B5=[m]
    B6=[f]
    B7=$
    B8=,
    B9=[x]
    BA=/
    BB=A
    BC=B
    BD=C
    BE=D
    BF=E
    C0=F
    C1=G
    C2=H
    C3=I
    C4=J
    C5=K
    C6=L
    C7=M
    C8=N
    C9=O
    CA=P
    CB=Q
    CC=R
    CD=S
    CE=T
    CF=U
    D0=V
    D1=W
    D2=X
    D3=Y
    D4=Z
    D5=a
    D6=b
    D7=c
    D8=d
    D9=e
    DA=f
    DB=g
    DC=h
    DD=i
    DE=j
    DF=k
    E0=l
    E1=m
    E2=n
    E3=o
    E4=p
    E5=q
    E6=r
    E7=s
    E8=t
    E9=u
    EA=v
    EB=w
    EC=x
    ED=y
    EE=z
    EF=[>]
    F0=:
    F1=Ä
    F2=Ö
    F3=Ü
    F4=ä
    F5=ö
    F6=ü
    F7=[u]
    F8=[d]
    F9=[l]
    FA=\l
    FB=\p
    FC=\c
    FD=\v
    FE=\n
    FF=\x
    Also, you can use special messages in brackets such as these to show the names of the player and/or rival:
    [player]
    [rival]

    I will show you more in the next tutorial!

    This is how to use those commands in a message section like this:

    #org @message
    = Hello, I am [player] from\nPallet Town. I will be the\pgreatest pokemon trainer in the\nwhole world!

    There we go!

    Commands learned in this tutorial:
    lock
    faceplayer
    message
    boxset
    release
    checkflag
    setflag
    clearflag
    end

    (Trainer Tip)- With Checkflags, you can't use a random number because many flags are used in game, so to be on the safe side always be cautious and usually use numbers over 1000, just be reasonable, anything over 2000 is pretty much not needed.

    Here is a list of common flags used in-game:
    FireRed\LeafGreen flags:

    Code:
    0x820 - First Badge
    0x821 - Second Badge
    0x822 - Third Badge
    0x823 - Fourth Badge
    0x824 - Fifth Badge
    0x825 - Sixth Badge
    0x826 - Seventh Badge
    0x827 - Eighth Badge
    0x828 - Pokemon Menu
    0x829 - Pokedex Menu
    0x82F - Running Shoes


    Ruby\Sapphire flags:
    CODE: SELECT ALL
    0x800 - Pokemon Menu
    0x801 - Pokedex Menu
    0x802 - Pokenav Menu
    0x807 - First Badge
    0x808 - Second Badge
    0x809 - Third Badge
    0x80A - Fourth Badge
    0x80B - Fifth Badge
    0x80C - Sixth Badge
    0x80D - Seventh Badge
    0x80E - Eighth Badge
    0x860 - Running Shoes


    (Trainer Tip#2) Rom Hackers do not hack emerald, for it is glitchy and not much is known about it.

    Credits:
    Me
    The Pokecommunity for lists of flags and hex symbols.


    That's all folks!
    avatar
    G.K.S.
    Founder
    Founder

    Male Number of posts : 1718
    Age : 24
    Location : Calfornia, United States
    Status : Updating the forum.
    Warning :
    90 / 10090 / 100

    Reputation : 0
    Points : 25
    Registration date : 2008-09-20

    default Re: Shaded's XSE tutorial(basic)

    Post by G.K.S. on Tue Jan 13, 2009 11:59 pm

    Alright a new XSE tutorial, this should be useful. Thanks for posting it.


    _________________
    http://www.cramster.com/?referral_id=509296
    For help on homework and for studying.

    Hiche
    Super Moderator
    Super Moderator

    Number of posts : 277
    Status : Normal
    Warning :
    0 / 1000 / 100

    Reputation : 0
    Points : 0
    Registration date : 2008-11-15

    default Re: Shaded's XSE tutorial(basic)

    Post by Hiche on Wed Jan 14, 2009 1:28 pm

    Indeed useful. Nice going.

    Sponsored content

    default Re: Shaded's XSE tutorial(basic)

    Post by Sponsored content


      Current date/time is Tue Oct 17, 2017 11:10 am