Forum Discussion

AndrewJGibson's avatar
AndrewJGibson
Community Member
3 months ago

Adding Up RNG Outputs on a Slide in Storyline 360

Basically, I am building an interactive kiosk program that is intended to be used as a pitch accessory when demoing to potential clients. I am working on a screen that breaks down the fees associated with the transaction. The fees are just random numbers generated through variables.

Is there a method, even if JavaScript is the method, to add up the generated numbers to show a total on the same screen?

I don't even know how to go about searching for this solution lol so if there is another discussion for it, please point me in that direction.

Thank you.

  • AndrewHanley's avatar
    AndrewHanley
    Community Member

    Hi Andrew!

    Absolutely, this is relatively easy to do and if it's just adding a series of numbers then you don't even need javascript.

    Just set up a NUMBER DATA INPUT FIELD for each value you need.

    Then create a NEW NUMERIC VARIABLE and call it "totalCount".

    You'll use this to add up and hold the final value. 

    Then place a TEXT REFERENCE to "totalCount" where ever you need it.

    Finally add a trigger that says:

    ADJUST VARIABLE. Set totalCount equal to the value of <variable1> and the value of <variable2> etc etc

    And that should work!

  • Andrew says, "ADJUST VARIABLE. Set totalCount equal to the value of <variable1> and the value of <variable2> etc etc"  -  Note that this cannot be done all at once. each variable must be added to totalCount individually:

    ADJUST VARIABLE Add <variable1> to totalCount

    ADJUST VARIABLE Add <variable2> to totalCount, etc with a separate trigger for each variable.

  • AndrewHanley's avatar
    AndrewHanley
    Community Member

    Ah yes, good point Walt! I rushed that explanation a bit. :)

    Thanks!

     

  • Oh wow! I didn't even know there was a trigger for adding variables together! That actually makes a lot of sense given what I know about variables now. But that worked exactly the way I was looking for. Thank you and now that I know you can do some basic arithmetic with triggers, this opens up a lot more for my project!