Vensim variables

#1

Hi Naren, Geromel,

This page - https://forio.com/epicenter/docs/public/model_code/vensim/#vensim-vars indicates a list of Vensim variables that are available.

I find that neither Step nor STEP is present. I’m able to access other gaming variables in my model. This is through the Epicenter api. It was suggested in another post that I use the Flow.js api instead of the Epicenter.js api. Please show some example code as to how I can access a Vensim/gaming variable through Flow.js. By access, I mean to get its value, and not just be alerted if its value changes.

Regards,
Aditya

0 Likes

#2

Hi Aditya,

We will post after I discuss with my colleagues on examples to provide.

Regards,
Geromel

0 Likes

#3

Hi Aditya,

You should be able to display any model variable, Gaming or otherwise, using the the data-f-bind="Variable" syntax. If you need to access this value through javacript, you can either:

  1. Define a custom converter - for e.g

    Flow.dom.converters.register(‘myconverter’, function (value) {
    //do things with value
    return value;
    });

You’d use this as data-f-bind="myvariable | myconverter"

  1. Subscribe to it, as you said - your subscribe function will be called with the original value (and also every time it changes, but you can ignore that / unsubscribe after the first time if needed)

I can probably give you a more specific answer (likewise for the other questions) if I understand your usecase better. I’ll reach out to you separately over email about that.

0 Likes