Forum Discussion

KrisTaylor-a3c1's avatar
KrisTaylor-a3c1
Community Member
22 days ago

How do i reset a variable to 0?

This is kind of a 3 part question.

 

If I have a variable where it adds up the calories of food, I've noticed that every time I drop a food item onto a drop target it counts the calories as per the variable, but e.g. if I remove the food items or reset the slide, the variable doesn't revert to 0 again. I'm curious if this a trigger I need to add and if so, what would it be?

Second part of the question is, if I move an item onto the drop target, the variable counts as it should, but if I then move that same food item and place it somewhere else on the drop target it adds the amount again, and so doubles the value. Is there a way to stop this, or if you fully remove an item it will subtract the value of the item, or if you just drag the item off of the drop target and add it back, it won't count it again?

Lastly, it seems on the objects it is difficult to actually click on them, I have to move my mouse very carefully to find a selectable area. Is there a way to just make anywhere on the object selectable and movable? 

I'm forcing myself to use Storyline now and taking the holiday period to learn it, but ran into these issues.

 

Many thanks

  • For calculating, there needs to be a trigger for each math operation, as well as for resetting the variable when necessary. 

    Here's one way to do that: 

    • When any action happens that impacts the variable, have that action show a blank layer with a very short timeline. 
    • Have all the needed calculation triggers run when the timeline of that layer starts. The first trigger would reset the variable. That would be followed by triggers that perform a math operation on the variable (e.g., add to it) if the appropriate conditions are met. 
    • The final trigger on the blank layer should hide the layer when the timeline ends. 

     

    As for objects being difficult to click: transparent parts of a graphic aren't clickable. However, it's possible to make those areas clickable by editing the states. This post has more info: TIP: Making icons easier to program and easier to click | Articulate - Community