SC2Mapster Forums

Development > Galaxy Scripting

How to start

  • 13 posts
    #1 Feb 11, 2012 at 08:20 UTC - 0 likes

    Hello there. In WCIII time I wrote triggers via vJass and after on cJass. Now SCII time =) Dont like GUI... so how to start? What I must download.. etc?

    OMG! New hero in 'Heroes of the Storm' is Dustin Browder. Watch here!

    #2 Feb 11, 2012 at 11:32 UTC - 0 likes

    Hey.

    For SC2, there is no standard language extention yet, like vJass was for WC3. However, coding in plain Galaxy in the editor is a pain in the ass, just like back in WC3.
    There are several language extensions in development; I have made good experiences with Galaxy++ so far. The language supports pointers, classes, namespaces and various other OOP-ish features, while the editor supports syntax-highlighting, autocompletion, parameter lists etc.
    However, some of the other extentions do look promising as well.

    If you don't want to settle for an extention yet, I recommend using Notepad++ with syntax highlighting and autocompletion options, which you can find here in the forums as well.

    With a coding background and experience with C-syntax, you won't have any problems besides getting to know and memorizing function names, which should be easy with a good auto-completion.

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

    #3 Feb 11, 2012 at 20:10 UTC - 0 likes

    Sorry for hi-jacking the thread; I thought it would be better to post here, than creating a new one.

    How to get started with galaxy scripting, with no experience in C?

    Developer of Aradia

    #4 Feb 12, 2012 at 02:42 UTC - 0 likes

    All you really need to learn then is the syntax and the names of the functions.. You can learn that by staring at some code, if you know what it is doing.

    One way of doing it is to write something in GUI, and then looking at the generated script (ctrl-F11 in the triggering editor), to figure out what GUI corresponds to what galaxy code.

    Also, a while back, I made some videos about the features of galaxy++.. The language has changed a bit since then, but you should still be able to learn from them..
    http://www.sc2mapster.com/forums/development/galaxy-scripting-and-trigger-lib/23993-intro-videos-to-galaxy/
    Do note the red text at the start of the thread ;)

    Those videos obviously doesn't show you pure galaxy, but I would recommend g++ over pure galaxy, simply because it removes some annoyances, and makes things easier..
    But then - I created it, so a recommendation from me is not saying much.

    #5 Feb 12, 2012 at 07:22 UTC - 0 likes

    @ScorpSCII: Go

    Read up on the basics of C, in particular the following topics:

    • Data types
    • Boolean and mathematical operators
    • Looping
    • Functions (Return type, parameters, global/local scopes etc)
    • Usage of existing library functions (#Includes aka Directives)

    Here's a good link I found the other day. Its about C+ +, but it teaches many of the basics of the language. http://www.cplusplus.com/doc/tutorial/

    Start with learning how to get a function to print hello world. Thats the easiest

    Another method is to build a simple trigger with GUI, then press Ctrl+F11 and study how the script works Then try it yourself. Once you understand the structure of triggers and how they work it becomes pretty easy.

    They always take on the following structure:

    bool MyFunction(bool TestConds, bool RunActions){
        //Vars
    
        //Conds
    
        //Actions
        return true;
    }
    

    The parameters for this structure are used for checks whether or not to check the conditions or whether to run the actions. But I personally don't find myself using them much as I only run trigger threads when I need to, thus I forego the need for condition/action checking.

    And require you to run TriggerCreate("MyFunction"); to create the trigger or action. Once the trigger is created, you can start adding events to it, but of course, make sure you saved the Created trigger into a trigger type variable so you can call it back.

    Another tip, In C, you will typically have an int main() function to initialize every other program thread that needs to run in your processor. In Galaxy this is replaced by void InitMap(){ } If i'm not mistaken, check Ctrl+11 to confirm. It should be right at the bottom.

    Keep note that the sequence of functions you declare also matters. Any function call you make should be to a function that was already written somewhere higher up in your code sequence, or the compiler will spit out errors telling you it can't find the function.

    Sorry if this is really concise or filled with jargand. Sorta typin in a blaze and too tired to think >_> if you need me to elaborate on anything just pop a note here, I'll check back.

    Last edited Feb 12, 2012 by FuzzYD
    Works
    AoS2
    Coder
    Boss Bars+
    Custom boss bars
    GXML
    Dialog XML parser
    Project W
    Coder
    RandNAligning dialog labels

    #6 Feb 12, 2012 at 08:00 UTC - 0 likes

    wow wow guys.. I know about c, i know about jass. I dont know how to convert gui into script (like in wc3) and write on it) thx for answers.. will read)

    #7 Feb 12, 2012 at 10:45 UTC - 0 likes

    @xxxNEARBYxxx: Go

    The last two answers were mainly aimed at me, as I kind of hijacked your thread. Also, you cannot directly convert GUI into script, but you can make a trigger, and then insert a Custom Script in the actions.

    @FuzzYD: Go @SBeier: Go

    Thank you so much for your answers, I'll see if I can learn some basic C.

    #8 Feb 12, 2012 at 12:32 UTC - 0 likes

    @ScorpSCII: Go

    You can convert it to script if you'd like. It's actually already converted for you. The triggers you make get converted into galaxy and saved into a galaxyscript file.

    In order to directly edit the trigger by script, save your map as a component file. Then open the galaxyscript file with a text editor program. Save your changes and reopen the saved map. Viola, done.

    @FuzzYD: Go

    Pretty sure the order of functions don't matter since galaxy makes function prototypes for you.

    Last edited Feb 12, 2012 by Enexy

    Project Rise of Nigma

    RoN Logo

    #9 Feb 12, 2012 at 12:37 UTC - 0 likes

    Yes, or use CTRL + F11 in the trigger editor, like mentioned earlier. Unfortunately, both methods only show you the entire map script; there is no easy way to convert just a single trigger into custom script like back in WC3.

    #10 Feb 12, 2012 at 15:38 UTC - 0 likes
    Quote from Enexy: Go

    @FuzzYD: Go

    Pretty sure the order of functions don't matter since galaxy makes function prototypes for you.

    Only if you use GUI. If you code your functions entirely with custom script, there will be a need to manually declare prototypes.

    #11 Feb 13, 2012 at 01:01 UTC - 0 likes

    @FuzzYD: Go

    If you use Galaxy++, it is done automatically again ;)

    Last edited Feb 13, 2012 by Kueken531
    #12 Feb 13, 2012 at 09:39 UTC - 0 likes

    @Kueken531: Go

    Nice :D Has Beier launched a stable release yet? I'll consider a move but as of now I'm somewhat of a purist >_<

    #13 Feb 13, 2012 at 14:50 UTC - 0 likes
    Quote from FuzzYD: Go

    Nice :D Has Beier launched a stable release yet? I'll consider a move but as of now I'm somewhat of a purist >_<

    I don't know, if he himself considers it stable yet, but I have used it from the start and hardly had any issues with it; and even when I had, I mentioned them to Beier and they were fixed within days.

    Its your decision to make, but I honestly don't want to code without it anymore :)

  • 13 posts

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