killzone_kid 1332 Posted May 26, 2013 I've written a page with explanation on these commands from my own experiments. The lack of official documentation is what makes ArmA so difficult to begin with. http://killzonekid.com/arma-scripting-tutorials-distancesqr-linearconversion-difficulty-setammo-drawicon3d/ 1 Share this post Link to post Share on other sites
.kju 3245 Posted May 26, 2013 good stuff mate :) one thought: unless you want to make a new post for each post, might be better to name this topic along the lines of "insights new scripting commands" did you test if setAmmo can be applied to any vehicle turret? drawIcon3D looks nice. did you try with while true do loop without a sleep instead of onEachFrame? Share this post Link to post Share on other sites
killzone_kid 1332 Posted May 26, 2013 (edited) ;2402044']good stuff mate :)one thought: unless you want to make a new post for each post' date=' might be better to name this topic along the lines of "insights new scripting commands" did you test if setAmmo can be applied to any vehicle turret? drawIcon3D looks nice. did you try with while true do loop without a sleep instead of onEachFrame?[/quote'] When you are looking for arma commands in google having the title with the actual command names is better and easier to find, I know I've been googling a lot for arma commands trying to find any info. (this thread already shows if you search for "setAmmo arma" under BIS forums) You can apply it to the currentWeapon turret manned by a player, so I don't see why not. There is no reason to do while true loop on drawIcon3D, you only need it on every frame. But yeah you can use it with while true. Edited May 26, 2013 by Killzone_Kid Share this post Link to post Share on other sites
.kju 3245 Posted May 26, 2013 onEachFrame is not multiplexing - you have your reason now :) Add a small delay and you get near each frame frequency. Share this post Link to post Share on other sites
killzone_kid 1332 Posted May 26, 2013 what kind of mltiplexing are we talking about and when do one need one? Share this post Link to post Share on other sites
.kju 3245 Posted May 26, 2013 See: https://dev-heaven.net/issues/54314 Situation: Mission wants to use onEachFrame, addon 1 wants to, addon 2 wants to, mod 1 wants to. Only one will be active. Share this post Link to post Share on other sites
killzone_kid 1332 Posted May 26, 2013 ;2402171']See: https://dev-heaven.net/issues/54314Situation: Mission wants to use onEachFrame' date=' addon 1 wants to, addon 2 wants to, mod 1 wants to. Only one will be active.[/quote'] I see what you mean. Was never interested in using someone else's code if I can write my own. If you don't know how, look up how someone else has done it and write your own - the only way to know for sure what you are doing. Here is an example. Using while true loop because someone else might have used onEachFrame. One word - inefficient. Frame rate goes up and down, but your delay stays the same. Lets say you are aiming at 100 fps, so you use 0.01 delay, if performance drops to 30 fps you are executing said script 3 times per frame when you could have been executing it once per frame. If I would need to replace onEachFrame I would go FSM route and not while true Share this post Link to post Share on other sites
kremator 1065 Posted May 26, 2013 ;2402171']See: https://dev-heaven.net/issues/54314Situation: Mission wants to use onEachFrame' date=' addon 1 wants to, addon 2 wants to, mod 1 wants to. Only one will be active.[/quote'] Is there a ticket we can vote for ? This does sound quite important ! Share this post Link to post Share on other sites
.kju 3245 Posted May 27, 2013 One can adjust the sleep delay based on the runtime to get approximation/normalization like: while {true} do { _time = time; AAS_PublicServerTime = floor(time); publicVariable "AAS_PublicServerTime"; sleep (1 - (_time - AAS_PublicServerTime)); }; Or use diag_tickTime or diag_frameNo. PS: The design must be a little different for this purpose. As mission designer one has to keep compatibility to addons in mind. As addon design one has to keep compatibility to addons and missions in mind. So unless there is no other solution, I would avoid onEachFrame or write a fallback to pitch in when my oEF is not active/got overwritten. Share this post Link to post Share on other sites
xeno 234 Posted May 27, 2013 _idx = addMissionEventHandler ["Draw3D", { drawLine3D... drawIcon3D... }]; Xeno Share this post Link to post Share on other sites
killzone_kid 1332 Posted May 27, 2013 _idx = addMissionEventHandler ["Draw3D", { drawLine3D... drawIcon3D... }]; Xeno Awesome! Thanks man! How do you know this? The wiki says there is only 1 MEH "Ended". Are there any others? Share this post Link to post Share on other sites
.kju 3245 Posted May 27, 2013 from parsing the alpha source: addEventHandler ["AnimChanged" addEventHandler ["animdone" addEventHandler ["Explosion" addEventHandler ["fired" addEventHandler ["handledamage" addEventHandler ["hit" addEventHandler ["killed" addEventHandler ["PostReset" addEventHandler ["respawn" addEventHandler ["selectedActionChanged" addEventHandler ["SoundPlayed" removeEventHandler ["AnimDone" removeEventHandler ["fired" removeEventHandler ["handledamage" removeEventHandler ["killed" removeEventHandler ["respawn" addMissionEventHandler ["draw3D" addMissionEventHandler ["ended" addMissionEventHandler ["loaded" removeMissionEventHandler ["draw3D" removeMissionEventHandler ["loaded" addMusicEventHandler ["MusicStop" removeMusicEventHandler ["MusicStop" ctrladdEventHandler ["buttonclick" ctrladdEventHandler ["buttondown" ctrladdEventHandler ["CheckBoxesSelChanged" ctrladdEventHandler ["draw" ctrladdEventHandler ["keydown" ctrladdEventHandler ["lbdblclick" ctrladdEventHandler ["lbselchanged" ctrladdEventHandler ["mousebuttonclick" ctrladdEventHandler ["mousebuttondblclick" ctrladdEventHandler ["mousebuttondown" ctrladdEventHandler ["mouseholding" ctrladdEventHandler ["mousemoving" ctrladdEventHandler ["sliderposchanged" ctrladdEventHandler ["toolboxSelChanged" ctrladdEventHandler ["videoStopped" ctrlremoveEventHandler ["draw" ctrlremoveEventHandler ["lbselchanged" ctrlremoveEventHandler ["mousebuttonclick" ctrlseteventhandler ["buttonclick" ctrlseteventhandler ["lbselchanged" displayaddEventHandler ["keydown" displayaddEventHandler ["keyup" displayaddEventHandler ["mousebuttondown" displayaddEventHandler ["mousebuttonup" displayaddEventHandler ["mouseholding" displayaddEventHandler ["mousemoving" displayaddEventHandler ["mousezchanged" displayaddEventHandler ["unload" displayremoveEventHandler ["keydown" displayremoveEventHandler ["keyup" displayremoveEventHandler ["mousezchanged" displaySetEventHandler ["KeyDown" displaySetEventHandler ["KeyUp" Share this post Link to post Share on other sites
killzone_kid 1332 Posted May 27, 2013 Thank you .kju very useful indeed. Share this post Link to post Share on other sites
b00tsy 28 Posted August 22, 2013 When you are looking for arma commands in google having the title with the actual command names is better and easier to find, I know I've been googling a lot for arma commands trying to find any info. (this thread already shows if you search for "setAmmo arma" under BIS forums)You can apply it to the currentWeapon turret manned by a player, so I don't see why not. There is no reason to do while true loop on drawIcon3D, you only need it on every frame. But yeah you can use it with while true. SetAmmo is not working for me in an APC. This is mentioned as an example on the biki, this does not work. vehicle player setAmmo [currentWeapon vehicle player, 5]; Nor this, veh1 setAmmo [currentWeapon veh1, 500]; I tried it as gunner. I tried to reload an empty vehicle, but still nada. I am setting up a service area and resetting fuel and damage works fine, the ammo just aint working in an APC. Any workaround to get the ammo reloaded in an APC? Share this post Link to post Share on other sites