• 0

    posted a message on Galaxy Questions

    Galaxy doesn't support OOP unfortunately. So you can't have functions inside structs.

    WHAAUUUHHHHHH????

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions

    Does anyone know how to write functions inside of structs? It keeps giving me an error whenever I try.

    Also does anyone know what the syntax for referring to the object in question inside of a struct is? (like "this." in jass). What I mean is, when I call a function inside a struct using a certain object, how do I refer to the object I called with?

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions

    Ah I see, ty

    One last question and then (I think) I got it. Is there a way to have more than one initialization function per custom script page? It seems silly that I have to open up a different page for every function I want to run at map init.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions

    @Kueken531

    I tend to just write my own trigger conditions using an if/then at the beginning of the function so I guess I won't need to use the parameters at all.

    What exactly happens if I return false vs. true? Nothing (besides interrupting the code obviously)?

    and thanks again for all your help ^-^

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions

    € does this compile at all? Triggers need to use a function returning boolean with 2 boolean parameters. So instead of

    void TestFunction() you use

    bool TestFunction (bool a, bool b)

    ____________

    It compiles. You mean functions that are called by a trigger event use the 2 booleans? What do the two boolean parameters represent and what happens if I return true/false?

    Thanks for your help so far

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions

    "Create a trigger reacting to the timer expired event. There is no other possibility I know of."

    Thats unfortunate, thanks for the info. on wait timers though ________

    Can anyone possibly tell me why this code isn't working, i'm just trying to play around with galaxy a bit and I seem to be doing something wrong. I'm fairly certain my triggers/events are written wrong somehow.

    timer whut = TimerCreate();
    
    void DisplayText()
    {
        TriggerDebugOutput(1, StringExternal("Hello World"), true);
    }
    
    void InitDisplayText()
    {
        trigger DisplayTxTTrig = TriggerCreate("DisplayText");
        TriggerAddEventTimer(DisplayTxTTrig, whut);
    }
    
    //=========
    
    void TestFunction()
    {
        TimerStart(whut, 10, false, c_timeGame);
    }
    
    void InitTestFunction()
    {
        trigger TestFuncTrig = TriggerCreate("TestFunction");
        TriggerAddEventTimeElapsed(TestFuncTrig, .5, c_timeGame);
    }
    

    Any help would be appreciated ^-^

    Also btw does anybody know about a syntax highlighter add-on I can DL b/c the galaxy one is buggy as hell (atleast for me). It's half-highlighting some keywords and isn't highlighting others at all. And because the colors chosen don't constrast at all with the text, I can barely see what little highlighting it does do.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions

    Another question if you don't mind

    How do I start a timer and pass a function for it to run through when the timer is finished?

    i.e. something like:

    TimerStart(WhichTimer?, HowLong?, WhichFunction?)

    Theres gotta be one i'm sure

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions

    Thanks for all your replies ^-^

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions

    1) You can't destroy it per se. You can just overwrite all it's content and re-use it. There is no dynamic creation/destruction.

    Thanks ^-^

    2) You can get a unit's handle with a little trick: The function UnitGetPropertyInt(unit u, int property_index, bool current) can return things like the unit's health or energy. But when you give it a property index of more than 24 (I think it was 24) then you instead get an integer which is unique for every unit. However, the integer is always a multiple of 64. So you get 0, 64, 128, 196, 256, etc etc.

    I'll try that ty. I can't believe they didn't put in a native to get the handle ID of a unit but whatever I guess (that's blizz for you)

    3) The function is called UnitGroupClear( unitgroup )

    Does that completely destroy the group or just clear all units from it? I was wondering how to destroy a group object variable entirely so all the memory is freed up.

    4) Just like Jass, Galaxy does not have classes, nor real libraries. There also is no real way to declare vars or functions private. Only through VJass this was possible in Wc3. It's the same in Starcraft 2. There already is something like VJass (http://www.sc2mod.com/board/index.php?page=Board&boardID=16) but it's far less convenient to use and it suffers from Galaxy's shortcomings.

    Alright i'll just keep everything global then I guess.

    Thanks for all your help ^-^

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions

    Hey, i've just started using the galaxy editor and I have a few galaxy coding questions. I have prior experience using VJass, Java, and some C so I mainly just need to know syntax.

    1. How do I destroy an object I create via a struct (wipe the memory so I can use it again)

    2. How do I get the handle ID of a unit?

    3. How do I destroy a group

    4. How do I declare libraries/classes (or whatever they are called in Java) so that I can encapsulate functions and variables together and declare them private.

    Any help would be appreciated ^-^

    Posted in: Galaxy Scripting
  • To post a comment, please or register a new account.