Jump to content

How to force exit an event or function (papyrus)


Recommended Posts

Posted

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

 

 

Posted
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.

Posted
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!!

Posted
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!

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...