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

Tool: [v1.2] FastScriptEditor (MUCH more efficient way to create XSE scripts)!

ps4star

WITH A ROLLING PIN!
11
Posts
8
Years
  • GitHub Repo: https://github.com/ps4star/FSE

    Language Reference (some code examples that explain things more in layman's terms can be found below. Check them out if you're having trouble understanding this): https://github.com/ps4star/FSE/blob/master/ref.md

    How to Install: https://github.com/ps4star/FSE/blob/master/README.md

    Try it out Online at: https://ps4star.github.io/FSE/

    Hey guys. I've always been one of those people who likes automating things, making processes as efficient and simple as possible. Something I noticed after spending a few hours writing scripts in XSE was that there is often a lot of technical stuff you need to do even for the simplest of actions. Want to move a character? You're gonna need to call applymovement, look up a hex table, then write an #org statement containing that data. Lots of really tedious work. These kinds of situations are where FastScriptEditor (which I'll just call FSE from now on) comes into play.

    Just to be a show-off, here's FSE's 1-line variation of applymovement:
    Code:
    move 0x00 u u r r r ; moves character with ID 0x00 up 2 and right 3
    The XSE code that this compiles to:
    Code:
    #dynamic 0x197D000
    
    #org @main
    
    applymovement 0x00 @offset0
    waitmovement 0x0
    
    end
    
    #org @offset0
    #raw 0x09
    #raw 0x09
    #raw 0x0B
    #raw 0x0B
    #raw 0x0B
    #raw 0xFE

    So yes, in case you weren't aware, FSE is essentially just a program that compiles proprietary FSE code into valid XSE code. It's written in HTML/JS (hence why it has a GitHub Pages site). To use it, simply type your FSE code into the editor box on the left, hit Convert, go into XSE, hit Ctrl+V, hit XSE's compile button, and voila. This may sound a bit tedious, but, and especially with larger scripts, it's almost always worth the extra time it takes to do this due to FSE's efficiency. You'll also notice the "Starting Offset" box. This is just what it sounds like, it'll put whatever you type into it into the call to "#dynamic" at the start of the script.

    Now, naturally, when you're converting 1 line of code into potentially dozens, some information is bound to be lost in translation. However, there are several internal FSE commands you can call to gain back some of this control (see below). Of course, you're never going to have quite the same level of control as you would with XSE (though of course, editing the XSE output manually before inserting it into the ROM is always an option), but if you're okay with that, then FSE is a great alternative.

    Now let's talk features:

    • Automatic table lookups!
    • Automatic line break system for msgbox!
    • Vastly more efficient applymovement system!
    • Shortened/alternative names to XSE commands!
    • Define constants and functions to easily name and re-use numbers, strings, hex IDs, and blocks of code!
    • Automatic #org generation for msgbox and applymovement!
    • ALL XSE commands are available!
    • Loops! (though they're quite limited)
    • Write scripts faster with Expansion Statements! (see language ref, section 3)

    Now for some examples, so you can get a feel for how the language works (see the language reference, linked above, for the full documentation).

    Looooots of Example Scripts, in no Particular Order


    Initially I had a list of examples pasted here, but decided to just put it in a markdown document so it would be easier to mantain: https://github.com/ps4star/FSE/blob/master/examples.md

    It also kind of acts as an introductory tutorial, explains what certain things do and such. Again, see language ref linked above for the full documentation.



    Closing Thoughts


    As for how to go about learning FSE, I would highly recommend reading the above code examples if you haven't already, then reading sections 4, 5a, and 5b of the language reference before doing anything with the language. Then once you have a good grasp on those sections, go on to read the other sections to improve your skill.

    As for resources on learning or improving your skill in XSE (which, if it wasn't obvious already, having at least some experience with XSE is pretty much a requirement before using FSE), I would recommend Sierra's MEGA-HUGE XSE Scripting Tutorial. This tutorial was also a great resource for me while developing FSE - it gave me plenty of test cases to try out, allowed me to find ways to optimize the language, etc.

    Also, I miiiiight make some YouTube video tutorials on the language, it just depends on if I have the time or not. If I do, I'll post links here.

    There are almost certainly going to be bugs in this program. If you encounter one, please make a reply to this thread, and include your FSE code, the XSE output, and any alert/error messages that appear. Also please read the language reference first (at least the relevant parts) if you encounter a bug just to make sure that it's in fact a compiler error and not a user/syntax error. Providing screenshots of your entire screen is preferred as well (you don't have to show your programs/browser tabs of course, just the window of FSE itself). The current error-detection system admittedly isn't that great, but I'll be expanding upon it in future updates. I will also be updating FSE regularly with bug fixes and a more expansive function libary, especially if it becomes popular or people start relying on it for pokemon scripting.

    Speaking of new features, if you have any suggestions or ideas for optimizations or features I should add, I'd be happy to hear that as well.

    Plans for the near future:

    • Expand upon stdlib. Right now it literally has 4 functions, and 1 FRLG-exclusive function (the FRLG-exclusive function in question is "nickname_frlg". For some reason I couldn't get it to work in RSE, it would just softlock. I tried every script I could find on the internet relating to nicknaming - nothing worked. Works fine in FRLG though. If someone could give me advice on this (how to bring up the nickname screen in rse) it would be appreciated).
    • Extensively debug and test FSE, mostly in-game. I'm not saying the compiler is bug-free by any means (which btw if you DO encounter a compiler bug, let me know ASAP), but at this point my focus isn't so much on the compiler being buggy, moreso the scripts that it generates actually working in-game. This is something I've honestly barely tested at this point, and really should've done more before release, but, I have tested a lot of the major things, and from what I've seen I don't think there'll be too many problems in that regard (though, again, if the compiler generates an invalid script or something, let me know).

    With all of that being said, have a great time with FSE, I really put a lot of work into it (40+ hours in total just to get to the first release version). And please don't be afraid to request stdlib functions, post bug reports, feature requests, literally anything, I imagine I'll probably be checking this thread a lot over the next little bit. Cya, and have fun,

    --ps4star
     
    Last edited:

    ps4star

    WITH A ROLLING PIN!
    11
    Posts
    8
    Years
  • UPDATE: Couple of things...

    1. Tutorial is now out: https://youtu.be/fI1cGKpfEDw
    2. v1.1 is now out! Not much notable changed, just some small bug fixes as well as multichoice now being a recognized command (don't know why it wasn't already, but yeah).

    Also I just realized you can't edit thread titles... guess it's stuck saying 1.0 forever now, rip.
     
    990
    Posts
    4
    Years
  • UPDATE: Couple of things...

    1. Tutorial is now out: https://youtu.be/fI1cGKpfEDw
    2. v1.1 is now out! Not much notable changed, just some small bug fixes as well as multichoice now being a recognized command (don't know why it wasn't already, but yeah).

    Also I just realized you can't edit thread titles... guess it's stuck saying 1.0 forever now, rip.

    You can edit them. Just go to "Use Full Editor". ☻
     

    ps4star

    WITH A ROLLING PIN!
    11
    Posts
    8
    Years
  • v1.2 was just released! What's new:

    - A not dumb way to do multi-line comments: you can now use ES multi-line comment syntax instead of &comstart/end (so that's /* to start, */ to end, though these still must occur on otherwise-empty lines).
    - showsprite and hidesprite can now take 0 arguments. If this happens, 0x800F is assumed to be the argument (0x800F is an in-game var which stores the people ID of the last person interacted with).
    - A bug (well more of a missing feature I guess) was fixed where if autobreak is on, but you insert your own linebreaks (be it \p, \l, \n, whatever) into a msgbox string, the search for a breakpoint would not reset. It now resets properly.

    EDIT: Shortly after releasing this update I realized there were a few more commands I could add, particularly involving hidesprite and flag checks. So I guess you can call this v1.2.1, or something. Anyway the new features in this mini-update are:

    - New command: fhidesprite [sprite] (flag). It simply calls hidesprite [sprite] and then setflag (flag). Can take 1 or 2 arguments. If 1 argument, the argument is the flag to set (0x800F is used for the hidesprite). If 2 arguments, argument 1 is the sprite to hide and argument 2 is the flag to set.
    - New command: stopif (flag). Sets up a check for if the flag is set. If it is, the entire script terminates immediately. To be more specific, it adds an ORG to the footer of the document called "@endScript" (which just ends the script), checks if the specified flag is set, and if it is, goto @endScript.
     
    Last edited:
    4
    Posts
    5
    Years
    • Seen Apr 17, 2024
    I assumed you looked at the actual Name Rater script in Emerald already? Something that you might have missed is that "special 0xA1" is called, which brings up the nicknaming screen (same for when you get a gift Pokémon).

    Would it be possible to make it where Advanced Map can open this and load the program up directly that way? Right now I have to open XSE, open FSE, make the script in FSE, copy it to XSE, then save. When I could just open XSE and make my changes there.
     

    DaleFails

    Pokémon: Giovanni Origins developer
    208
    Posts
    12
    Years
    • Seen today
    Awesome to see new Tools still being made. I'm getting on OK with XSE at the moment but with half a region to script I may just give this a go!

    Best of luck with the Tool!
     
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023

    If this program is a compiler that can make scripting into simpler to use/understand lines of text, why do I still need to paste into xse, why not just compile it directly to an offset straight from fse?

    If it worked that way I'd think it would be the go to choice for anyone working decomp, since they could script while still using the same syntax etc that they are more used to.
     
    Back
    Top