Native Storyline calculator (no Flash)

Mar 23, 2014

Hi everyone, my learners will need a calculator in my courses, and I was hoping to find a solution that doesn't rely on a Flash. I was inspired by a project called BetterCalculator that I found on another thread that was originally developed by Dave Mozealous. Unfortunately, that calculator didn't accept decimals - only whole numbers. Also, having to click everything on screen is a bit of a chore, so I thought allowing keyboard entry would be cool too. 

Well, here's a working demo of the newest iteration of Dave's calculator, and I've attached the Storyline project for you to adapt/improve as needed. 

It includes both keyboard entry and decimal entry (up to 2 decimal places). I hope this is helpful.

53 Replies
Robert Lengacher

Good catch, Harri. It appears that the maximum number of characters that can be safely entered is 14 (got this by repeatedly hitting 9), which is probably due to the way Storyline handles floating point numbers (or something like that). I just added a note to the sidebar with the "Tips and Quirks"

Also, I discovered that a zero would not display in the tenths place if another non-zero digit was typed for the hundredths place. I think this issue is fixed in the newest version.

One more issue that I still can't resolve is if you enter a digit 5 or greater after the number has reached the hundredths place, the displayed number (currentValue) will add one hundredth. For example, if you enter 2.34 the display will show "2.34", but if you enter an additional digit that is 5 or greater, the display will change to "2.35". I have an idea for fixing this, but it would involve creating yet another decimal place tracking variable, but I'll leave that to someone else.

Here's the link to the updated working demo, and the updated .story file is attached.

Charles Huff

Hello all

Some time ago I also had to produce a calculator for a project i was working on and you may be interested to compare mine to Robert's.  You can see it at http://www.thetrainingwell.com/calculator/story.html.  I think it has a few advantages.  First it operates more like a traditional calculator in that if you are doing a string of calculations pressing a plus, minus, times or divide key completes the previous calculation before moving on (I see Robert's just zeros the counter), second it includes a percentage key and third it occupies considerably less screen space.  I used it on a layer so one could see underneath the screen to which its calculations referred.  Like Robert's, mine is limited to 2 places of decimals (a function of how variables are stored in Storyline) so it is probably most useful for financial calculations. 

Incidentally Robert I am not knocking yours which is excellent, I just offer mine as an alternative.  If anyone is interested I am happy to share the story file.

Alphonso Hendricks

@ Charles and Robert

Any ideas on how to calculate the square root of 125348, inside Storyline? [i.e. no need to hop outside of Storyline or go online etc.]

Only solution I can come up with is the guestamation option - see attached. It only uses basic arithmetic (+, -, *, /) operators.

Problem is, it is a pain to code this solution inside Storyline.

I am looking for a more elegant solution. Any ideas? 

Robert Lengacher

@Charles. Thanks for sharing. It's cool that yours has additional features. I'm sure some folks would love it if you shared your .story file so they could tweak it as needed. In my real modules, mine will be smaller too, so the user can use the calculator in a layer and then make entries on the base slide at the same time. It sounds like we had similar ideas and similar needs. It's cool that Storyline allows such flexibility right out of the box.

@alphonso, I would assume that you could use a small JavaScript function if you need to, but I'm not sure how that would be done. Hopefully somebody else can take that on.

Charles Huff

robert and a few others have sent me messages asking for the story file so instead of sending them all individually here it is now.  Remember as it uses JavaScript it will not work on preview.  

Alphonso have you tried using Javascript for your square root calculation?  Using result=Math.sqrt(x); should work (where x is the original variable and result is the square root).

Regards

Charles

Alphonso Hendricks

@Charles

tried result=Math.sqrt(x) but no joy.

Not sure if I'm doing something wrong. Started off by declaring variable x = 9. The declaring variable result = 0. Then I pasted javascript code into a button. But when I clicked button, nothing happened to either %x% or %result%. Was hoping to see result value change to 3.

Naveed Shahzad

 Hi Alphonso

 I am attaching a file that is able to calculate square root of any given number on button trigger. You can add more variables to calculate Time period of Pendulum or etc.

But this story would not show output preview in your current player. First you have to publish on web and run it in IE (chrome doesn't support) and it works good.

 Best,

 Naveed

eLearning Locker

Hey Storyliners,

Just posted this and saw a few other posts about calculators... so re-posting.

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!

http://elearninglocker.com/portfolio-items/storyline-template-calculator/

Charles Huff

I think the eLearning Locker calculator looks very good, probably better than mine which I posted in April (which, incidentally does calculate the decimal point correctly) but I still think mine has some advantages.  My intention was to emulate calculators we are used to, such as Windows calculator, as closely as possible.  The eLearning Locker one falls down here on a couple of points and, interestingly one is on the decimal point which they highlight as being correct.  If one wants to enter a purely decimal number in a normal calculator one simply presses the decimal button then the rest of the digits but this will not work on their calculator, one has first to press a zero.  Also after entering any number then pressing an operator such as the plus sign the display should not clear until the next digit is entered.  Trivial things I am know but, of course, we all aim for perfection!

Megan Colbert

This calculator is a great tool to add to any slide that requires mathematics. The only issue I am having with it is that it will not allow multiple units to be added. 

As you can see below, i want to add the circled units, but the calculator is giving me the answer of 2.43. The correct answer is 3.97. The only way I can get this to add correctly is to enter 0.17 + 1.25 = + 0.12 = +2.33 = +0.10 =.

Is there a way that it will automatically add these units without having to click = after the unit is entered before I add the next?

Whoever built this tool, great job!!!!

Cheers,
Megan

This discussion is closed. You can start a new discussion or contact Articulate Support.