Nutty_101 0 Posted June 20, 2007 I am curious if we can execute SQF scripts without a physical file on the hard drive? At the moment i am having to write the files and i would really like to have the ability to just compile a string and run it. Share this post Link to post Share on other sites
sickboy 13 Posted June 20, 2007 I am curious if we can execute SQF scripts without a physical file on the hard drive? At the moment i am having to write the files and i would really like to have the ability to just compile a string and run it. e.g:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">call compile "string string string"; e.g:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_string="blablalbal"; call compile _string; e.g:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_string=format["tst_isServer=%1",isServer]; call compile _string; e.g:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_code={code to execute blablalbal}; call _code; or: [] spawn _code; You can even write multi line: e.g:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_code= { code to execute blablalbal; code to execute blablalbal; code to execute blablalbal; code to execute blablalbal; code to execute blablalbal; }; call _code; You can even write multi line: e.g:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_string= " code to execute %1; code to execute %2; code to execute %3; code to execute %4; code to execute %5; "; call compile format[_string, isServer, isPlayer Player, time, daytime, getPos Player]; if you want to run the code in a spawned instance Share this post Link to post Share on other sites
Nutty_101 0 Posted June 20, 2007 I will try again, i get a ton of formatting errors when i try to call or compile sqf formatted code. Seems to be only using SQS format so if i have it does not work. I guess i could just use a single line, that might be my issue. humm Quote[/b] ]if (blah) then { kljasdjf=1; } else { aslkdjf;alskdj=2; }; Share this post Link to post Share on other sites
Nutty_101 0 Posted June 21, 2007 Ahh, its my comments. I guess i cannot have them in there from what i see so far. Works: Quote[/b] ]_Test = "player sidechat ""eeooooo"";if (!True) then { hint ""HI!""; sleep(10); player setpos [0,0,0]; }; "; _go = compile _Test; call _go; Does not Quote[/b] ]_Test = "player sidechat ""eeooooo""; if (!True) then { hint ""HI!""; /* Testing comment errors */ sleep(10); player setpos [0,0,0]; }; "; _go = compile _Test; call _go; Nor does // Man, wish i would have tried harder. laugh.. Thanks man. Share this post Link to post Share on other sites
Nutty_101 0 Posted June 21, 2007 Thanks again SickBoy. That let me use a single script now to pull down running scripts from the database. Much cleaner and easier now. Share this post Link to post Share on other sites