Hi everyone, I've searched far and wide and I've seen everybody talking about libraries being used to modularize the logic in maps. So I got all excited, and started writing a bunch of galaxy functions in a .txt file and then I got stuck.
How do I put my galaxy script into my game?
I tried renaming it with a .SC2Lib extension and then importing it, but that didn't work. It turns out, .SC2Lib files are XML. That would explain things.
I also heard someone say that libraries are "easier to work with" but when I look at the generated XML, it's not very organized. It's all one big list of things referenced by IDs, I daresay that's impossible to work with.
You could use Beiers Galaxy++ Editor, which can automatically inject your script files.
Otherwise, yes, you will need to re-import them every time. You can also use custom script objects and copy&paste your code in them, but this has to be done every time as well.
Galaxy++ keeps giving me errors. How do I import them manually? I'm seeing mixed answers on the internet, and none that are recent. What's the most modern way to do it?
open your map and save it as a SC2Components file.
locate the folder "MAP_NAME.SC2Map" in your C: drive and open it.
Locate and open the file MapScript.galaxy.
override the "actual" map script.
The "actual" map script will expose the InitMap() function which is not shown by the editor.
Note, the commands "data->compile all" and "data->View Script" do not detect scripts created in this manner. The editor will allow you to save despite syntax errors. The best way to test your script is to actually play your map.
If you mean "How to put a galaxy script into a library," then you need to realize that there's the GUI/XML library and there's the actual library folder created by the modder in the "MAP_NAME.SC2Map" folder.
Yup, to create the GUI/XML library just use trigger module; doing it by hand is too prone to glitches.
launch the trigger module
right-click on a white space under the library area
select Library->New Library
Right-click on the new library. Select New->New Custom Script.
If your library requires an init function to be called, you can set the init function in the "Initialization function (optional)." Select your script/code to see it.
It's probably best to write the script with a third-party tool, then copy&past it into the library.
The other "library" is a folder that's created by modders under the S2MAP folder (you get the folder when you save your map as a component list).
Open your MAP_NAME.SC2Map folder
Create a folder called Library (or whatever you want)
Create whatever .galaxy file you desire in that folder
You can now reference that galaxy file in your script using the include command.
For example, i would type include "Library/PhysicsEngine" to include the file "PhysicsEngine.galaxy" in my MapScript.
It's obvious that the word library in SC2 is not completely analogous to what a library is in C plusplus. A library that's packaged as an XML is completely retarded, but hey so is Blizzard.
Hi everyone, I've searched far and wide and I've seen everybody talking about libraries being used to modularize the logic in maps. So I got all excited, and started writing a bunch of galaxy functions in a .txt file and then I got stuck.
How do I put my galaxy script into my game?
I tried renaming it with a .SC2Lib extension and then importing it, but that didn't work. It turns out, .SC2Lib files are XML. That would explain things.
I also heard someone say that libraries are "easier to work with" but when I look at the generated XML, it's not very organized. It's all one big list of things referenced by IDs, I daresay that's impossible to work with.
I'm missing something very simple. Help?
Thanks,
- Evan
Just import your .galaxy files into the map, and referencethem in a custom script block that indluces them.
Go play Antioch Chronicles Remastered!
Also, coming soon, Antioch Episode 3: Thoughts in Chaos!
Dont like mapster's ugly white? Try Mapster's Classic Skin!
Excellent, that should work then. But does that mean I have to re-import them every time I change them?
You could use Beiers Galaxy++ Editor, which can automatically inject your script files.
Otherwise, yes, you will need to re-import them every time. You can also use custom script objects and copy&paste your code in them, but this has to be done every time as well.
Galaxy++ keeps giving me errors. How do I import them manually? I'm seeing mixed answers on the internet, and none that are recent. What's the most modern way to do it?
Not sure if I can be of some help, but i guess trying wouldn't hurt.
I'm not quite sure what you're asking.
If you mean it literally, then
The "actual" map script will expose the InitMap() function which is not shown by the editor.
Note, the commands "data->compile all" and "data->View Script" do not detect scripts created in this manner. The editor will allow you to save despite syntax errors. The best way to test your script is to actually play your map.
If you mean "How to put a galaxy script into a library," then you need to realize that there's the GUI/XML library and there's the actual library folder created by the modder in the "MAP_NAME.SC2Map" folder.
Yup, to create the GUI/XML library just use trigger module; doing it by hand is too prone to glitches.
If your library requires an init function to be called, you can set the init function in the "Initialization function (optional)." Select your script/code to see it.
It's probably best to write the script with a third-party tool, then copy&past it into the library.
The other "library" is a folder that's created by modders under the S2MAP folder (you get the folder when you save your map as a component list).
You can now reference that galaxy file in your script using the include command.
For example, i would type include "Library/PhysicsEngine" to include the file "PhysicsEngine.galaxy" in my MapScript.
It's obvious that the word library in SC2 is not completely analogous to what a library is in C plusplus. A library that's packaged as an XML is completely retarded, but hey so is Blizzard.