Calculations - how best to approach this in Storyline

Hello all,

I am struggling to resolve a problem. I want to create a calculator but cannot work out how to increase the total if the same button is pressed more than once. For example if I press 1 the total will be 1, but if I press 1 a second time I will want the result 11.

I have tried changing states firstly to 'selected' (on the first click) and then to 'x10' on the second click to adjust a 'quantity variable' but this doesn't seem to work despite trying different order sequences.

I suspect that the answer is using javascript but I am not skilled enough just yet and am in a bit of a hurry.

Is there any willing to provide advice ... I hope so!!

5 Replies
Sam Lincoln

Thanks for the quick response Phil, but my brain has stopped functioning (that's if it ever started!).

Can you provide a quick example? I can obviously adjust the value of the quantity variable when the #1 button is pressed for the first time but how do I get it to recognise that the #1 button has been pressed a second time? If I add triggers the sequence seems to get in the way and the combination of changing states to force a result is very complex (especially if I want to calculate 12 x 22 for example). Sorry but I do appreciate your help.

Sam Lincoln

THAT'S IT! THAT'S IT!

It's the reverse of my logic - multiply first then add! Which is what Phil said but which didn't make sense until I saw it.

Thanks so much guys - I knew there was a simple solution there. You've saved me and made my day.

I owe you - but I can't think how right now. Maybe simply passing on your generosity to others in the tradition of this magnificent community.