Zayets Posted May 29, 2018 Posted May 29, 2018 I am trying to schedule a function through mist but no matter what I do I can't get this one firing. When I simply call the function it works a charm but it does not look to be scheduled to fire every 30 seconds. Is there any changes in OpenBeta? function broadcast_message() local msg = {} msg.text = 'Regular broadcast function' msg.displayTime = 10 msg.msgFor = {coa={'all'}} mist.message.add(msg) env.info("broadcast function ends") mist.scheduleFunction(broadcast_message,{},timer.getAbsTime() + 30, 30, timer.getTime() + 3600) end broadcast_message() -- only this one is firing once Took out the mist.scheduleFunction from the body and calling it like do mist.scheduleFunction(broadcast_message,{},timer.getAbsTime() + 30, 30, timer.getTime() + 3600) end Still nothing. Any clues? [sIGPIC]OK[/sIGPIC]
Grimes Posted May 29, 2018 Posted May 29, 2018 timer.getAbsTime() returns the time of day from whatever the initial mission date is set for. For example when run at mission start of 0800 the value returned is 28800. Divide that by 60 twice to get the hours. (28800/60)/60 = 8. The time given to wait is given whatever the time of day is + 30 seconds to do that function again. Use timer.getTime() instead. Also just use the 2nd example. If you do it from the first one, then it will keep rescheduling the function each time it gets run. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Zayets Posted May 29, 2018 Author Posted May 29, 2018 That makes sense. Tested it and it works as expected. Saved a lot of debug and reading and I thank you for this. One small question, adding a Harrier on Tarawa will not allow me to get into the cockpit. As soon as I move it to an airfield I can jump on cockpit. I have changed it to Client from Player and when jumping in the slot says flight is not ready. Checked Tarawa stores and seen that it has unlimited ammo and planes. Also times when these spawn (carrier and planes are identical). Is it a glitch or something I done wrong? [sIGPIC]OK[/sIGPIC]
Grimes Posted May 29, 2018 Posted May 29, 2018 Yeah Tarawa spawn was bugged due to CV changes. Should be fixed on the next patch. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Zayets Posted May 29, 2018 Author Posted May 29, 2018 Yeah Tarawa spawn was bugged due to CV changes. Should be fixed on the next patch. Thanks for confirming :thumbup: [sIGPIC]OK[/sIGPIC]
Recommended Posts