Xplorer4x4 Posted March 24, 2014 Report Share Posted March 24, 2014 Not that it probably matters, but trying to make my scripts cleaner this time around (both in the interest of reading and game processing) and wondered what a better standard to follow would be. More or less I need to automatically trigger the floodlights when a certain action is executed by personnel. Is there any efficiency to be achieve by using:v.EnableSpecialLights(true);instead ofv.PushActionExecuteCommand(ACTION_APPEND, CMD_FLOODLIGHTS_ON, Caller, 0, false);I would think CMD_FLOODLIGHTS would technically require a tiny tiny tiny fraction more CPU power butt would actually activate the floodlight command in the UI. Quote Link to comment Share on other sites More sharing options...
MikeyPI Posted March 24, 2014 Report Share Posted March 24, 2014 Time to execute isnt really effected by either of these script commands, either way it has to pull up the cmd script just the same so imo the difference within these two script codes is so miniscule that it doesnt matter for game function.. For ease of alterations/understanding the first one is prefered by me. Just easier and faster for me. Quote Link to comment Share on other sites More sharing options...
Hoppah Posted March 24, 2014 Report Share Posted March 24, 2014 I wouldn't know what uses more CPU, but I'm guessing the second one because that one probably refers to a script that does the first one too. So more code for the same result. However, the difference is very very miniscule I wouldn't take the CPU usage into account.The second one is imo only diserable if you want to use that in a queue with other actions.Easy example:v.PushActionWait(ACTION_APPEND, 10.f);v.PushActionExecuteCommand(ACTION_APPEND, CMD_FLOODLIGHTS_ON, Caller, 0, false);The vehicle first waits 10 seconds, then executes the command thats connected to CMD_FLOODLIGHTS_ON.the code 'v.EnableSpecialLights(true)' enables the special lights instantly. Quote Link to comment Share on other sites More sharing options...
Xplorer4x4 Posted March 25, 2014 Author Report Share Posted March 25, 2014 Time to execute isnt really effected by either of these script commands, either way it has to pull up the cmd script just the same so imo the difference within these two script codes is so miniscule that it doesnt matter for game function.. For ease of alterations/understanding the first one is prefered by me. Just easier and faster for me. Yeah like I said tiny tiny tiny lol but was just curious really. I wouldn't know what uses more CPU, but I'm guessing the second one because that one probably refers to a script that does the first one too. So more code for the same result. However, the difference is very very miniscule I wouldn't take the CPU usage into account.The second one is imo only diserable if you want to use that in a queue with other actions.Easy example:v.PushActionWait(ACTION_APPEND, 10.f);v.PushActionExecuteCommand(ACTION_APPEND, CMD_FLOODLIGHTS_ON, Caller, 0, false);The vehicle first waits 10 seconds, then executes the command thats connected to CMD_FLOODLIGHTS_ON.the code 'v.EnableSpecialLights(true)' enables the special lights instantly. Yeah since the first is a built in command while the second is added on, I would think the first would utilize less CPU but given the faction of a percent in question, if it hurts your PC, well your PC isnt worth playing the game on lol. I was curious id the second would work, so thanks. Also, could you explain what the Caller, 0 and false mean? Quote Link to comment Share on other sites More sharing options...
The Loot Posted March 25, 2014 Report Share Posted March 25, 2014 Caller = What the command is being activated on. Caller is the the thing executing the command (Person/Vehicle/Object), and can also be Target if there is a separate object being affected.0 = ChildID (0 is default and is used even when there aren't different Child sections)False = Probably refers to repetition, but I'm not sure. Quote Link to comment Share on other sites More sharing options...
MikeyPI Posted March 25, 2014 Report Share Posted March 25, 2014 In reality either script can be used with a wait for example, the second one is really only desirable if you are doing further things aside from just lighting it up.v.PushActionWait(ACTION_APPEND, 10.f);v.EnableSpecialLights(true);The only time you'll see a GPU load time issue that makes it worthy of cleaning is for example in a mission script situation, where you simply have the thing looking through so many lines of code to find the reference it needs that it may cause delay.. But in the case of 1kb vs 1kb (or less not really enough of a difference to make such efforts even close to necessary. So if you make a missionscript perhaps cleaning is required since they can be 5-10k lines to just function, but in a normal command script unless it is doing something very complicated it will not require such effort. Quote Link to comment Share on other sites More sharing options...
Hoppah Posted March 27, 2014 Report Share Posted March 27, 2014 v.PushActionExecuteCommand(ACTION_APPEND, CMD_FLOODLIGHTS_ON, Caller, 0, false);v is the caller of the push action code. In this case you defined the Caller as v by using "Vehicle v(Caller);"ACTION_APPEND is the way it queues up, ACTION_NEWLIST is used to make a new queueCaller is used as the target in this exemple, if you have a target in your script (another vehicle), you can change that to 'Target' or any other defined object.0, is childID which can be used in the script it refers tofalse, has to do with the target too. Enabling it to true, it will use the check target code in the refered script I think.v.PushActionWait(ACTION_APPEND, 10.f);v.EnableSpecialLights(true);That won't work unfortunately. The PushActions in a commandscript are all executed at once, with the exception of the queued actions using ACTION_APPEND. Placing v.EnableSpecialLights(true) at either the top or the bottom of the PushActions will give the same result, because v.EnableSpecialLights(true) is not part of the queued actions.Hoppahi Quote Link to comment Share on other sites More sharing options...
The Loot Posted March 27, 2014 Report Share Posted March 27, 2014 That won't work unfortunately. The PushActions in a commandscript are all executed at once, with the exception of the queued actions using ACTION_APPEND. Placing v.EnableSpecialLights(true) at either the top or the bottom of the PushActions will give the same result, because v.EnableSpecialLights(true) is not part of the queued actions. Â Yep. If an action isn't set up as a PushAction, and you want it to go in a sequence, create a dummy command with the action you want and then place it in a PushAction. I ended up using that a lot with Headlights and Special Lights. Quote Link to comment Share on other sites More sharing options...
MikeyPI Posted March 27, 2014 Report Share Posted March 27, 2014 *modeler not scripter, trying to learn it though I know more theory than implementation =/ Quote Link to comment Share on other sites More sharing options...
Hoppah Posted March 28, 2014 Report Share Posted March 28, 2014 *modeler not scripter, trying to learn it though I know more theory than implementation =/ Quote Link to comment Share on other sites More sharing options...
Xplorer4x4 Posted March 30, 2014 Author Report Share Posted March 30, 2014 http://www.wormsandgermsblog.com/uploads/image/Petting%20dog.jpgLMAO! Thanks for the info guys. Will have to read over it when my heads more clear. Quote Link to comment Share on other sites More sharing options...