• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Making a Galaxy Script

Status
Not open for further replies.
Level 9
Joined
Nov 28, 2008
Messages
704
Alright, as far as I can tell, it is not possible to convert a whole trigger to custom script. For functions, you can set it to only use the custom script section in the options, but then you cant use the function like a function, as far as I know; it doesnt seem to include the code you put in that section with the option checked anywhere.

So, does anyon eknow where to do this yet?

Also, any native lists INCLUDING all the GUI actions out there?

Finally, is there any way to standardize the names of GUI global variables in libraries short of checking shared ID? Or at the very least, if there is a way to do everything in galaxy, declare global variaibles in galaxy?
 
If you go to Window->Script Test, there is a little script editor with syntax highlighting and checking (compile all), and Data->View Script allows you to view and directly edit the map's script. You can't have script triggers like in wc3 though.

EDIT: After playing around with it, I can't find a way to save the edited script back to the map. This is FRUSTRATING :p
EDIT: GUI functions are callable with custom script by putting the "gf_" (Generated Function?) prefix in front of the function name. I don't know how to call them with GUI though. Global variables get "gv_" (Global Variable or Generated Variable?) and locals get "lv_". Parameters are "lp_"...

So many to remember!
 
Last edited:
Level 8
Joined
Jun 28, 2008
Messages
356
We need some tool to open the map files (like MPQ editor) and replace the MapScript.galaxy. The Import/Export Manager of the editor doesn't allow you to do that >_> After every little annoying thing like this I feel like Bill Gates is now working for Blizzard.

"Got you again (finger)"
 
Level 9
Joined
Nov 28, 2008
Messages
704
Exactly what we do not want is to have to do that. It is a useless step we should not have to do, and if I am working on a map with friends, chances are they will be using GUI.

Where does that leave me, a person who absolutely despises spending 30 seconds having to look up the arithmatic function just to add one to a counter?
 
Exactly what we do not want is to have to do that. It is a useless step we should not have to do, and if I am working on a map with friends, chances are they will be using GUI.
Meh, they could make external libraries that you "include" into your map script -- you could still work together.

But yeah, the Galaxy Editor is still in beta, and the Script Test window is proof that they are planning to incorporate galaxy in a better way in a future update.
 
Level 9
Joined
Nov 28, 2008
Messages
704
Some guy found a work-a-round for that issue:
http://forums.sc2mapster.com/development/tutorials/551-trigger-how-to-not-use-gui/
This way at least allows writing your own functions/structs/globals/locals.

Fantastic find. It works better with functions returning nothing. Dont even have to make the silly bool function at the end. Although you have to have something that finishes with a }.

Edit: Structs do not work. You cannot pass them into functions, nor access variables within them.

Code:
} //Stupid GUI workarounds.

struct MfProjectile
{
    unit user;
    fixed angleXY;
    fixed angleZ;
    fixed speed;
    fixed index;
};

MfProjectile[1000] MfProjList;

void MfProjectile_Init(MfProjectile* p)
{
    p->index = 1;
}

void roar(){

This completely invalidates what I leanred was possible at http://www.sc2mapster.com/api-docs/galaxy-language/structs/ .

:(

And on that note, pointers dont work yet either! What the hell, Blizzard?
 
Last edited:
Edit: Structs do not work. You cannot pass them into functions, nor access variables within them.
You cannot pass them to functions, true, but you can pass the array index and accessing the members is indeed possible.

And on that note, pointers dont work yet either! What the hell, Blizzard?
Pointers DID work, but they removed them.
 
Level 8
Joined
Jun 28, 2008
Messages
356
That work around reminds me of SQL Injections :D:D Anyways, ofcourse we need the ability to edit the whole map script by hand! GUI is pointless. It's way slower to code in GUI and still doesn't have all the possibilities a hand-written code has. Besides, the new Galaxy has a much easier syntax. It took me about 2 minutes to understand it >_> I don't see a reason why people would use GUI anymore.
 
Level 9
Joined
Nov 28, 2008
Messages
704
That work around reminds me of SQL Injections :D:D Anyways, ofcourse we need the ability to edit the whole map script by hand! GUI is pointless. It's way slower to code in GUI and still doesn't have all the possibilities a hand-written code has. Besides, the new Galaxy has a much easier syntax. It took me about 2 minutes to understand it >_> I don't see a reason why people would use GUI anymore.

I found JASS syntax more logical and easier to understand, but whatever.

The new GUI truly can do anything Galaxy can. Just, slower. For example, it requires at least 10 seconds to search for the arithmetic operation if you want to increment a variable. Typing? Half a second. var++;
 
I found JASS syntax more logical and easier to understand, but whatever.
Easier to understand if you didn't previously know any programming languages, but if you understand C/C++/Java/Almost Anything Else, Galaxy takes 2 minutes to learn.

The new GUI truly can do anything Galaxy can.
And more: it has libraries D:

You can't even use var++, it isn't supported. You have to do +=1 . But I get your point :p
 
Level 8
Joined
Jun 28, 2008
Messages
356
No, GUI cannot do as much as Galaxy can. Maybe it's my mistake, but I couldn't find anything in GUI that can do this:

Code:
set someIntVar = (Get key pressed)

I had to do:

Code:
set someIntVar = EventKeyPressed()

In other words, I had to use custom script. Also, you cannot do this in GUI:

Code:
if(something)
{

}

You have to do it:

Code:
if(something == true)
{

}

Or can you?
 
Level 8
Joined
Apr 5, 2008
Messages
367
Bad news I think.
I just read the developers chat from yesterday...

Q. Getting custom script into maps is currently complex. Are there plans to implement Galaxy scripting directly into the editor?
A. There are currently no plans for Galaxy script editing in the editor itself. However, through the Import Manager it should be pretty easy to add in your scripts as necessary. Are you having trouble doing it that way?
 
Level 3
Joined
Jul 12, 2007
Messages
50
Bad news I think.
I just read the developers chat from yesterday...

Q. Getting custom script into maps is currently complex. Are there plans to implement Galaxy scripting directly into the editor?
A. There are currently no plans for Galaxy script editing in the editor itself. However, through the Import Manager it should be pretty easy to add in your scripts as necessary. Are you having trouble doing it that way?

oh bloody hell... come on Blizzard, we want it built in! It is a pain in the ass using the import manager! :thumbs_down:
 
Status
Not open for further replies.
Top