Help with muliple if statments
Posted: Sun Nov 29, 2015 10:31 am
I am having a problem trying to get my If statements to run properly.
The Error message I am getting is:
Statement options (if any): h Statement Body : chatOutput=If(encounter >= 92 && encounter = 99, "will o’-wisp"+timeOutput, chatOutput)
I am able to get it to work if I remove the and section of the code.
Full code:
Code: Select all
[h: encounter = 1d100]
[h: chatOutput=If(encounter >= 92 && encounter <= 99, "will-o’-wisp"+timeOutput, chatOutput)]
Statement options (if any): h Statement Body : chatOutput=If(encounter >= 92 && encounter = 99, "will o’-wisp"+timeOutput, chatOutput)
I am able to get it to work if I remove the and section of the code.
Full code:
Code: Select all
[h: success=1d100]
[h: encounter = 1d100]
[h: chatOutput = ""]
[h: timeOutput= ""]
[h: time=1d4]
[if(success >= 20), code:{No combat.};{Combat! <br>
[h, switch(time), code:
case 1: {[timeOutput = " after you just set out from camp"]};
case 2: {[timeOutput = " durring the middle of the day"]};
case 3: {[timeOutput = " after you set camp"]};
case 4: {[timeOutput = " in the middle of the night"]};
default: {[timeOutput = "broken"]}
]
[h: chatOutput=If(encounter >= 1 && encounter <= 10, 1d6+" dire rat(s)"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 11 && encounter <= 20, 2d4+" mites"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 21 && encounter <= 28, "dire bat"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 29 && encounter <= 33, 1d4+" carrionstorm(s)"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 34 && encounter <= 39, 2d6+" skeletons"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 40 && encounter <= 53, 2d6+" goblins"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 54 && encounter <= 62, 1d6+" goblin dogs"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 63 && encounter <= 74, 1d4+" rat swarm(s)"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 75 && encounter <= 81, 1d6+" boars"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 82 && encounter <= 91, 2d4+" ghouls"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 92 && encounter <= 99, "will-o’-wisp"+timeOutput, chatOutput)]
[h: chatOutput=If(encounter >= 100, "the Sandpoint Devil"+timeOutput, chatOutput)]
You are attacked by [r: chatOutput]
}]