Variables
Feb 26, 2013
I am trying to use a variable where I multiply the cost of a pack of cigarettes times the number of packs smoked in a month adn then in a year. I have used Numeric entry for the learner to enter the number of packs. The calculation works but the calculated number appears in the Numeric Entry box not the Monthy cost box. I have attached a picture of my triggers and variables. Can you tell me what I am doing wrong?
8 Replies
If you post the .story slide, I'll take a look at it.
How do I do that?
Click the paper clip icon above your reply to attach any file.
Thanks. I haven't done this before.
I have attached the file with just that slide in it. I have not finished formatting the slide. I was just working on getting the variables to work first.
I added a slide that makes it work. I wonder if it can be simpler?
I had to add two triggers EACH for variables changing: PacksPerDay and PricePerPack
The first trigger copies the value to variable CostPerDay
The second trigger multiples CostPerDay by the other variable. e.g., CostPerDay = PacksPerDay * PricePerPack
Variables MonthlyCost and AnnualCost EACH have two triggers:
The first trigger copies CostPerDay to MonthlyCost (and AnnualCost)
The second trigger multiples MonthlyCost by 30, AnnualCost by 365
Some cleanup could be done to ensure that cents "$nn.00" are always shown, or not.
Thanks so much. How would I ensure the cents are not shown?
Thanks for your help. I have another question. When my answers are shown, they includ the decimal point. Is there a way to round them to the nearest dollar?
Carolyn,
I've been thinking of this problem, and without a mechanism in Storyline to specify digits in numeric fields, we've painted our way into a corner.
The only way out that I can see is to resort to text fields which compounds the solution quite a lot. Using text fields to display the result, we could add logic to round numbers to whole values.
Does anyone see a simpler solution?
Sam
This discussion is closed. You can start a new discussion or contact Articulate Support.