Calculations - how best to approach this in Storyline
Jun 03, 2014
By
Sam Lincoln
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
add triggers to multiply by ten and then add the value
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.
I may be missing something here (my brain is not doing so well either today), but look at the attached file that (I hope) shows the logic for the "1" and "2" buttons.
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.
No worries, I could have given more help.
Was a bit like a critic clue.
This discussion is closed. You can start a new discussion or contact Articulate Support.