• 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

Touched

Resident ASMAGICIAN
625
Posts
9
Years
    • Age 122
    • Seen Feb 1, 2018
    Update: Alpha release - check the first post. Thanks to operator for helping by making the Windows release
     

    DJTiki

    top 3 most uninteresting microcelebrities
    1,257
    Posts
    10
    Years
  • I have a suggestion. This tool uses custom commands correct? So let's say we have a script like
    (I'm writing in XSE, to show an example)
    Code:
    msgbox @1 0x5
    compare LASTRESULT 0x1
    if 0x1 call @name
    
    #org @name
    call 0x1A74EB
    return
    
    #org @1
    = Name the Pokémon?

    So instead of using that. In another tab somewhere, we can register this script, and compress it as its own command. Therefore that short script for the naming pokemon, is one line. So this will be the result:

    Code:
    namepokemon

    So when the engine runs by our new command, namepokemon, now it will run the compressed script, cutting off alot of time. So a script to give a pokemon is now this:

    Code:
    givepokemon GALLADE 0x5 0x0 0x0
    [B]namepokemon[/B]
    waitstate
    release
    end

    Also, having the ability to go back to where you registered the script, and edit it, to debug it, and perhaps even delete it, will be nice.

    EDIT: Just thought of this, but what if, your newly created commands, made from compressed scripts, can be put in one single ini. file, so that we can share our commands with everyone, like a large file, containing new commands, for all the items or for all the Pokemon or something. :)
     
    Last edited:
    4
    Posts
    9
    Years
  • Install PyGObject, GtkSourceView and GtkSpell using your packaged manager.
    Users of Ubuntu-based distros will need to install these packages:
    • python3-gi
    • gir1.2-gtksource-3.0
    • gir1.2-gtkspell3-3.0
    • gir1.2-clutter-1.0

    You might want to include this info in the original post, because the package names that Ubuntu uses aren't quite obvious.
     
    Last edited:

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    I have a suggestion. This tool uses custom commands correct? So let's say we have a script like
    (I'm writing in XSE, to show an example)
    Code:
    msgbox @1 0x5
    compare LASTRESULT 0x1
    if 0x1 call @name
    
    #org @name
    call 0x1A74EB
    return
    
    #org @1
    = Name the Pokémon?

    So instead of using that. In another tab somewhere, we can register this script, and compress it as its own command. Therefore that short script for the naming pokemon, is one line. So this will be the result:

    Code:
    namepokemon

    So when the engine runs by our new command, namepokemon, now it will run the compressed script, cutting off alot of time. So a script to give a pokemon is now this:

    Code:
    givepokemon GALLADE 0x5 0x0 0x0
    [B]namepokemon[/B]
    waitstate
    release
    end

    Also, having the ability to go back to where you registered the script, and edit it, to debug it, and perhaps even delete it, will be nice.

    EDIT: Just thought of this, but what if, your newly created commands, made from compressed scripts, can be put in one single ini. file, so that we can share our commands with everyone, like a large file, containing new commands, for all the items or for all the Pokemon or something. :)

    Sadly, you cannot add commands with ifs and jumps at the moment. But I plan to alter that soon. Commands will be packaged in modules, like Python - not ini files. You can import them at the start of a script. Pokemon names and item names are automatically read from the ROM, so there will be no need to add them statically to a module or ini or whatever.

    At the moment, there is a "clean" button, which removes the most recently compiled script, but I will add your feature as soon as I get decompiling working. Decompiling isn't as simple to write as in XSE or similar editors, and will take time. Right now, the best you can do is save the script as a file and load it later to edit it.

    Users of Ubuntu-based distros will need to install these packages:
    • python3-gi
    • gir1.2-gtksource-3.0
    • gir1.2-gtkspell3-3.0
    • gir1.2-clutter-1.0

    You might want to include this info in the original post, because the package names that Ubuntu uses aren't quite obvious.

    Thanks for that. I'll add that to the main post. But clutter shouldn't actually be a dependency any more, so I'll fix that up.

    If anyone else wants to share the steps they took to install on another OS, it would be very much appreciated.
     
    4
    Posts
    9
    Years
  • Ubuntu

    Open a terminal and run:

    Code:
    $ sudo apt-get install python3 git python3-gi gir1.2-gtksource-3.0 gir1.2-gtkspell3-3.0 gir1.2-clutter-1.0
    $ git clone https://github.com/Touched/subscript.git
    $ python3 subscript/gui.py

    Thanks, and by the way, running it from any directory other than the project's root causes a FileNotFoundError. So more like:

    Code:
    $ cd subscript
    $ python3 gui.py
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    Thanks, and by the way, running it from any directory other than the project's root causes a FileNotFoundError. So more like:

    Code:
    $ cd subscript
    $ python3 gui.py

    Fixed, thanks. I'm going to add settings for config files and such later.
     
    25
    Posts
    9
    Years
    • Seen Sep 21, 2014
    I used the Ubuntu download instructions, but then I noticed that it doesn't include adding the test.gba ROM. Was able to do it in a graphic interface myself and get Subscript started.

    The first thing I did when I opened it up was click "View Script Command Help". Nothing happened except for this in the command line:
    Code:
    gvfs-open: _build/html/index.html: error opening location: Error when getting information for file '/home/usernamegoeshere/subscript/_build/html/index.html': No such file or directory
    Guessing this is some old code, kinda sucks that I can't start playing around with it. Would love to do a bit of testing to aid development, this sounds great. Cross platform + easy syntax!
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    I used the Ubuntu download instructions, but then I noticed that it doesn't include adding the test.gba ROM. Was able to do it in a graphic interface myself and get Subscript started.

    The first thing I did when I opened it up was click "View Script Command Help". Nothing happened except for this in the command line:
    Code:
    gvfs-open: _build/html/index.html: error opening location: Error when getting information for file '/home/usernamegoeshere/subscript/_build/html/index.html': No such file or directory
    Guessing this is some old code, kinda sucks that I can't start playing around with it. Would love to do a bit of testing to aid development, this sounds great. Cross platform + easy syntax!

    Sorry about that. I usually forget the steps that I took to get something working. I've updated the instructions. You simply need to run "make html" in the directory to build the documentation. After that, it'll open up the page in your default web browser when you click help.
    I'm going to add a change that doesn't require a "test.gba" ROM soon.

    Let me know if you have any more problems.
     
    25
    Posts
    9
    Years
    • Seen Sep 21, 2014
    One more thingy with getting it up and running; the make html command requires Sphnix. Didn't have it myself but thankfully I was provided a link to download it. Too bad I ended up having to download it in my package manager. Got everything up and running anyway eventually so it's all good.

    So I got it up and running. I open up the documentation without a hitch, get an idea for a basic script to try out, load up a FireRed ROM, click on the "New Script File" button, and...

    Code:
    Traceback (most recent call last):
      File "/home/username/subscript/interface/xse.py", line 93, in new_file
        self.window.new()
      File "gui.py", line 48, in new
        self.tabs.new('subscript')
      File "/home/username/subscript/interface/tabs.py", line 44, in new
        index = self.add_page(name, child)
      File "/home/username/subscript/interface/tabs.py", line 99, in add_page
        close = Gtk.Button.new_from_icon_name('window-close', Gtk.IconSize.MENU)
    AttributeError: type object 'Button' has no attribute 'new_from_icon_name'

    Whout Whout Whooooooooooh :(
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    One more thingy with getting it up and running; the make html command requires Sphnix. Didn't have it myself but thankfully I was provided a link to download it. Too bad I ended up having to download it in my package manager. Got everything up and running anyway eventually so it's all good.

    So I got it up and running. I open up the documentation without a hitch, get an idea for a basic script to try out, load up a FireRed ROM, click on the "New Script File" button, and...

    Code:
    Traceback (most recent call last):
      File "/home/username/subscript/interface/xse.py", line 93, in new_file
        self.window.new()
      File "gui.py", line 48, in new
        self.tabs.new('subscript')
      File "/home/username/subscript/interface/tabs.py", line 44, in new
        index = self.add_page(name, child)
      File "/home/username/subscript/interface/tabs.py", line 99, in add_page
        close = Gtk.Button.new_from_icon_name('window-close', Gtk.IconSize.MENU)
    AttributeError: type object 'Button' has no attribute 'new_from_icon_name'

    Whout Whout Whooooooooooh :(

    That sounds like you've got an outdated version of GTK. I'll add in some backwards compatibility with older versions, because vanilla Ubuntu doesn't have that in the main ppa. However, if in the interim you really would like to try it, add ppa:gnome3-team/gnome3 to your software sources and update GTK.
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    And that means Ubuntu package python3-sphinx, @Touched.

    Might be Precise. Trusty has it. (Just FYI.)

    Thanks, I'll add it to the list. I should probably still add support for GTK 3.8 and before though, but since Trusty is the new LTS edition (and GTK 12.2 is the stable release), I don't see why people haven't updated.

    The Ubuntu ppa I listed provides the most up to date GNOME packages though, so thats why I linked it (its the one I'm using - I'm running Ubuntu GNOME)
     

    Bliss

    Part-time Pegasister, Part-time PokéFreak
    415
    Posts
    10
    Years
  • XSE replacement? Already? I just switched to XSE like a month ago! xD

    Ah well, what I've read so far in these 3 pages of replies has my eyebrows raised and my mind racing. I'm really looking forward to a 'final' release!

    Question/suggestion: Will we still need to know the 'raw' values for movement? Like when you approach the Cinnibar Gym door without having the key and it moves you a step down. If not, I'd like to be able to type
    Code:
    movedown
    or
    Code:
    move-down
    or something like that. Not sure if it's really a big deal, but those raw commands scared me off pretty quickly last time I tried to make a really complex script.
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    XSE replacement? Already? I just switched to XSE like a month ago! xD

    Ah well, what I've read so far in these 3 pages of replies has my eyebrows raised and my mind racing. I'm really looking forward to a 'final' release!

    Question/suggestion: Will we still need to know the 'raw' values for movement? Like when you approach the Cinnibar Gym door without having the key and it moves you a step down. If not, I'd like to be able to type
    Code:
    movedown
    or
    Code:
    move-down
    or something like that. Not sure if it's really a big deal, but those raw commands scared me off pretty quickly last time I tried to make a really complex script.

    There will be a "movement helper", which will work similarly to XSE's text inserter. Right now, it uses a pathfinding algorithm to determine the shortest path between two coordinates, if you give it a map and bank name. I plan, however, to have a full blown path creator, so you can just click waypoints on the map and it will calculate the path, then you can select speeds and whatnot for each leg of the path. Otherwise, you can type movements in manually by saying something like:

    Code:
    applymovement(['lookdown', 'lookup', 'lookleft', 'lookright', 'exclamation']

    However, this is not functional as of yet - I haven't found the time to write a movement parser. With the current mechanism, I cannot do what you suggest (I explained in an earlier post) - but this will be changed shortly. But right now, no one is helping me and I cannot devote all my spare time to one project; therefore I cannot give you an exact time-frame.
     

    Bliss

    Part-time Pegasister, Part-time PokéFreak
    415
    Posts
    10
    Years
  • There will be a "movement helper", which will work similarly to XSE's text inserter. Right now, it uses a pathfinding algorithm to determine the shortest path between two coordinates, if you give it a map and bank name. I plan, however, to have a full blown path creator, so you can just click waypoints on the map and it will calculate the path, then you can select speeds and whatnot for each leg of the path. Otherwise, you can type movements in manually by saying something like:

    Code:
    applymovement(['lookdown', 'lookup', 'lookleft', 'lookright', 'exclamation']
    However, this is not functional as of yet - I haven't found the time to write a movement parser. With the current mechanism, I cannot do what you suggest (I explained in an earlier post) - but this will be changed shortly. But right now, no one is helping me and I cannot devote all my spare time to one project; therefore I cannot give you an exact time-frame.
    Thank you very much for explaining things. Sorry that you have to tackle such an ambitious project alone. If I had any experience with programming I would try to help a bit, but I doubt I would be of any use. (Not to mention, I'm quite busy IRL at the moment, and will be in the coming weeks/months..)

    This sounds like it will be an incredible feature, and one that I never realized I wanted. Being able to click way points will make it extremely easy for even a novice like myself to make a great movement based script that would normally require looking up a bunch of raw values and/or typing out each movement command in XSE. (which was way too confusing lol. Repeated test phases for one event really bugged me lol.)

    Oh, and I don't like to rush developers, be they hackers or programmers, rushing developers is a terrible idea. If you are lucky, rushing a developer will create buggy and poor content quality. If you aren't lucky, the developer will simply drop the project. I learned that one the hard way. :/ So please, take all the time you need! Real life has to come before hobbies, after all. :)

    Someday soon, I hope to make a full revival of my projects, and right now I'm really looking forward to using this program.

    Quick question: When the Linux version is in full release, will the Windows version be the same, or will it have to be re-coded and ported before it matches the latest version of Linux? I'm assuming you are a Linux user, based on previous posts. (I tried Linux Mint 17 a while ago, but the learning curve scared me off. Right now, I don't need speed. I just need a usable computer.) Being a Windows user, multiport programs are a bit out there for me, though I love the fact that so many can enjoy the use of a single program with no programming experience required.

    Ah, and will we see a script generator? Sorry if this has already been asked. It's 7:32 AM here and I've been up all night wasting time looking for some tools for Yellow hacking. To no avail, I might add.

    Thanks and keep up the great work!

    EDIT: Just realized I hadn't commented on the biggest thing here: The name! I actually like Subscript. It's simple and easy to remember, not to mention I'm 100% sure that it's never been used lol. It also embodies the simplicity of this program, and it's compatibility! I'd actually suggest keeping that name after final release. Just wanted to add that! Thanks for reading!
     
    Last edited:

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    Thank you very much for explaining things. Sorry that you have to tackle such an ambitious project alone. If I had any experience with programming I would try to help a bit, but I doubt I would be of any use. (Not to mention, I'm quite busy IRL at the moment, and will be in the coming weeks/months..)

    This sounds like it will be an incredible feature, and one that I never realized I wanted. Being able to click way points will make it extremely easy for even a novice like myself to make a great movement based script that would normally require looking up a bunch of raw values and/or typing out each movement command in XSE. (which was way too confusing lol. Repeated test phases for one event really bugged me lol.)

    Oh, and I don't like to rush developers, be they hackers or programmers, rushing developers is a terrible idea. If you are lucky, rushing a developer will create buggy and poor content quality. If you aren't lucky, the developer will simply drop the project. I learned that one the hard way. :/ So please, take all the time you need! Real life has to come before hobbies, after all. :)

    Someday soon, I hope to make a full revival of my projects, and right now I'm really looking forward to using this program.

    Quick question: When the Linux version is in full release, will the Windows version be the same, or will it have to be re-coded and ported before it matches the latest version of Linux? I'm assuming you are a Linux user, based on previous posts. (I tried Linux Mint 17 a while ago, but the learning curve scared me off. Right now, I don't need speed. I just need a usable computer.) Being a Windows user, multiport programs are a bit out there for me, though I love the fact that so many can enjoy the use of a single program with no programming experience required.

    Ah, and will we see a script generator? Sorry if this has already been asked. It's 7:32 AM here and I've been up all night wasting time looking for some tools for Yellow hacking. To no avail, I might add.

    Thanks and keep up the great work!

    EDIT: Just realized I hadn't commented on the biggest thing here: The name! I actually like Subscript. It's simple and easy to remember, not to mention I'm 100% sure that it's never been used lol. It also embodies the simplicity of this program, and it's compatibility! I'd actually suggest keeping that name after final release. Just wanted to add that! Thanks for reading!

    I doubt I'll make a script generator: I'm of the opinion that code should never be generated for anything other than time saving reasons, and I know that a script generator will only be used to ease the process of scripting. A generator will probably cause more problems than it fixes anyway. Take the time to learn how to script and you'll be better off for it.

    The Windows port (and hopefully Mac port when I get someone to do that for me), will be parallel to the Linux version when I do a first proper release. I'll create a script that automatically does the packaging for me. However, don't rely on them being the same now. If you want to be up-to-date, just download the Github repo as a zip and copy the contents over the old files in the package. That should work.

    Thanks for the feedback :)
     

    Bliss

    Part-time Pegasister, Part-time PokéFreak
    415
    Posts
    10
    Years
  • I doubt I'll make a script generator: I'm of the opinion that code should never be generated for anything other than time saving reasons, and I know that a script generator will only be used to ease the process of scripting. A generator will probably cause more problems than it fixes anyway. Take the time to learn how to script and you'll be better off for it.

    The Windows port (and hopefully Mac port when I get someone to do that for me), will be parallel to the Linux version when I do a first proper release. I'll create a script that automatically does the packaging for me. However, don't rely on them being the same now. If you want to be up-to-date, just download the Github repo as a zip and copy the contents over the old files in the package. That should work.

    Thanks for the feedback :)
    Taking the time to learn to script might have been a step too far for me to go with XSE or PKSV, but with Subscript, it might just be possible.

    Thanks for the info on how to properly patch the Windows version to keep it up to date. If I wasn't so busy IRL, I would already have downloaded the Windows release lol.

    Feedback is the biggest factor when it comes to development, in my opinion. Sometimes I voice my opinion without thinking, and other times I manage to think before I type. I'm just glad I haven't offended anyone with my lack of patience yet lol.

    Thanks for the quick reply~
     
    25
    Posts
    9
    Years
    • Seen Sep 21, 2014
    Ello! I did it! I think. I'm able to run pretty much everything in the program. I'm not that familiar with Python3 so most of my syntax is 2, hopefully that won't screw too much up.

    I got this error when compiling this script to a previously unhacked FireRed ROM loaded into subscript:

    Spoiler:

    This was the script I was trying to compile (it's my first script so I'm not exactly confident I got everything right):
    Spoiler:

    Let me know if you need more info.
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    Ello! I did it! I think. I'm able to run pretty much everything in the program. I'm not that familiar with Python3 so most of my syntax is 2, hopefully that won't screw too much up.

    I got this error when compiling this script to a previously unhacked FireRed ROM loaded into subscript:

    Spoiler:

    This was the script I was trying to compile (it's my first script so I'm not exactly confident I got everything right):
    Spoiler:

    Let me know if you need more info.

    I'm unable to reproduce your error. However, I managed to compile after fixing up your script. But well done on your first attempt. I understand it must be difficult without the proper documentation, and I mean to rectify that ASAP.

    Here is your repaired script. I've added comments to show you where you went wrong.

    Code:
    def ziggy():
        # Default parameter here. 0 not needed
        # Pokemon are looked up using the Pokemon type, with a string lookup. Otherwise you must use numbers
        givepokemon(Pokemon('zigzagoon'), 2)
        
        # Indentation can only occur at the start of a block
        message("There you go! If your\nZigzagoon faints you will be\nreturned here.")
        
        # Don't know what you wanted to do here. But x and y are undefined. Use the Var type if needed
        #getplayerpos(x,y)
    
    countparty()
    if LASTRESULT == 1:
        # Escape chars use backslash, not forward slash
        question("You only have one Pokemon!\nWould you like a Zigzagoon?")
        if LASTRESULT == 1:
            ziggy()
        else:
            question("Try again.")
            if LASTRESULT == 1:
                ziggy()
            else:
                # You can't have multiple parameters for the question command
                question("Okay punk, you wanna be/nsmart? You're messing with the\nGAME. You think you're gonna win? I'll ask you again.\nYou want a Zigzagoon?")
                if LASTRESULT == 1:
                    ziggy()
                else:
                    message("Oh man, you're screwed now.")
                    wildbattle(Pokemon('rayquaza'), 100, 0)
                    
                    # Why is there an infinite loop here? I've not added support for it, but you do it hackily like so.
                    # I don't think inifinite loops are needed, and there is no break statement yet
                    while LASTRESULT:
                        message("Wow! I never expected you\nto do that!")
                        wildbattle(Pokemon('rayquaza'), 100, 0)
    
    # pass is undefined. Use nop() instead. I'll change pass to nop shortly.

    Please keep in mind that not all Python features are supported. Even though subscript will highlight some words, not everything will work as expected. Off the top of my head, here are a few important keywords not present in subscript, either because there is no equivalent idiom, or because it's not supported

    • break
    • pass
    • yield
    • class
    • for
    • ...

    There will be more. Keep in mind that the errors aren't very specific as of yet - it's still the alpha after all. Also, not all the commands are complete, and some are renamed. Consult the help file to be sure. Thanks for using Subscript!
     
    25
    Posts
    9
    Years
    • Seen Sep 21, 2014
    As a beginner hacker, I could either learn a scripting language on tools that don't support my OS or just use this relatively limited and buggy but easier to use thingymajig. Willing to overlook it being in Alpha even if it goes against common sense. My Python might be extremely sloppy but hopefully it'll get better. Maybe.
    Code:
    # Escape chars use backslash, not forward slash
    I haven't used Python in ages but that was still pretty embarrassing...

    Big thanks for the help with the script, more than I would've hoped for.
     
    Back
    Top