geloxo Posted July 1, 2013 Share Posted July 1, 2013 (edited) Hi, Is there a way to call a script from another script which is placed inside the mission file? The idea is as follows: I want to use a generic init.lua file that you load in the mission init. Then, as soon as mission starts the init.lua will execute the other scripts on its own. This is an alternative to avoid having to use the dofile for each single lua file I want to run using the triggers and be able to pack all the scripts inside a folder in the mission. Problem I faced is that I can´t access the mission itself from the init.lua. If I try to read the mission path with debug.getinfo( 1, "S" ).source it points to the location of the temporary file created when you run the mission, but not to the content of the file itself. Cheers Edited July 1, 2013 by geloxo Link to comment Share on other sites More sharing options...
Grimes Posted July 1, 2013 Share Posted July 1, 2013 env.mission is it the mission file and it is accessible via init. This is how mist compiles a list of all of the units within a mission. The order of operations so to speak of various script files is the following: 1. Initialization 2. "Group Activate condition" - That text box next to the groups activation %, you can run a function that is run in the initialization script assuming it is global. 3. Trigger Mission Start> Time Less than 5> Do Script 4. Do script/Do Script File via waypoint action of the first waypoint on a spawned group 5. Trigger Once> Time more 0> Do Script The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
geloxo Posted July 1, 2013 Author Share Posted July 1, 2013 Thanks Grimes, but I can´t understand how should I use this env.mission. As far as I have seen in mist I could access coalitions and those variables for instance from there, but this seems not to be what I need. Imagine I have a folder "scripts" with my "test.lua" script inside it and I place that folder inside the miz file via winzip. Then I run whatever the script at the mission init (let´s say a script called "initmyscripts.lua"). Then how could I call the "test.lua" from the "initmyscripts.lua"? Link to comment Share on other sites More sharing options...
Recommended Posts