To make this post pretty short, I’ll try to make it as concise as possible. Basically, I want to check when a variable changes, is there any to do that? Like if I have a variable called “num” that’s currently at value 2 and if that value changes to any other number, then the computer will execute the code. Is there any way to do that? Ik you might be able to do it with 2 variables, but is there any easier way?
hey there - welcome back!
hmm to answer this question, you could always have a…
repeat forever/when 7=7 with set text[variable]!
for this, sounds like you could have when variable is not equal to 2 - complete whatever action!
When (var 1) ≠ (var 2)
Set (var 1) to (var 2)
If you want to check whether or not a variable equals a certain value, do When [Variable] equals [Value].
When rum is not equal to 2, do code.
Wow welcome back I’m CB Studios! I joined the forum 3 months ago
For that, you’ll need two variables: one for the previous value, and one for the current value
When (previous) ≠ (current)
- Do Something such as [Set text to (Variable Changed) color (RGB:0,120,240)]
- Set previous to current //Prevents Constant Execution of Rule.
This is basically the only way to detect changes from any number. A single variable will be able to detect only a change from a specific number
Oh, never mind. You wanted to know when the variable’s value changes, not changes to a certain value.
Ok thx guys.
Welcome back, Ambush!
And if you want to keep track of when a variable changes you can always use this code:
When game starts: Repeat forever: set text to (variable)
There are probably some other ways as well.