Conditions and Variables

May 25, 2016

I need more resources on how to understand and work with conditions and variables. In the past, I have searched the community to find examples and I can recreate from the examples. However I need to understand for myself how to design and develop using conditions and variables from the beginning. Any suggestions?

2 Replies
Walt Hamilton

The important thing to remember about variables is that SL is like someone with Alzheimer's; it can only remember what it can see. Variables are just a way to write notes so it can remember things later on. Whenever it looks at the note, it can tell that something happened earlier. For example: LookedAtLayer2 is True means that the user looked at layer 2.

Triggers always do what they are supposed to do.... unless someone comes along and tells them to do it only if certain conditions are met.

Example: Dad is eating supper with the kid and Mom has gone to get ice cream. Trigger for kid is "Eat ice cream when Mom gets home IF you have eaten your veggies." Since Dad has to leave, he leaves Mom a note: Kid has eaten veggies, and he leaves. A few minutes later, Mom comes in and says I told you "Eat ice cream when Mom returns IF it is True you have eaten your veggies." Kid shows Mom note from Dad (to prove he didn't just dump them), and Mom lets him eat ice cream. Kid is SL object, command to eat is trigger, note is variable, and IF you have eaten ice cream is condition.

Finally, don't add variables to your course to make it better. They won't. Only use them if you have to have them to make it work. If you are not writing triggers with conditions (Do this IF this condition is met) you don't need variables.

This discussion is closed. You can start a new discussion or contact Articulate Support.