DaRealT 0 Posted October 25, 2021 Hello everyone, I made this script and it's working quite well. addMissionEventHandler ["Draw3D", { drawIcon3D ["\a3\ui_f\data\igui\cfg\simpletasks\types\move_ca.paa", [0.73, 0.24, 0.11, 1], getPos operatorOpf, 1, 1, 0, "", 0, 0, ""]; }]; With it I'm able to constantly ping a defined player. Now I'm struggling with the script being executed ever minute and then show the ping for five seconds. After that the script should stop for again one minute and so on. Has someone an idea? Share this post Link to post Share on other sites
7erra 629 Posted October 25, 2021 while {true} do { private _drawEHID = addMissionEventHandler ["Draw3D", { drawIcon3D ["\a3\ui_f\data\igui\cfg\simpletasks\types\move_ca.paa", [0.73, 0.24, 0.11, 1], getPos operatorOpf, 1, 1, 0]; }]; sleep 5; removeMissionEventHandler ["Draw3D", _drawEHID]; sleep 60; }; Edit: Invisible characters and empty font error 1 Share this post Link to post Share on other sites
DaRealT 0 Posted October 26, 2021 I see. I didn't know about the removeMissionEventHandler. But the game tells me an error in line 2 because of an missing " ; " and I can't find it. Share this post Link to post Share on other sites
pierremgi 4865 Posted October 26, 2021 Other way: addMissionEventHandler ["Draw3D", { if (time mod 60 <5) then { drawIcon3D ["\a3\ui_f\data\igui\cfg\simpletasks\types\move_ca.paa", [0.73, 0.24, 0.11, 1], ASLToAGL getPosASLVisual operatorOpf, 1, 1, 0]; } else { drawIcon3D ["", [0, 0, 0, 0], [0,0,0], 1, 1, 0]; }; }]; Share this post Link to post Share on other sites
7erra 629 Posted October 26, 2021 1 hour ago, pierremgi said: Other way: addMissionEventHandler ["Draw3D", { if (time mod 60 <5) then { drawIcon3D ["\a3\ui_f\data\igui\cfg\simpletasks\types\move_ca.paa", [0.73, 0.24, 0.11, 1], ASLToAGL getPosASLVisual operatorOpf, 1, 1, 0]; } else { drawIcon3D ["", [0, 0, 0, 0], [0,0,0], 1, 1, 0]; }; }]; this is way less performant as you execute it every frame so 60 times per second or more. also no for the else part, the icon is only drawn in that single frame. 4 hours ago, DaRealT said: I see. I didn't know about the removeMissionEventHandler. But the game tells me an error in line 2 because of an missing " ; " and I can't find it. goddamn BI Forum with its invisible characters out of nowhere (char <feff>, so a BOM apparently). I edited the original answer. Share this post Link to post Share on other sites
pierremgi 4865 Posted October 26, 2021 6 minutes ago, 7erra said: also no for the else part, the icon is only drawn in that single frame. You didn't test it? No. I did. Drawing no icon is not performance consuming. Share this post Link to post Share on other sites
7erra 629 Posted October 26, 2021 I just did and I am still right? The icon is not drawn when the command is not executed, so the code of the else statement does nothing, this would be more performant: addMissionEventHandler ["Draw3D", { if (time mod 60 <5) then { drawIcon3D ["\a3\ui_f\data\igui\cfg\simpletasks\types\move_ca.paa", [0.73, 0.24, 0.11, 1], ASLToAGL getPosASLVisual operatorOpf, 1, 1, 0]; }; }]; But why waste performance every frame when you don't have to? That time mod check is still unnecessary when you can just do absolutely nothing for 60 seconds with sleep 60. But yes, your approach is valid. Share this post Link to post Share on other sites
pierremgi 4865 Posted October 26, 2021 28 minutes ago, 7erra said: I just did and I am still right? The icon is not drawn when the command is not executed, so the code of the else statement does nothing, this would be more performant: addMissionEventHandler ["Draw3D", { if (time mod 60 <5) then { drawIcon3D ["\a3\ui_f\data\igui\cfg\simpletasks\types\move_ca.paa", [0.73, 0.24, 0.11, 1], ASLToAGL getPosASLVisual operatorOpf, 1, 1, 0]; }; }]; But why waste performance every frame when you don't have to? That time mod check is still unnecessary when you can just do absolutely nothing for 60 seconds with sleep 60. But yes, your approach is valid. You're right, no need to draw no icon. For all each framed code, I'm not sure you waste performance if you just skip the framed code with quick condition. There are plenty of framed (or more often!) codes which don't impact performance if the condition is not too complex. Example: all addAction on player , the condition is checked on each fame (at least). There is no performance impact with fast checking like the condition I'm using. Share this post Link to post Share on other sites
DaRealT 0 Posted October 26, 2021 Im pretty happy because it's working. Thank you very much. Now I wanted to add a notification tone but playsound isn't working quite well... Share this post Link to post Share on other sites
DaRealT 0 Posted October 29, 2021 I managed to do this on my own. My main problem was to use the sounds of Arma itself. So I ended up playing the sounds while recording them. In the description.ext: class CfgMusic { Music[] = {}; class track01 { name = "track01"; sound[] = {"music\ping_sound.ogg", 5, 1}; titles[] = {}; }; }; And in the .sqf for the ping: while {true} do { private _drawEHID = addMissionEventHandler ["Draw3D", { drawIcon3D ["\a3\ui_f\data\igui\cfg\simpletasks\types\move_ca.paa", [0.73, 0.24, 0.11, 1], getPos operatorOpf, 1, 1, 0]; }]; playMusic "track01"; sleep 5; removeMissionEventHandler ["Draw3D", _drawEHID]; sleep 10; }; I saved the audio file as .odd in the mission folder. Now it's working well and you can't tell the difference. Thanks for all of your help! Share this post Link to post Share on other sites