I've clarified on the Script Editor part. My apologies for the misunderstanding. I do not use any other part of the editor at all, so that was all I thought about.
All includes are relative to the root dir in the MPQ. So in my example since everything is in the Cortex folder ALL of my includes (even the ones from inside Cortex) must begin "include Cortex/...".
Also, you have to hit the save button in the import manager before you can compile test accurately.
Step 2: Open the editor and the map you want to insert your custom code into.
Step 3: Open the Script Editor (Inside Trigger Editor, Data -> View Script or Ctrl + F11) and edit it by adding an include at the top (under "include 'TriggerLibs/natives'" though). Also add to the MapInit function your initializer in the included file.
Your new MapScript.galaxy file might look like:
include"TriggerLibs/NativeLib"include"MotiveMe/Main.galaxy"//--------------------------------------------------------------------------------------------------// Library Initialization//--------------------------------------------------------------------------------------------------voidInitLibs(){libNtve_InitLib();libMotv_InitLib();// this is defined in MotiveMe/Main.galaxy!}//--------------------------------------------------------------------------------------------------// Map Initialization//--------------------------------------------------------------------------------------------------voidInitMap(){InitLibs();InitTriggers();}
Step 4: Once that's done, hit the compile button IN THE SCRIPT EDITOR. Make sure everything's up to spec! But you're not done yet!
Step 5: Hit the save button and export your MapScript.galaxy file to, for example, "MainScript.galaxy".
Step 6: Open the import manager (alternatively, you may use an MPQ editor capable of editing SC2 files for this purpose), and import the exported Galaxy file again.
Step 7: Rename the Galaxy file you just imported to MapScript.galaxy and hit save. This will overwrite the editor-generated one.
Step 8: Save and run! If you open the script editor again, your MapScript.galaxy file will be reset. Be warned.
This method is probably the best method for writing Galaxy code outside of the editor atm. You can do all sorts of powerful things with it like write half your code in GUI and the other half in Galaxy if you're smart. ;)
The methods in this tutorial still work, and it's extremely useful for including custom Galaxy libraries. I still use the same methods for my map.
I've clarified on the Script Editor part. My apologies for the misunderstanding. I do not use any other part of the editor at all, so that was all I thought about.
@XSharp: Go
Not really. A lot of people are using this method now successfully.
@Ttn114: Go
All includes are relative to the root dir in the MPQ. So in my example since everything is in the Cortex folder ALL of my includes (even the ones from inside Cortex) must begin "include Cortex/...".
Also, you have to hit the save button in the import manager before you can compile test accurately.
@akastar: Go
No. Use the import manager in your SC2Map MPQ file, not the SC2 MPQs.
Data -> View Script (Ctrl + F11)
This is the method I use to import my .galaxy scripts into the editor and have them work.
Step 0: Back up your map before attempting this! Really! There's a lot of potential for screwups.
Step 1: Write some galaxy code! Ideally, all your code should be in a folder like "MotiveMe" so your directory structure might look like.
Step 2: Open the editor and the map you want to insert your custom code into.
Step 3: Open the Script Editor (Inside Trigger Editor, Data -> View Script or Ctrl + F11) and edit it by adding an include at the top (under "include 'TriggerLibs/natives'" though). Also add to the MapInit function your initializer in the included file.
Your new MapScript.galaxy file might look like:
Step 4: Once that's done, hit the compile button IN THE SCRIPT EDITOR. Make sure everything's up to spec! But you're not done yet!
Step 5: Hit the save button and export your MapScript.galaxy file to, for example, "MainScript.galaxy".
Step 6: Open the import manager (alternatively, you may use an MPQ editor capable of editing SC2 files for this purpose), and import the exported Galaxy file again.
Step 7: Rename the Galaxy file you just imported to MapScript.galaxy and hit save. This will overwrite the editor-generated one.
Step 8: Save and run! If you open the script editor again, your MapScript.galaxy file will be reset. Be warned.
This method is probably the best method for writing Galaxy code outside of the editor atm. You can do all sorts of powerful things with it like write half your code in GUI and the other half in Galaxy if you're smart. ;)