• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Galaxy variables

Status
Not open for further replies.
Level 2
Joined
Aug 6, 2009
Messages
21
Hello,

I'm trying to write in custom script in galaxy editor, i'm can achieve something from it, but for now, I've no idea how to declare any variable via custom script.

I've tried to read from script,
JASS:
    // Variable Declarations
    int lv_a;

    // Variable Initialization
    lv_a = 0;

That's from script when I create variable via gui, but if i create variable via custom script like that:
JASS:
    int lv_b;
    lv_b = 0;

It just gives me syntax error in int lv_b; side.

So, can i create variables via custom script, or it's not implemented?

Thanks for response.
 
Level 8
Joined
Aug 4, 2006
Messages
357
you can only create local variables at the beginning of a function definition. so if you are in a gui trigger, and use the custom script action to create local variables, it will not work since the trigger will automatically put stuff like
JASS:
if(!runActions){
    return true;
}
at the beginning of the Actions function, before your custom script. You can, however, use custom script to create local variables for gui functions. Personally, I prefer to do everything through custom script so I have complete control over my code.
 
Level 2
Joined
Aug 6, 2009
Messages
21
So, it means that I can't declare variables with custom script action? But if i write triggers with custom script trigger, any variables that I declare, will multiple "a" in various triggers ruin my triggers all over?

But thanks for response.
 
Last edited:
Level 11
Joined
Aug 1, 2009
Messages
963
You can't unless you create an entire custom script section, which you probably should if you want to code Galaxy. Also, multiple local variables in different functions will not cause conflicts (locals are declared inside functions, globals are declared outside of them).
 
Level 2
Joined
Aug 6, 2009
Messages
21
Thanks for response, you've helped me a lot.

A day passed, and I'm learning how to write own triggers via custom script =)
 
Status
Not open for further replies.
Top