Blog Post
TobiasNoeske
5 years agoCommunity Member
For this week's challenge I once more used my number cruncher game example from Challenge 278 and added some achievements.
As all fellow gamers know there are some achievements which you simply get for playing, other require some endurance but hardly any skill and some require a lot of skill (or plain luck in case you're unskilled). My achievements are no exception to these general rules.
Can you reach all achievements? Do you have what it takes to be a real number cruncher?
https://360.articulate.com/review/content/0ef6cafb-c6c6-4a82-86f9-5f23359f270d/review
Disclaimer: Still doesn't work in Internet Explorer and leading 0 will always be present in the numeric input field.
As all fellow gamers know there are some achievements which you simply get for playing, other require some endurance but hardly any skill and some require a lot of skill (or plain luck in case you're unskilled). My achievements are no exception to these general rules.
Can you reach all achievements? Do you have what it takes to be a real number cruncher?
https://360.articulate.com/review/content/0ef6cafb-c6c6-4a82-86f9-5f23359f270d/review
Disclaimer: Still doesn't work in Internet Explorer and leading 0 will always be present in the numeric input field.
- PaulRodger5 years agoCommunity MemberTobias this was good. Just a couple of points is there any way to be able to type in the field without having to delete the 0? I felt I lost some time doing that. The speech bubble at the end slightly covers his face (not a biggie) but it might look a bit nicer if the stem was brought back a bit
- TobiasNoeske5 years agoCommunity MemberI so far have not found any way to remove the 0. As stated above I recycled an older project which had the same issue which I couldn't resolve until now. Apparently unlike text input variables you can't set a numeric variable to "blank". If I use a text variable instead I can't do any calculations. Converting variable types would probably require some JavaScript which I hardly have any experience with.
By the way: you don't need to delete the 0, just type the desired number behind the 0.
As for the speech bubble: Well spotted. I'll fix that.- MathNotermans-95 years agoCommunity Memberi do think Storyline treats variables always as strings...so internally a Number will be converted to a string anyway...
How to do that yourself ?
So how to use strings for your input... and then convert them as Numbers..well thats easy...
to convert any string to a Number Javascript has an standard function called parseInt()
parseInt(input);
this will return a Number...
samples:
===========================
var input = "12";
var myNum = parseInt(input);
console.log(myNum);
=====================
var input = "05";
var myNum = parseInt(input);
console.log(myNum);
===========================
Note: If the first character cannot be converted to a number, parseInt() returns NaN.
So if using a space or non-numeric character you get NaN as return... so you have to check that too... buildin function isNaN( ) can handle that...
var input = "";
var myNum = parseInt(input);
if(isNaN(test){
console.log("this :"+myNum+": aint a number, NaN");
}else{
console.log(myNum);
}
===========================
Hope this helps a bit :-)
- SunetSullivan-75 years agoCommunity MemberI love the idea of having achievements, it certainly made me retry a couple of times. Are the achievement linked to a number variable?
- alexjinca5 years agoCommunity MemberI enjoyed this and also interesting discussion about the zero, I didn't know...
- TobiasNoeske5 years agoCommunity MemberIt depends on the achievements what they are linked to. Some use variables which have been created only for tracking progress, others are simply linked to already existing variables.
I also used some true false varibles so you don't get certain achievement multiply times.
And you retrying multiple time is exactly what I intended with the achievements. :)