SAC Posted November 26, 2019 Posted November 26, 2019 Hi, Is there a function to break/end an event or function? Something like (conceptually): Event OnActivate() / Function whatever() if actor == game.getplayer() endevent / endfunction... (?) endif <rest of event/function code to happen if the actor is not the player> EndEvent / EndFunction For sure I can embed the whole code into an if, but at some point it becomes unnecessarily complicated, whereas a simple event / function break would be a lot easier TY
DeWired Posted November 26, 2019 Posted November 26, 2019 3 hours ago, SAC said: Hi, Is there a function to break/end an event or function? Something like (conceptually): Event OnActivate() / Function whatever() if actor == game.getplayer() endevent / endfunction... (?) endif <rest of event/function code to happen if the actor is not the player> EndEvent / EndFunction For sure I can embed the whole code into an if, but at some point it becomes unnecessarily complicated, whereas a simple event / function break would be a lot easier TY Just use "return". You can place it several times, as many, as needed, and first one encountered on code execution will end your function.
SAC Posted November 27, 2019 Author Posted November 27, 2019 9 hours ago, DeWired said: Just use "return". You can place it several times, as many, as needed, and first one encountered on code execution will end your function. Thank you very much! Would that work to exit an event too? I realize I should just test but I’ll be AFK for a while, I’m just reading now from my phone TY!!
SAC Posted December 2, 2019 Author Posted December 2, 2019 On 11/27/2019 at 7:45 AM, SAC said: Thank you very much! Would that work to exit an event too? I realize I should just test but I’ll be AFK for a while, I’m just reading now from my phone TY!! Tested and it works on events too. Thank you again!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.