Trying to get a score to print up from a list of values

I can sort of get this working, but it wants to display all the lesser scores as well.
My aim is to just get the score of a certain one to display from a list of values.

Here’s the code:


>This adventure has come to an end.
>You have scored: 
<<print $score>>
>That kind of score earns you the rank of:
<<if $score gte 70>>
Maestro<</if>>
<<if $score gte 40>>
Lesser Maestro<</if>>
<<if $score gte 30>>
Average<</if>>
<<if $score gte 20>>
Below Average<</if>>

Would elseif be better that just a bunch of <> variables? I tried it but the code seemed to error on it.

Yes, <<elseif>> would be what you want, but then it needs to be a single big <<if>> block, so you’d need to delete all the closing <</if>> except the last one.

<<elseif>> only works inside an <<if>>...<</if>> block: that’s probably the error that you’re seeing.

1 Like

I think I tried that and it gave me errors, let me try it again and get back to you helpful Josh. :slight_smile:

EDIT. Excellent! It works after I tried it again!
Thanks Josh.

Awesome! So you understand that in your original code, each <<if>> is a separate thing, so it shows all of them that are true? But if you do an <<if>> block with <<elseif>> sections inside it, it will only use the first section that succeeds. So one thing per whole <<if>> block, basically.

Have fun!

1 Like