question

Ashmita G avatar image
0 Likes"
Ashmita G asked Ben Wilson commented

Delay in Custom Code

Hi,

I want to write a custom code in which I can include a delay for a stipulated period of time, post which the code will resume executing the remainder of the commands. Could you suggest the syntax for the command, such that I achieve the requisite.

Thank you.

FlexSim 20.2.1
flexscriptcustom codeflexsim 20.2.1delay
· 2
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 ·

A suspended method is not a part of FlexScript. You find such combinations in an On Receive Message trigger, which you can retrigger by a delayed message. But that is restricted to the On Message trigger alone.

You can try to implement a list backorder that initiate on fulfillment the second part of your code. But you need to create an event that pushes the right value to the list at the delay interval.

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @Ashmita G, was Jörg Vogel's or jason.lightfoot's answer helpful? If so, please click the red "Accept" button at the bottom of one of their answers. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·
Joerg Vogel avatar image
3 Likes"
Joerg Vogel answered Ashmita G commented

you can call stop and resume to achieve a similar behavior.

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

Ashmita G avatar image Ashmita G commented ·

@Jörg Vogel Thank you for the explanations. I understand.

0 Likes 0 ·
Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Jason Lightfoot edited

Assuming you mean a delay in simulated and not real time you can do this simply in a process flow:


1611848874441.png (4.7 KiB)
· 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.

Ashmita G avatar image Ashmita G commented ·

Hi @jason.lightfoot, thank you for the response. I understand Flexsim has an activity present, called delay for the purpose. However, I wanted to enquire if there is a flexscript statement we could use to delay a token by within the custom code.

0 Likes 0 ·