• 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: Subscript: The next step for scripting

Le pug

Creator of Pokémon: Discovery / Fat Kid
870
Posts
10
Years
  • Besides being open source what's so good about this? Maybe i'm missing it but it doesn't seem to be any easier or shorter than xse scripts.

    given = Flag(0x828) why this instead of checkflag 0x828? It actually takes me longer to type that out that checkflag ... just trying to understand what will make it easier on the user over xse or are you trying to give something to the users that is more advanced than xse in terms of more experienced scripters? If someone could give the short sweet answer with some examples of how it's shorter and easier than in xse that'd be great
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    Besides being open source what's so good about this? Maybe i'm missing it but it doesn't seem to be any easier or shorter than xse scripts.

    given = Flag(0x828) why this instead of checkflag 0x828? It actually takes me longer to type that out that checkflag ... just trying to understand what will make it easier on the user over xse or are you trying to give something to the users that is more advanced than xse in terms of more experienced scripters? If someone could give the short sweet answer with some examples of how it's shorter and easier than in xse that'd be great

    It's not meant to be easier as in easier to learn, it's meant to be more logical. You don't have to be experienced to enjoy its features though. You don't have to type that out if you don't want to. It accepts numbers too. It's just better if you forget what you used flag 0x828 for. In the same way we use variable names in programming languages, you can now assign names to flags and the like. Yes, you could write this down. Yes, you could define the name, but that's an extra step that is actually unnecessary.

    This also has default parameters, it loads names from the ROM, custom functions, etc. It's also more readable, in my opinion. Additionally, the tool will have many more features than XSE ever had, including some (really basic) things it should have had, such as syntax highlighting, cross-platform support, etc.

    As for your example, I've made a really simple one:

    Here is the XSE script:

    Spoiler:


    Here is the Subscript code:

    Spoiler:


    74 lines for XSE, v.s. the 21 lines of Subscript. That's more than three times as short. Bear in mind that this example probably won't compile; I haven't added giveegg to Subscript yet. Also notice that the final "end" is implied - you only need it to prematurely terminate a script.

    Also notice that XSE requires those useless 0s after givepokemon. Subscript automatically assumes you want to give away Pokemon at level 5 without an item. If you want to change that, then only will you need the extra parameters. Also, notice how Subscript automatically looks up the Pokemon and item (and more) names from the tables in the ROM. If you change what your Pokemon are called, you can use that name within Subscript. If you have an ambiguous case, you can always use a number instead (givepokemon(1)).

    Subscript significantly lowers the amount of time it takes to create a script with many sections, gotos and jumps. Bear in mind that I left out flag checking (to ensure the event only happens once), etc. The more checks you do, the more time you save by using Subscript: it keeps track of all the sections for you.

    Here is the compiled subscript script. It looks almost identical to the XSE one. I had to comment out the giveegg function, but the rest worked.

    Spoiler:
     
    Last edited:

    Le pug

    Creator of Pokémon: Discovery / Fat Kid
    870
    Posts
    10
    Years
  • Spoiler:

    It looks interesting and I appreciate you showing me some of the stuff. I can see it's a little bit easier. I think this explanation will help others understand it better too. Thanks!
     
    25
    Posts
    9
    Years
    • Seen Sep 21, 2014
    Ello again! That bug I was talking about persists, most likely still due to me screwing up the script again somehow. But I'm more confident I did it right this time.

    Code I was trying to compile:
    Code:
    lock()
    message("Ello!", True)
    closeonkeypress()
    release()
    Error I received:
    Code:
    Traceback (most recent call last):
      File "/home/ahmylegs/subscript/interface/xse.py", line 96, in compile
        self.window.compile()
      File "gui.py", line 64, in compile
        script = subscript.compile.Compile(text, 0xDEADBEEF, self.rom)
    TypeError: __init__() takes 3 positional arguments but 4 were given

    Oh, and seem to be unable to save scripts. The bar labeled name seems to just look for folders and files, leaving me without any place to actually type the name. Image in the attachment, the window was cropped to remove personal info but you really are just missing the boarder around it.

    Thanks for your help in advance and hope I actually caught a problem this time.
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    Ello again! That bug I was talking about persists, most likely still due to me screwing up the script again somehow. But I'm more confident I did it right this time.

    Code I was trying to compile:
    Code:
    lock()
    message("Ello!", True)
    closeonkeypress()
    release()
    Error I received:
    Code:
    Traceback (most recent call last):
      File "/home/ahmylegs/subscript/interface/xse.py", line 96, in compile
        self.window.compile()
      File "gui.py", line 64, in compile
        script = subscript.compile.Compile(text, 0xDEADBEEF, self.rom)
    TypeError: __init__() takes 3 positional arguments but 4 were given

    Oh, and seem to be unable to save scripts. The bar labeled name seems to just look for folders and files, leaving me without any place to actually type the name. Image in the attachment, the window was cropped to remove personal info but you really are just missing the boarder around it.

    Thanks for your help in advance and hope I actually caught a problem this time.

    Yeah, that is an issue. Thanks for reporting it. You can go ahead and remove that positional parameter as it's not needed any more. I haven't merged the branch I'm currently working with the master branch, so it might take a while for me to actually push this change. I removed that parameter because languages are now automatically detected by game code.

    UPDATE: I'm currently working on features that allow subscript to automatically load language subsets: battlescripts, regular scripts, etc. Also, it will allow subsets of those languages, called "gem" (RSE) and "element" (FRLG). Additional languages and things will be available as plugins.
     
    Back
    Top