OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Vic on 06 Oct 2009, 16:44:55

Title: Running scripts from folder?
Post by: Vic on 06 Oct 2009, 16:44:55
Is it possible to run scripts from a folder? In OFP you could create a folder called "scripts" and you could run the scripts in there from any mission. I don't want to run them from a PBO or a mission folder, since I'd like to dynamically write those scripts using an external program.
Title: Re: Running scripts from folder?
Post by: tcp on 06 Oct 2009, 18:08:20
From the BIKI on execVM:
The Script is first searched for in the mission folder, then in the campaign scripts folder and finally in the global scripts folder.

I haven't tried this but I think the global scripts folder is referring to your Addons folder. So any script that is within a .pbo that is loaded could be executed. I assume that includes ones you load via modfolders. There might be a way to predefine functions linking to a script in a specific location, but I think the usual way would to treat the pbo as a folder. So a script.sqf inside myscripts.pbo would be called by execVM "myscripts\script.sqf";

Sorry for sound so vague, but I've never had to try it.
Title: Re: Running scripts from folder?
Post by: Vic on 06 Oct 2009, 21:28:39
Thanks, figured it out after a couple attempts.

[] exec "\myscripts\test.sqs" - where myscripts is a folder in the root ArmA dir
Title: Re: Running scripts from folder?
Post by: tcp on 07 Oct 2009, 00:49:34
cool, it's good that its a folder so its easier to modify
Title: Re: Running scripts from folder?
Post by: MRO204 on 07 Oct 2009, 01:12:24
you can also

[] exec "C:\MyDocuments\myscripts\test.sqs"

as an example.
Title: Re: Running scripts from folder?
Post by: i0n0s on 07 Oct 2009, 02:13:11
No, you can't this is fixed with a patch.