Stopping the game

Hello,

In my Vensim model I have a variable that uses message function and stops the game if the condition is satisfied. However, this function does not work with Forio. What should I do?

Basically, if blackout risk>60, I want the game to stop. It is for my project named “Pilot Pre-Test_v2” , under “hec-regulation” team.

Thank you in advance!
Busra

Hi Busra,

We don’t currently support variable end times with the Interface Builder. This is something we’re working on currently, but will probably not be out until the end of November.

If you’re comfortable with HTML you can use our FlowJS library to add a conditional to make this happen. If you have a model variable called “IsGameOver” defined as “isGameOver = blackoutrisk > 60”, you can use that variable in HTML to conditionally show/hide UI elements. Something like

<div data-f-show-if="IsGameOver">Game is over, blackout risk exceeded</div>

Relevant documentation is here. We’re happy to provide more specifics if you want to use that, or otherwise we’ll let you know when this is available through the Interface Builder.

-Naren

Hello,

Thank you for the advice, it works!

But to have a real game over, I want this warning to hide the Simulate button for a while or for always. How can I do this?

Thank you,
Busra

Hi Busra,

That’s great! A similar strategy should work for hiding your button; on your button do <button data-f-show-if="Blackout Message Trigger" class="btn btn-primary f-action-button" if you want to hide it; note this assumes “Blackout Message Trigger” is boolean (returns only 0 or 1) in your model.

Let us know if you have trouble with this.

-Naren

Hello,

To have an alert and resetting the game I write the following code:

<div data-f-showif="Blackout Message Trigger | greaterThan(0)" data-subscription-id="[&quot;subs-3&quot;,&quot;subs-10&quot;,&quot;subs-3&quot;]" style="display: none;">
<div class="alert alert-danger alert-dismissable">
    <a href="#" class="close" style="font-size:18px;" data-dismiss="alert" aria-label="close" data-f-on-click="reset">×</a>
    <strong>Le jeu est terminé!</strong> Raison: Coupure d'électricté.
</div>

What I want is to have a warning, and when you click to close the warning the game restart. However, when I play the game for the second time (after closing the warning), even if the condition of blackout holds (Blackout Message Trigger=1),warning does not show up again. How should I fix it?

Thank you

Hi Busra,

The issue is with

<a href="#" class="close" style="font-size:18px;" data-dismiss="alert" aria-label="close" data-f-on-click="reset">×</a>
    <strong>Le jeu est terminé!</strong> Raison: Coupure d'électricté.

Since it’s a link, clicking on redirects the user in addition to the “click” behavior of reset. You can fix this by using a button instead of a link. for e.g

<button href="#" class="close" style="font-size:18px;" data-dismiss="alert" aria-label="close" data-f-on-click="reset">×</button>

If you still have trouble, give us a link to the page which has this issue along with directions for triggering the Blackount Message Trigger and we can take a look.

I can see this is fairly old but is it now possible to achieve such an “end of game” intervention using Interface Builder and no html code?

Thanks

Lee

Hi Lee,

Yes you can create an end of game page using only the UI builder and conditionals (no HTML required). Here is a video that explains how to do this:

Best, Michael

1 Like

Thanks Michael, all makes sense.

However, I’m after a way of interrupting the simulation when something interesting happens, like profits down by more than 30%. I’d like to place a message on screen and give user an option to go to some advice page, or ignore.

I can ask programmers at work to do this for me I’m sure, but it would be great if I could do it without programming.

Cheers

Lee

Hi Lee – responding to the older note (my apologies for the delay).

You may have figured this out, but you can use conditionals on your dashboard page. If the sim goes turn by turn, you can use conditionals to display a message when a certain conditiion is met (with no programming).

Every object has a tab “Conditions”. Create the text box on the screen you wish to show or hide. In the properties panel, click the tab “Conditions” and you can add logic to show or hide that text based on a model variable.

Thanks for the reply. Yes, I make huge use of the conditionals, very useful. However, I’m looking for an “interrupt” possibility where, once a condition is met in the model run, the simulation stops and a message displayed to the user (continue or view decisions or whatever). Vensim itself has this capability and, in an ideal world, I’d like to replicate this in Forio. I appreciate this may not be in the toollbox yet, so it’s just a polite request :wink:

Thanks again.

Lee

PS Loving Forio btw

Hi Lee–

Thanks for the feedback. Since you are running Vensim here, it really depends what Vensim is doing. If you are going turn by turn that’s fine. If you are running “to the end” then we depend on Vensim to stop. But I’ll take that up with our developers internally, see if they have other thoughts.