Calculator in Storyline

So I've been building a calculator in Storyline that allows the learned to input a value and press submit to see how much they spend on each item per week. Once all Submit buttons are clicked, a new layer appears that divided the yearly total by 2 so the learner can see how much they could save. 

However, while i have almost everything working, I need a little bit of advice on the division at the end. Anyone have any comments?

I have attached the file to this post. 

20 Replies
Rebecca Fleisch Cordeiro

Hi Michelle,

I like what you've done here. I've played with a for a bit, and am seeing that it seems to work some clicking sequences and not in others.To try to tease it out, I put a FINAL reference in a text box on the Final layer, to see if that was causing the problem. And I think it might be.

I need to run out now, and I haven't quite figured out WHERE it is, but:

  • Let' say I leave all items blank (set to 0) EXCEPT for personal gifts and clothing, and for purchases per week I type in a 1.
  • And, let's call the Submit buttons from left to right (in preview mode) Submit 1, 2, 3, 4
  • If I click Submit 1, then Submit 2, then Submit 3, then Submit 4, the Final (in the reference box I've placed on the layer) Shows as 0.
  • But, if I click Submit in other sequences, e.g., 2, 3, 4, 1 or 3, 4 1, 2 or 2, 4, 3, 1. Final (the tota)l displays correctly.

When I play with the other items I yield similar results but with different sequences of clicking Submit buttons. Pretty much, it seems if I  first hit the Submit button that comes AFTER an item, that item's "full" reference shows as 0.

So, I I only enter a quantity in one of the boxes and:

So for iTunes, if I hit Submit 2, 3, 4, 1, Full = 0.

For Coffee if I hit Submit 3, 4, 1, 2, Full=0

For Lunch if I hit Submit 4, 1, 2, 3, then Full = 0

Wish I had another few minutes. Curious now!

Michelle Thomas

Rebecca - 

Perhaps, as Phil pointed out, the route would be better if I didn't have slide level triggers and instead had all things happen on one base layer. Perhaps that is what is causing the addition to be skewed. 

If I were to hypothetically place all triggers on the base layer, would the amount of triggers and variable on one base layer affect the overall outcome?

I have a fear that certain things are cancelling out. 

It is doing the math correctly when you enter a number in the top row of boxes and press submit and the correct answer appears in the second row of boxes. (See screen shot). I just don't know why the addition after those populate is incorrect.

Phil Mayor

I would put most of the action triggers on the buttons and the calculate triggers elsewhere.

I have to be really honest this felt so strange to me I started rebuilding the whole thing and then ran out of time.

The initial calculations are correct, if you remove the divide trigger the total is one box short (I think the last one you press) but I dont know why

But that is where the problem is.  To debug this i would need to delete the triggers and start again just because this isnt how I would build it and it is making my head hurt

Phil Mayor

Hi Michelle

First there is no right or wrong way and looking at it, I am sure it should work your way.  It is just not the way I would do it.

I would add all of the logic on the submit buttons, including the show layer trigger.  I would exactly the same as you add the calcuations for the total I would add to the layer as timeline start triggers.

It all works but there is something strange that I feel I am missing somewhere and cannot get it (this is frustrating me).

Your way probably uses a few less triggers, I think

Michelle Thomas

If it helps, the calculations I was using are as follows:

iTunes is approximately 0.99/purchase and so i multiplied this by the number entered in the first row.

Lunch was 8.99 and thus that got multiplied by what was entered in the data entry.

Coffee was approximately 2.95 and was multiplied by the number entered.

Gifts was 25 and multiplied by the data entry. 

Therefore, all the math to get the second row correct was good, so it has to be something happening during that or after. 

(hurts my head to!)

Rebecca Fleisch Cordeiro

I know what you mean. Tx for not letting it go. I learned a lot from it thanks to you and Michelle. 

Michelle, you did things with variable calculations that I hadn't thought of before. And Phil, well, as you saw from my post, I could see that something wasn't firing correctly and it was very "specific" in sequence, but I would never have determined what it was.

I also recreated it, for the sake of practice and because I had some ideas about what I would need to see as a Learner - this is me, not everyone - that would make the math more concrete for me. But, I did it with only 2 items for the sake of time. In fact, I don't really HAVE the time to do this now! But I was so intrigued and I so very much liked what Michelle had started.

I''m attaching here, just for the sake of sharing. I think it all works. I tried it in different sequences: just the item on the left, just the one on the right, left first, right first...

Thanks again to both of you! Signing off now.

eLearning Locker

Hey Storyliners,

We have noticed a lack of calculators out there.

A few of the examples out there don't calculate the decimal point correctly once calculated. If you want to create a calculator that has decimal places or +/-, before you do any calculations, you have to turn the number into a whole number. Multiply by -1 if the number is less than 0, and you have to keep track of your decimal place, multiply accordingly (if one decimal place, multiply by 10, two, multiply by 100), then divide by that same number and multiply by -1 again. It is mostly about keeping track.

This version should do the job. We have put this in our freebies at eLearning Locker where it will stay for about a week. It is normally part of the paid subscription, so please download it and use it as you like!