# Native Storyline calculator (no Flash)

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.

## 49 Replies

Hi Robert,

Apologies, I was testing your calculator (as we've needed one several times before in various courses) and I think I may have broken it. I've attached a screenr so you can see what I did.

test.mp4Good 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.

nativestorylinecalculator.storyRobert, this is great. Thank you! Just what I needed.

I have one issue with it, though. When I use this, I have to hit the Clear button first. If I don't, the numbers I type in automatically go in after a decimal. (i.e. I try to type in 575 but it goes in as .575) Any ideas how to fix that?

Hi Heather,

I just wanted to welcome you to the Heroes community and I'm glad you found Robert's calculator helpful!

Welcome to E-Learning Heroes, Heather!

I can't seem to replicate your issue, either by typing the numerals on the keyboard or by clicking the numeral buttons. What OS and browser are you using? Any other things I should know about when this happens would be helpful.

Here's the latest version of the calculator that fixes the decimal issue noted in my post on March 24 above.

Working demo

nativestorylinecalculator-v3.storyexcellent work... these tricks will absolutely be usefull

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.

Thanks Robert for the updated version - and Charles for sharing your version as well! Always great to have a lot of examples as they're generally all a little bit different, even if it's just design

Robert, yours works fine. Something happened when I started messing with it. I think I got it working... probably some user error on my part. Thanks!

This is amazing, you are mathmatical wizards.

Adding another scientific calculator to the mix. Forgive the pun.

One drawback is that you need to be connected to internet in order to operate it. But at least now you can incorporate f(x) = sqrt(x^n)

sci_2bcalc.story@ 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?

square+root+calculation.png@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.

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

calculator.story@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.

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

squareroot.storyHey 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/

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!

Thanks for sharing. This calculator saved my bacon today :)

Glad to hear it DK - thanks for letting us know.

Hi Charles, can you re-post the file? for some reason your link as some of the others hops to some odd 'amazon news' page with a lot of jumbled text.

Hi Chris!

I'll re-attach the file for you in case Charles is no longer subscribed :)

calculator.storyThis 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

Hi Megan,

I'm not certain if the original creator is still subscribe, so I'm unsure if they're able to pop in here and share thoughts on how to fix it. You may want to look at messaging them using the "contact me" button on their profile if you're still having difficulty with it.