question

Aaditya J avatar image
0 Likes"
Aaditya J asked Aaditya J commented

Runtime termination of user Event

Can we disable user event in run time? after some iterations or model time?

runtimeuser event
· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image Joerg Vogel commented ·

have you tried to wite the condition directly in the user event code like

if(time() < 1000)
{ 
   // execute your previous FlexScript source code 
}
0 Likes 0 ·
Aaditya J avatar image Aaditya J Joerg Vogel commented ·

but the event will always be fired right?

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Aaditya J commented ·

yes. You have an option to repeat in the user event? Perhaps you can change the flag or value in an attribute node dynamically. But I am not sure that you can manipulate this after hitting run.

0 Likes 0 ·
Show more comments

1 Answer

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Aaditya J commented

The Repeat event option is a variable. You can activate and deactivate the value by FlexScript source code. You need the reference to the Event Object in the model tree in the subtree Tools.

setvarnum(userEvent,"repeat",0);

This deactivates the repeat option. If you need the ability to repeat the event after reset you have to activate it manualy in the user event properties, or by an OnReset trigger and source code.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Aaditya J avatar image Aaditya J commented ·

Thanks this seems to be better option for me.

0 Likes 0 ·