killerkiwi Posted March 12, 2016 Report Share Posted March 12, 2016 hello boy's and girl's i am releasing my fog script to night at 3am uk time random fog works well lot of people asked for it titleText ["picking random fog", "PLAIN DOWN", 3]; sleep 5; _var = random 1.80; //generates a random value between 0 and 1.80 if (_var < 0.20) then { execVM 'overwrites\click_actions\250.sqf'; } else { if (_var < 0.40 and _var > 0.20) then { execVM 'overwrites\click_actions\500.sqf'; } else { if (_var > 0.40 and _var < 0.60) then { execVM 'overwrites\click_actions\750.sqf'; } else { if (_var > 0.60 and _var < .80) then { execVM 'overwrites\click_actions\1000.sqf'; } else { if (_var > 0.80 and _var < 1) then { execVM 'overwrites\click_actions\1250.sqf'; } else { if (_var > 1 and _var < 1.20) then { execVM 'overwrites\click_actions\1500.sqf'; } else { if (_var > 1.20 and _var < 1.40) then { execVM 'overwrites\click_actions\1750.sqf'; } else { if (_var > 1.40 and _var < 1.60) then { execVM 'overwrites\click_actions\2000.sqf'; } else { if (_var > 1.60 and _var < 1.80) then { execVM 'overwrites\click_actions\2500.sqf'; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; titleText ["fog is now set relog to unset the change", "PLAIN DOWN", 3]; http://www.filedropper.com/clickactions TAF rocka, Richie and juandayz 3 Link to comment Share on other sites More sharing options...
Richie Posted March 13, 2016 Report Share Posted March 13, 2016 KillerKiwi was kind enough to share, if you don't like it then don't use it but don't bash. Thread cleaned, keep things civil please. Link to comment Share on other sites More sharing options...
killerkiwi Posted March 13, 2016 Author Report Share Posted March 13, 2016 Quote thanks you Richie this is a place were every one give out the custom work if you don't like it fuck off Link to comment Share on other sites More sharing options...
DangerRuss Posted March 14, 2016 Report Share Posted March 14, 2016 Just wanted to add this to a code block because it just looks so much nicer... titleText ["picking random fog", "PLAIN DOWN", 3]; sleep 5; _var = random 1.80; //generates a random value between 0 and 1.80 if (_var < 0.20) then { execVM 'overwrites\click_actions\250.sqf'; } else { if (_var < 0.40 and _var > 0.20) then { execVM 'overwrites\click_actions\500.sqf'; } else { if (_var > 0.40 and _var < 0.60) then { execVM 'overwrites\click_actions\750.sqf'; } else { if (_var > 0.60 and _var < .80) then { execVM 'overwrites\click_actions\1000.sqf'; } else { if (_var > 0.80 and _var < 1) then { execVM 'overwrites\click_actions\1250.sqf'; } else { if (_var > 1 and _var < 1.20) then { execVM 'overwrites\click_actions\1500.sqf'; } else { if (_var > 1.20 and _var < 1.40) then { execVM 'overwrites\click_actions\1750.sqf'; } else { if (_var > 1.40 and _var < 1.60) then { execVM 'overwrites\click_actions\2000.sqf'; } else { if (_var > 1.60 and _var < 1.80) then { execVM 'overwrites\click_actions\2500.sqf'; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; titleText ["fog is now set relog to unset the change", "PLAIN DOWN", 3]; Link to comment Share on other sites More sharing options...
ViseVersa Posted March 14, 2016 Report Share Posted March 14, 2016 1 hour ago, DangerRuss said: Just wanted to add this to a code block because it just looks so much nicer... Next Time put it in a Spoiler to, please :P Oh and the Title is wrong. This is ViewDistance, not Fog! And it`s not well optimized ^^ Link to comment Share on other sites More sharing options...
killerkiwi Posted March 15, 2016 Author Report Share Posted March 15, 2016 Quote thanks dude Link to comment Share on other sites More sharing options...
ViseVersa Posted March 15, 2016 Report Share Posted March 15, 2016 1 hour ago, killerkiwi said: Quote thanks dude Dude you just said Thanks to yourself and you quoted yourself ^^ wth is going on xD Link to comment Share on other sites More sharing options...
killerkiwi Posted March 15, 2016 Author Report Share Posted March 15, 2016 stop being a nob if you look at the code see the fog is in there nod cheese Link to comment Share on other sites More sharing options...
killerkiwi Posted March 15, 2016 Author Report Share Posted March 15, 2016 On 3/14/2016 at 6:26 PM, DangerRuss said: Just wanted to add this to a code block because it just looks so much nicer... titleText ["picking random fog", "PLAIN DOWN", 3]; sleep 5; _var = random 1.80; //generates a random value between 0 and 1.80 if (_var < 0.20) then { execVM 'overwrites\click_actions\250.sqf'; } else { if (_var < 0.40 and _var > 0.20) then { execVM 'overwrites\click_actions\500.sqf'; } else { if (_var > 0.40 and _var < 0.60) then { execVM 'overwrites\click_actions\750.sqf'; } else { if (_var > 0.60 and _var < .80) then { execVM 'overwrites\click_actions\1000.sqf'; } else { if (_var > 0.80 and _var < 1) then { execVM 'overwrites\click_actions\1250.sqf'; } else { if (_var > 1 and _var < 1.20) then { execVM 'overwrites\click_actions\1500.sqf'; } else { if (_var > 1.20 and _var < 1.40) then { execVM 'overwrites\click_actions\1750.sqf'; } else { if (_var > 1.40 and _var < 1.60) then { execVM 'overwrites\click_actions\2000.sqf'; } else { if (_var > 1.60 and _var < 1.80) then { execVM 'overwrites\click_actions\2500.sqf'; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; titleText ["fog is now set relog to unset the change", "PLAIN DOWN", 3]; thanks dude try to keep my code neat im just lazy at it like to keep code short as i can Link to comment Share on other sites More sharing options...
DangerRuss Posted March 19, 2016 Report Share Posted March 19, 2016 On 3/14/2016 at 3:40 PM, ViseVersa said: Next Time put it in a Spoiler to, please :P Oh and the Title is wrong. This is ViewDistance, not Fog! And it`s not well optimized ^^ There was literally no reason to add a spoiler. I was simply updating the original post with a code box so it was easier to copy paste. Link to comment Share on other sites More sharing options...
raymix Posted March 20, 2016 Report Share Posted March 20, 2016 Hi KillerKiwi I am glad to see people are still contributing some of their work around. Here's a quick tips on scripting: If you have to type it more than twice, put it in a function. When dealing with too many IF statements, it will be faster on runtimes if you use switch instead. That way engine does not need to execute multiple statements, instead it will execute one and compare given values which is faster and tidier. However in some examples like yours, to keep code small and tidy, duplicate code can be removed with a little bit of creativity :) _file = [250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500]; _rand = _file select floor random count _file; execVM format ["overwrites\click_actions\%1.sqf",_rand]; Enjoy the scripting, it's fun! Linux 1 Link to comment Share on other sites More sharing options...
killerkiwi Posted May 29, 2016 Author Report Share Posted May 29, 2016 On 20/03/2016 at 11:50 AM, raymix said: Hi KillerKiwi I am glad to see people are still contributing some of their work around. Here's a quick tips on scripting: If you have to type it more than twice, put it in a function. When dealing with too many IF statements, it will be faster on runtimes if you use switch instead. That way engine does not need to execute multiple statements, instead it will execute one and compare given values which is faster and tidier. However in some examples like yours, to keep code small and tidy, duplicate code can be removed with a little bit of creativity :) _file = [250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500]; _rand = _file select floor random count _file; execVM format ["overwrites\click_actions\%1.sqf",_rand]; Enjoy the scripting, it's fun! thanks dude keep that in mind working on a few scripts try my best to add thatin but like to make it look like i done more work with it Link to comment Share on other sites More sharing options...
creativv Posted May 30, 2016 Report Share Posted May 30, 2016 On Sunday, May 29, 2016 at 0:15 PM, killerkiwi said: thanks dude keep that in mind working on a few scripts try my best to add thatin but like to make it look like i done more work with it What raymix means , it's more optimized like that so will be faster , cleaner and create less burden on the engine . Making code large and big does not let it look like you did more work . It's actually only creating more work for the server . But indeed good people are still sharing nice work . Link to comment Share on other sites More sharing options...
killerkiwi Posted May 31, 2016 Author Report Share Posted May 31, 2016 ;) lol i no try this did't work On 20/03/2016 at 11:50 AM, raymix said: _file = [250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500]; _rand = _file select floor random count _file; execVM format ["overwrites\click_actions\%1.sqf",_rand]; Link to comment Share on other sites More sharing options...
raymix Posted May 31, 2016 Report Share Posted May 31, 2016 yeah cuz execVM requires to pass variable, even if empty. I just wrote that as an example how you can optimize code into "one liners", kinda missed that part, been a while I touched SQF Simply add empty array or anything else in front of it like so: [] execvm "stuff" And just to be on safe side, to make sure that string is generated before it's called, simply wrap the format in () like so: [] execVM (format ["overwrites\click_actions\%1.sqf",_rand]); It should work without it, but it's not a bad habit to have. sometimes people even create nil variable to store nothing in it since there's no response. I find this practice kinda lame, but to each its own. _nil = 0 execVM "stuff"; Link to comment Share on other sites More sharing options...
killerkiwi Posted May 31, 2016 Author Report Share Posted May 31, 2016 will this work private ["_file","_rand"]; _file = ([250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500]); _rand = _file select floor random count _file; [] execVM (format ["overwrites\click_actions\%1.sqf",_rand]); Link to comment Share on other sites More sharing options...
raymix Posted May 31, 2016 Report Share Posted May 31, 2016 no, you need to loose parentheses when you define array, _file = [1,2,3]; Link to comment Share on other sites More sharing options...
killerkiwi Posted June 1, 2016 Author Report Share Posted June 1, 2016 private ["_file","_rand"]; [] execVM (format ["overwrites\click_actions\%1.sqf",_rand]); _rand = _file select floor random count _file; _file = ([250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500]); what about this lol Link to comment Share on other sites More sharing options...
axeman Posted June 1, 2016 Report Share Posted June 1, 2016 You are calling (execVM) the sqf before declaring _file, try: private ["_file"]; _file = [250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500]; 0 = [] execVM format ["overwrites\click_actions\%1.sqf",selectRandom _file]; If you want to reduce it further: 0 = [] execVM format ["overwrites\click_actions\%1.sqf",selectRandom [250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500]]; https://community.bistudio.com/wiki/selectRandom Link to comment Share on other sites More sharing options...
axeman Posted June 1, 2016 Report Share Posted June 1, 2016 On 31/05/2016 at 2:44 AM, killerkiwi said: ;) lol i no try this did't work On 20/03/2016 at 11:50 AM, raymix said: _file = [250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500]; _rand = _file select floor random count _file; execVM format ["overwrites\click_actions\%1.sqf",_rand]; That will work perfectly fine. execVM doesn't require anything passing to it, at least not in Arma 3. I seem to remember using execVM and format in that way didn't used to work in A2, maybe that has been updated since ? Previously I would use a call compile to execVM dynamic scripts: call compile format["[] execVM ""overwrites\click_actions\%1.sqf""",selectRandom [250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500]]; A method I still use, out of habit, until now :) EDIT I don't think selectRandom is available for A2, I haven't currently got an install to test, this will work just as well as a replacement: call compile format["[] execVM ""overwrites\click_actions\%1.sqf""",[250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500] call BIS_fnc_selectRandom]; https://community.bistudio.com/wiki/BIS_fnc_selectRandom raymix 1 Link to comment Share on other sites More sharing options...
killerkiwi Posted June 1, 2016 Author Report Share Posted June 1, 2016 hmm try this don't work make a new random floor to night Link to comment Share on other sites More sharing options...
killerkiwi Posted June 1, 2016 Author Report Share Posted June 1, 2016 wait don't need to lol Link to comment Share on other sites More sharing options...
raymix Posted June 1, 2016 Report Share Posted June 1, 2016 12 hours ago, axeman said: That will work perfectly fine. execVM doesn't require anything passing to it, at least not in Arma 3. Oh shiet, you're right, I thought execVM works the same as Spawn which requires args at all times ( except it's reading the script from a drive not function in memory). Well, my excuse is that I've never really used execVM to be honest, always compiling my stuff in memory, heh. Link to comment Share on other sites More sharing options...
axeman Posted June 1, 2016 Report Share Posted June 1, 2016 The best way, compile then call :) Link to comment Share on other sites More sharing options...
axeman Posted June 1, 2016 Report Share Posted June 1, 2016 10 hours ago, killerkiwi said: wait don't need to lol Your best bet, when learning, is to step through each part in a Debug Console, that way you don't end up restarting your server to debug every small change. https://community.bistudio.com/wiki/Debugging_Techniques#Arma_2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now