What is wrong with this code? Ideally, it will identify who goes before and after the opponent by rolling a d100 and comparing to the token's Speed score. If they roll under, they go first. If the roll over, the opponent goes first. However, the condition is not working, and it always comes up with the character going before the opponent. !scriptcard {{
--#emoteState|Hidden
--~PageTokens|array;pagetokens;Characters;@{selected|token_id};char
--~CurrentCharacter|array;getfirst;Characters
--#title|Rolling Inititive
--:InititiveLoop|
--#sourceToken|[&CurrentCharacter]
--=CharInitiative|1d100
--=Speed|[*S:speed]
--?[$CharInitiative] -lt [$spd][
|*[img width=32 height=32][*S:t-imgsrc][/img] [*S:character_name]; rolls a [$CharInitiative] against Speed of [$Speed] for initiative and goes before the opponents.[br][br]|+[img width=32 height=32][*S:t-imgsrc][/img] [*S:t-name]; rolls a [$CharInitiative] against Speed of [$Speed] for initiative and goes before the opponents.[br][br]
--]|[
*[img width=32 height=32][*S:t-imgsrc][/img] [*S:character_name]; rolls a [$CharInitiative] against Speed of [$Speed] for initiative and goes before the opponents.[br][br]|+[img width=32 height=32][*S:t-imgsrc][/img] [*S:t-name]; rolls a [$CharInitiative] against Speed of [$Speed] for initiative and goes after the opponents.[br][br]
--]|
--~|turnorder;replacetoken;[&CurrentCharacter];[$CharInitiative]
--~CurrentCharacter|array;getnext;Characters
--?[&CurrentCharacter] -eq ArrayError|InititiveDone|InititiveLoop
--:InititiveDone|
--~|turnorder;sort
}} Rolling Inititive Lucas rolls a 39 against Speed of 37 for initiative and goes before the opponents. Richard Sleeper rolls a 3 against Speed of 40 for initiative and goes before the opponents. Ted Ijaz rolls a 40 against Speed of 42 for initiative and goes before the opponents. Uriah Jessup rolls a 52 against Speed of 50 for initiative and goes before the opponents. Octavian Fuller rolls a 26 against Speed of 30 for initiative and goes before the opponents.