One thing I wanted to note; I've seen a few tutorials referencing the mapname_ID.scar file as the file you script in.
I would recommend against using this as it's a scar file that auto generates when the map is saved to store map-defined egroups/sgroups/markers. This means you'd have to be constantly backing up and copy+pasting work.
The engine will actually automatically execute a scar file that matches the map's sgb name.
For example: If your map is named MyMap.sgb, then it will have MyMap_ID.scar as the auto-generated file.
What you want to do is make a NEW scar file and call it MyMap.scar. You can then script to your heart's content (be sure to create an OnInit function and Scar_AddInit(OnInit) it!).
All you have to do is ensure you package this file with your other files (via Mod Tools or whatever application you use). Best part about it is you no longer have to worry about saving in the map and overwriting your work!
Happy scripting!
(ps: Don't forget to call import("ScarUtil.scar") on line one of your file so you can make use of our library of functions!)
EDIT: Here's sort of what it would look like:
Code
import("ScarUtil.scar")
function OnInit()
-- Here you can do stuff!
-- Like call another function
MyNewFunction()
end
Scar_AddInit(OnInit)
function MyNewFunction()
-- More stuff!
end