I've been trying to get a random generation code to work in my Authorware project, where it'll pick a random number between 1 and 5 (and must be a whole number) and then the code will change that number into a piece of text.
I wrote the code like this.
if Scenario:=0 then
if Scenario:=1 then
else if Scenario:=2 then
else if Scenario:=3 then
else if Scenario:=4 then
else if Scenario:=5 then
Yet the random generation keeps coming up as 5 but text comes up as Capitalist. I have a display icon that's telling me the scenario is 5 and Capitalist, yet I want 5 to = anarchist not capitalist.
What have I done wrong here?
Change all occurrences of "if Scenario:=" to "if Scenario=". That is, remove the colon before the equal sign if the variable name you're evaluating follows an "if".
'gantek' is right on - the colon in front of the equal sign (:=) is an *assignment* not an evaluation.
If you want to assign a value to a variable, use :=
If you want to check the value of a variable, just use =