• 🏆 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!

How to script in Galaxy Editor?

Status
Not open for further replies.
Level 8
Joined
Aug 4, 2006
Messages
357
I know this may be a really stupid question, but I am pretty damn confused right now. How do you script directly in the Galaxy language, rather than use GUI, in the sc2 editor? Is it possible to do something like world editor where you can convert GUI triggers to custom script? If not, I heard you can import custom script into your map script. Can anyone tell me how to do that? What about the Script Test window; how does that work?

Basically I would like to know every possible way to write triggers using scripts rather than GUI (because GUI sucks).

Thanks guys
 
Level 9
Joined
Nov 28, 2008
Messages
704
You can create a GUI trigger and add a multi line custom text. You can also, since this limits you to writing in actions, finish off functions with a } and then start writing your code. Finish off your custom void with your own construct that requires an end bracket (}). Sort of hard to explain, and I forget the site. It was a clever trick, but annoying workaround.

Dont forget to do control + d to view the map script.

Otherwise, you have to write the files out of editor and import them. I personally don't even know how to include my imported scripts, so yeah.

Kinda waiting for JNGP equivilent at this point.

Blizzard has stated it has no plans to add any more custom script support.
 
@real138

He already knew about the Script Test window, as you would know if you had fully read the first post.

@maskedpoptart

I'll explain properly what Mooglefrooglian tried to say:

You can make a new trigger, and insert a custom script action that goes like this:return 0;}. In other words, return the function and end it. Now you are free to include whatever custom script you like after that, including structs, include commands, new functions, whatever. You just need to remember to make a new function that returns a bool at the end of it, like this:bool end_YourTrigger () {. You need to do this because the compiler automatically puts that return true and endfunction at the end the trigger, as it doesn't expect you to have ended the function manually.

Now, to extend this: you can, as you seem to already be aware, import scripts into your map. But you don't know how to call them. This is how:
  • Import your script files into your map
  • Follow the steps above to make a custom script trigger
  • In that trigger, put an include line: include "yourscript.galaxy". The script name for the include should be in all lower case, even if the name in the import manager contains caps.
  • Use your script as you wish

I've attached a demo map:

PS: Should I post this as a tutorial? I guess it could help a lot of people...
 

Attachments

  • Galaxy Demo.SC2Map
    33.6 KB · Views: 112
Level 8
Joined
Aug 4, 2006
Messages
357
EoW, you should definitely make a tutorial out of this, in more detail (if you have the time). I have not yet found a tutorial of this kind, and I think it could be very helpful to many people. It would also encourage GUI users to switch to scripting, since they would actually have an option.
 
Level 9
Joined
Nov 28, 2008
Messages
704
Im just going to wait on Moonlight (lite?) and Andromeda. No point when pointers and structs dont even work at this point. Too hard to make a system: you have to prefix everything, which is just a bother, and yeah.
 
Im just going to wait on Moonlight (lite?) and Andromeda. No point when pointers and structs dont even work at this point. Too hard to make a system: you have to prefix everything, which is just a bother, and yeah.

Moonlite.
And we're all waitin' for that. :D

Structs DO work, and you don't need pointers when you have arrays (although they could make it a lot easier).

Any chance you could provide an example? They don't work for me. :/
 
Status
Not open for further replies.
Top