Thread: [Tutorial] XSE Scripting Tutorial
View Single Post
  #165    
Old July 16th, 2008 (8:14 PM). Edited July 16th, 2008 by KhaosKnight.
KhaosKnight's Avatar
KhaosKnight KhaosKnight is offline
The 1 and only Khaotic Hacker
     
    Join Date: Dec 2007
    Nature: Relaxed
    Posts: 355
    Quote:
    Originally Posted by Ryousha View Post
    Can you try scripting it for me?

    I can try to learn from there of yours skill
    Sorry but no, i am a major nOOb when it comes to scripting, when i get stuck(which happens alot) Dshayabusa helps me(alot)

    i just know some of the basics, and i have my own hack to...hack, sorry Ryousha but i cant this time

    Quote:
    Originally Posted by Eeveon View Post
    Should I always use checkflag and setflag 0x200?
    I never understand these.
    give this a read Eveon

    Spoiler:


    THIS WAS TAKEN FROM THEx4's SCRIPTING TUTORIAL, credit goes to THEx4

    Before I continue. I'm going to just add something on flags.
    Flags are very useful when you need an event to only occur once or if you want a person to disappear.
    We can set a flag, and if we want an overworld, to dissappear we have to assign the set flag to the OW's, people ID in advancemap. But I'll go into more detail on that later.
    Many flags are used within the game already. So if you plan on leaving scripts that are already in the rom, you'll need to be more careful on what flags you use, because flags can only really be used once.
    If you want some flags that are not used in the rom as a start, here's a few. 0x200 - 0x29F, 500-79F, 1000-109F. But you'll find more if you experiment with them.

    I'll have to do a bit of explaining here, so I'll start with preventing events to happen.

    Code:
     
    #org $start
    lock
    faceplayer
    checkflag 0x200
    if b_true goto $done
    message $1
    boxset 6
    setflag 0x200
    release
    end
     
    #org $done
    message $2
    boxset 6
    clearflag 0x200
    release
    end
    We've already covered lock and faceplayer, so we'll go to checkflag.
    checkflag checks if a flag has been set. Checkflag is usually followed by an if line.
    When using the if line after checkflag it contains either a b_true or b_false. b_true, meaning, that if the flag is set goto ${pointer}, and if not it will continue with the script. Similiarly, b_false checks if the flag is NOT set, and if it isn't it will goto ${pointer}, and if the flag is set, the script will continue without going to the pointer.
    This pointer used in if b_true goto $done it points to another part of the script as you can see in the script.

    As you can see the if b_true goto $done points to a different part of a script as shown with the #org $done
    Here we have a message and a new command, clearflag.
    Once flags are set they can be "unset" with the command clearflag.
    Clearflag has to be followed by the flag number.
    And here we are at the end of the script.

    But there is more than one way to use a flag. Some flags have some sort of game function. I'll explain that in the next part.


    Remember this tutorial(THEx4's) is for pokescript, you will need to change the $ to @ when using XSE, other than that everything else is pretty much the same
    __________________