clearVehicleInit – Talk
m (→Example error) |
Lou Montana (talk | contribs) m (Text replacement - "<code>" to "<code style="display: block">") |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
Are the effects of this command global or local? | Are the effects of this command global or local? | ||
--[[User:ViperMaul|ViperMaul]] 11:54, 25 June 2007 (CEST) | --[[User:ViperMaul|ViperMaul]] 11:54, 25 June 2007 (CEST) | ||
:Seems to be local to me. The vehicle's local init string is deleted, remote versions of the same string are not affected. --[[User:Ceeeb|Ceeeb]] 13:56, 17 February 2009 (CET) | |||
Should this be run before a vehicle is deleted? --[[User:Doolittle|Doolittle]] 21:01, 13 July 2007 (CEST) | Should this be run before a vehicle is deleted? --[[User:Doolittle|Doolittle]] 21:01, 13 July 2007 (CEST) | ||
Line 10: | Line 12: | ||
The example used, is incorrect as far as my tests show. It should be: | The example used, is incorrect as far as my tests show. It should be: | ||
<code>tank1 setVehicleInit "hint 'hi all'"; clearVehicleInit tank1; processInitCommands; </code> | <code style="display: block">tank1 setVehicleInit "hint 'hi all'"; clearVehicleInit tank1; processInitCommands; </code> | ||
[[clearVehicleInit]], clears the pending init commands, not those already processed. Once the init commands are processed, they can not be removed. Even if the vehicle is killed or deleted. | [[clearVehicleInit]], clears the pending init commands, not those already processed. Once the init commands are processed, they can not be removed. Even if the vehicle is killed or deleted. | ||
Line 17: | Line 19: | ||
My usual disclaimer applies, this was tested using a dedicated server running on the same machine as the client. So I may be wrong if it's running on a proper remote, dedicated server. [[User:UNN|UNN]] 13:31, 16 July 2007 (CEST) | My usual disclaimer applies, this was tested using a dedicated server running on the same machine as the client. So I may be wrong if it's running on a proper remote, dedicated server. [[User:UNN|UNN]] 13:31, 16 July 2007 (CEST) | ||
: This is true on all dedicated servers in JIP. A simple waituntil is required if array/variable setup is done by init.sq[f|s]. [[User:Salisan|Salisan]] | |||
I'm going to assume the "clears the pending init commands" is true; in this case the command is '''never safe to use''' because another thread can invoke processInitCommands at any time. You should instead be holding off on actually executing [[setVehicleInit]] until the last moment, when you're sure that's what you want. --[[User:MaHuJa|MaHuJa]] 13:59, 23 March 2012 (CET) |
Latest revision as of 11:53, 11 January 2023
Are the effects of this command global or local? --ViperMaul 11:54, 25 June 2007 (CEST)
- Seems to be local to me. The vehicle's local init string is deleted, remote versions of the same string are not affected. --Ceeeb 13:56, 17 February 2009 (CET)
Should this be run before a vehicle is deleted? --Doolittle 21:01, 13 July 2007 (CEST)
- No, no need for that. --raedor 10:52, 14 July 2007 (CEST)
Example error
The example used, is incorrect as far as my tests show. It should be:
tank1 setVehicleInit "hint 'hi all'"; clearVehicleInit tank1; processInitCommands;
clearVehicleInit, clears the pending init commands, not those already processed. Once the init commands are processed, they can not be removed. Even if the vehicle is killed or deleted.
It might also be worth noting that the timing of processed init commands during JIP means any functions loaded by init.sqf and certain commands like player. Will fail, unless the user intervenes with some sort of conditional loop or delay beforehand.
My usual disclaimer applies, this was tested using a dedicated server running on the same machine as the client. So I may be wrong if it's running on a proper remote, dedicated server. UNN 13:31, 16 July 2007 (CEST)
- This is true on all dedicated servers in JIP. A simple waituntil is required if array/variable setup is done by init.sq[f|s]. Salisan
I'm going to assume the "clears the pending init commands" is true; in this case the command is never safe to use because another thread can invoke processInitCommands at any time. You should instead be holding off on actually executing setVehicleInit until the last moment, when you're sure that's what you want. --MaHuJa 13:59, 23 March 2012 (CET)