SC2Mapster Forums

Resources > Third Party Tools

Galaxy++ editor

    #222 Jul 19, 2011 at 17:03 UTC - 0 likes

    Did you add a message to the report? If so, I would very much like to have the code.

    I would never include the user's code in the error reports without asking him. All I get is the message you type, and the location in my code where the error occurred.

    Edit: Uploaded a new version. v2.3.5

    • It is now possible to initialize struct/class fields. This works for both dynamic and static types.
    • Struct variables can now be marked as const.
    • When possible, the compiler will now remove const variables and replace refferences to the variable with a copy of the initializer.
    • Fixed a crash that occured when using delegates.
    Last edited Jul 19, 2011 by SBeier
    #223 Jul 20, 2011 at 09:00 UTC - 0 likes

    Awesome, thanks for the quick update!

    Speaking of update, it seems the editor crashes all the time once I've auto updated which makes me have to reinstall the editor. I'll send you a crash report on the next update

    #224 Jul 20, 2011 at 10:18 UTC - 0 likes

    Okay. The update feature appears to be working at my end.
    Could you try relaunching the editor when it crashes?
    Also, does the Update folder exists? If so, are there any files in it? If the Updater.exe file is there, is it still running?

    Could you try checking that at next update if it still crashes?

    #225 Jul 20, 2011 at 13:10 UTC - 0 likes

    Trigger declarations are bugged in the new version. Sent an error report.

    #226 Jul 20, 2011 at 13:53 UTC - 0 likes

    I'm gonna assume that all your source files are in folders. A fix for you until the next version should be to just create an empty script file outside of any folders.

    Edit:

    I uploaded a new version. v2.3.7

    • Struct/class fields can now be marked as static. There will only be one instance of static struct variables.
    • Fixed an issue where the compiler would sometimes crash when all source files is in folders.
    • Added enheritance. See documentation. (Note: no overriding, or casts)
    • Fixed an issue where initialized struct variables would overwrite any assignments done in the declaration of a local variable.
    • Fixed an issue where creating a new object with a constructor sometimes caused a crash.
    • Optimized method inlining.
    Last edited Jul 21, 2011 by SBeier
    #227 Jul 21, 2011 at 14:59 UTC - 0 likes

    @SBeier: Go

    Awesome, works like a charm now.

    Edit: The inheritance thingy looks real nice. I will probably use that a lot.

    Last edited Jul 21, 2011 by Robbatog
    #228 Jul 22, 2011 at 16:16 UTC - 0 likes

    I just uploaded another version. v2.4.0

    • Added generics. See documentation.
    • Added visibility modifiers. See documentation.
    • Updated the native library.
    • Fixed some more bugs.

    I did it so that I could make a generic list. In case anyone else could use that,
    http://www.sc2mapster.com/paste/3665/

    Last edited Jul 22, 2011 by SBeier
    #229 Jul 22, 2011 at 16:32 UTC - 0 likes

    Awesome! That'll come to use!

    Edit: would it be possible to make it possible to compile via a command line? That way it could work cross-platform aswell as making it possible to use any editor of choice. I would also probably contribute with a plugin for some other editor if this was implemented.

    Last edited Jul 23, 2011 by syltman
    #230 Jul 24, 2011 at 23:24 UTC - 0 likes

    Uploaded a new version. v 2.4.2

    • Fixed an issue with generics in some situations.
    • Fixed an issue where the compiler wouldn't cast from byte to text.
    • Fixed an issue where the editor wouldn't give suggestions for myNamespace.myField.<something>
    • Mouse wheel now scrolls 4 lines pr tick instead of 1.
    • Fixed an issue where locals declared in a for statement wouldn't be added to the suggestion list.
    • Optimized method inlining even more.
    • Added an option to change the font used in the editor.
    #231 Jul 27, 2011 at 08:52 UTC - 0 likes

    Soo, currently I am a little into galaxy scripting again, and I have some questions:

    • How to use structs? I tried to find it in your documentation, but I did not find, how to set up a constructor, how to create a struct instance and how to destroy one.

    I am used to Jass/ZinC structs mainly, which would be used like this:

    Struct Foo(){
         int b;
         int a;
         int r;
         static thistype create(){    //thistype equals Foo
             thistype this=allocate();   //allocates the new struct instance
             this.b=5
             .a=3
             r=1   //all 3 ways to set members are valid
             return this;    //constructor needs to return the struct instance
         }
    }
    

    How would this translate to G++?


    If you use a struct containing only methods and static members, your output script will not create a struct at all, but declaring an instance of the struct is still valid syntax for your input file and will be transferred in the output file, which causes a syntax error, because the struct doesn't exist in the output file.


    Are static methods possible? If I try it, I get an "expect constant or identifier" message.

    Last edited Jul 27, 2011 by Kueken531

    http://img577.imageshack.us/img577/4226/blaj.jpg

    #232 Jul 27, 2011 at 14:23 UTC - 0 likes

    To make that struct valid galaxy++

    //Not capital Struct, and no () in the struct declaration
    struct Foo
    {
        int b;
        int a;
        int r;
        //No static constructors - it wouldn't really make sense
        //Constructors are like methods, but have no return type, and the same name as the enclosing struct
        Foo()
        {   
            //thistype this=allocate();   //The struct will be allowcated when you call #new Foo(). Then the constructor will automatically be called
    	#this->b=5;//#this - not this, and -> instead of . since #this is a pointer to the newly created object
    	#this->a=3;//You were missing #this - really, .a is not valid
    	#this->r=1;//Yeah, r=1 should probably be valid, but at the moment, it isn't
    	//And you forgot a bunch of ; in those 3 lines.
            //return this;//Constructors don't return an instance - they are called after a new instance has been created by #new
        }
    }
    

    At the moment you can't make static methods.

    Last edited Jul 27, 2011 by SBeier
    #233 Jul 27, 2011 at 18:39 UTC - 0 likes

    @SBeier: Go

    My example was not meant to be "real" code, it was just an example, how the struct would roughly look in ZinC. Thanks for your help.


    So, I would get a new instance by calling:

    Foo* bar = #new Foo(); (or just #new Foo();)
    

    How would I destroy it?

    Last edited Jul 27, 2011 by Kueken531
    #234 Jul 27, 2011 at 18:48 UTC - 0 likes

    You would call

    #delete bar;
    

    In case you didn't know, there is a full documentation here
    http://www.sc2mapster.com/assets/galaxy-editor-beier/#w-pointers

    Last edited Jul 27, 2011 by SBeier
    #235 Jul 27, 2011 at 19:24 UTC - 0 likes

    Ah, the new and delete statements are explained in the pointers section. I tried to find them in the struct section.


    A suggestion: Would it be possible to include the Galaxy++ code in the map? Maybe as custom script or comment files, in the same folder structure you used in the G++ editor? This way, you have all your script in the map, and maybe you could add functionality to extract this script from the map to your editor; this way the additional script files would become obsolete.

    Its not desperately needed, though, but it might be very convenient. You could make this optional as well.

    Last edited Jul 28, 2011 by Kueken531
    #236 Jul 28, 2011 at 15:33 UTC - 0 likes

    Quote from Kueken531:
    Ah, the new and delete statements are explained in the pointers section. I tried to find them in the struct section.  

    A suggestion: Would it be possible to include the Galaxy++ code in the map? Maybe as custom script or comment files, in the same folder structure you used in the G++ editor? This way, you have all your script in the map, and maybe you could add functionality to extract this script from the map to your editor; this way the additional script files would become obsolete.

    Its not desperately needed, though, but it might be very convenient. You could make this optional as well.
    ----

    Like uncompiled? Because when you compile and run it should be compiled and in the output map?

    #237 Jul 28, 2011 at 16:05 UTC - 0 likes

    I think he means uncompiled - to keep all the map data in one file. It would require some restructuring, but it's of course not impossible

    Edit:
    Although, my compiler will not be able to save if the map is open in the normal editor.

    Edit2:
    I uploaded version 2.4.5

    • Added an option to automatically inline small methods (less than 3 statements).
    • Added some optimizations to remove assignments to local variables that are only used once.
    • Added an option to save the galaxy++ files inside the map (look in project properties).
    • You can now refere to struct variables from inside constructors without prefixing with #this.
    • Fixed an issue where fields who's type is a struct with no non static variables, was not removed.
    • Fixed some bugs.

    Edit3:
    A word of advice, make backups if you want to use the script to map feature. Were it not for my automatic backups, I would have lost my map script, because I told the editor to extract the script from the wrong map.

    Edit4:
    Fixed some bugs. v 2.4.6

    • Fixed a crash caused by string obfuscation.
    • Fixed a potential infinite loop in the script optimizations.
    Last edited Jul 29, 2011 by SBeier
    #238 Jul 30, 2011 at 21:37 UTC - 0 likes
    Quote:
    • Added an option to save the galaxy++ files inside the map (look in project properties).

    And there I thought, this might be too complicated and probably nothing you would care about too much. Piece of cake, huh?

    Gonna test this as soon as I get home.

    € how you write out your ++ without any visual indicator? I usually make one of the + bold ;) (or use plain text markup, but thats not what you did. Another markup?)

    €€ ah, me blind

    Last edited Jul 30, 2011 by Kueken531
    #239 Jul 30, 2011 at 22:50 UTC - 0 likes

    Well, I kindda cheated a bit, but from your point of view, it works as it should.

    I use the escape markup syntax.. {{{++}}}
    http://www.sc2mapster.com/wiki/knowledge-base/markup-types/

    Edit:
    I am a bit conflicted about the # in front of all the keywords, and would like to hear your opinions on them.. Should they stay or go?

    I kindda think that the code would look nicer without them, but of course, removing them would mean that galaxy code using the keywords as names would be invalid.. What do you guys think?

    Edit2:
    I found an error in my previous implementation of a generic list. In case any of you are using the list, I uploaded a fixed version.
    http://www.sc2mapster.com/paste/3681/

    Last edited Jul 31, 2011 by SBeier
    #240 Aug 01, 2011 at 18:50 UTC - 0 likes

    I was wondering, do static properties and methods exist? They would be really handy to have at times.

    #241 Aug 01, 2011 at 22:50 UTC - 0 likes

    I uploaded a new version. v2.5.0

    • Added a tool bar with some pretty buttons.
    • Added a right click menu with cut/copy/paste buttons. Also with pretty pictures.
    • Added a Map Object Browser, to give an overview of the units/doodads/regions/points/cameras placed in the map. Double click an item to insert it into the script.
    • Fixed some bugs.

    @Alevice: Go

    No, not at the moment

    -------------------------------

    No one really care whether or not the # are removed?

    Last edited Aug 01, 2011 by SBeier

You must login to post a comment. Don't have an account? Register to get one!