Stopping the game

#1

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

0 Likes

#2

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

0 Likes

#3

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

0 Likes

#4

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

0 Likes

#5

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

0 Likes

#6

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.

0 Likes

#7

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

0 Likes

#8

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

#9

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

0 Likes