Jump to content
Xplorer4x4

ExecuteCommand vs EnableSpecialLights

Recommended Posts

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 of

v.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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 queue

Caller 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 to

false, 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

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...