(Budget E-learning) How to subract from the total expenses using multiple choice

Sep 14, 2023

Hello, I'm still a bit new to storyline and I'm creating a course about budgeting and it's interactive. If for example, the learner has 20,000 dollars they will decide from the yes and no question if they will purchase the item.

For example a new appliance (it costs 100$)  they have the freedom to choose YES or NO . If they picked "YES" the feedback they will get is they have 19,900 $. The following questions they will also be asked if they want to buy something (example: grocery, laptop) and the cost will still be deducted from their 20,000$ (the feedback will always show how much they have after submitting to each question)

Does anyone know how to go about this? Thanks!

5 Replies
Ron Price
Nedim Ramic

Sajou,

I'm attaching my sample file as well that you can play with but only after you read and do some serious work of what Ron has suggested in his post. It takes time to get a firm grasp around SL variables. Once you get that out of your way, you may even create a scenario based questions just like in my sample or even better than that. For instance, If you don't want to buy computer, the next question asked is if you want to buy a laptop instead. If you do want to buy a computer, the next question asked is if you want to buy a phone. If you choose NO to all answers your learner get notified that it did not buy anything and that the budget is still the same. The basic setup is to create a number variable called "total" with a value of your budget. All you have to do is to create a trigger that will substract another number (cost value) from the total variable when something happen (if something has changed the state or if something is clicked etc.).    

https://360.articulate.com/review/content/c6670d52-8e10-4578-8589-03eee8a98b39/review

Sajou Pop

Hello! Thank you for this I appreciate it! It took me a while to fully grasp variables but I'm slowly learning it. I managed to input the appropriate triggers and subtract from the variable "total" when needed if I were to choose between YES or No. My only concern is at the end, when I wanted to restart the quiz, my previously deducted money was still there. I can't seem to figure out how to bring the total to its original value even though I selected "initial state" in my slide properties. 



In summary I wanted to do the try again button and have the whole quiz reset but when I do, my previous deduction answers are still there. Thanks a bunch!

Walt Hamilton

Returning to the original state changes states, but not variables. That is one of the powers of variables, slides can’t change their value on its own. Variables only change when you create a trigger to change them. So when you start over, resetting the slide to initial will reset all the button states, but none of the variables. You will have to create a trigger to reset each of them. I generally have them fire when the timeline on the slide starts.

In general, I find it is best practice to have one variable set to 20,000 (the initial value) that never changes, and another that does change that represents the total remaining. Then, when the new appliance “Yes” is clicked, the appliance variable changes to 100. When the new appliance “No” is checked, the appliance variable changes to 0.

You need a variable for each item:

For appliance, newAppliance (for example)

You need one trigger for each button:

Adjust variable newAppliance = 100 when user clicks applianceButtonYes

Adjust variable newAppliance = 0 when user clicks applianceButtonNo

You need one trigger for each item:

Show layer Calculate when variable newAppliance changes

Then when any of those variables changes, a calculation layer is shown. The layer has nothing on it, a timeline of .25, and closes when its timeline ends. All of its triggers run when the timeline starts. The order of the triggers is important.

1. totalRemaining is set to initial value variable.

Option 1 variable is subtracted from total remaining. (Remember, if it is chosen, it has a value. If not chosen, it is 0.

option 2 - 10 follow in order.

Doing the complete calculation every time a change is made is the best way to easily keep it accurate. Showing a layer each time one of the variables changes saves having to create 15 - 20 triggers for each item.