2 Replies Latest reply on Nov 17, 2015 7:25 AM by Erik Lord

    Why does my random generation code not work?

    RickCall12

      Hi there,

       

      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.

       

      Scenario:=0

      if Scenario:=0 then

          Scenario:=Random(1,5,1)

      end if

       

      if Scenario:=1 then

          ScenarioType:="Capitalist"

      else if Scenario:=2 then

              ScenarioType:="Socialist"

          else if Scenario:=3 then

                  ScenarioType:="Religious"

              else if Scenario:=4 then

                      ScenarioType:="Communist"

                  else if Scenario:=5 then

                          ScenarioType:="Anarchist"

                      else

                          ScenarioType:="Default"

                      end if


      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?