Codes for if One Value is greater, equal to, or less than the other.
LA-Laker
23 Jul 2018, 04:07What are the proper codes for these examples below?
Game 1
Away: 123 vs. Home 98
[[Click to continue]]
[[Click to continue]]:
{if Home<=Away:{[[AWAYWINS]]}
Game 2
Away: 87 vs. Home 87
[[Click to continue]]
[[Click to continue]]:
{if Home=Away:{[[TIE GAME]]}
Game 3
Away: 117 vs. Home 118
[[Click to continue]]
[[Click to continue]]:
{if Home>=Away:{[[HOMEWINS]]}
Swamp Dragon
27 Jul 2018, 14:15Your if statements are incorrect, which is the main problem. Check the syntax I use in the following example. Also, try converting the second variable of your if statement in to a number.
//to set a value in squiffy use @set//
@set Away=123
@set Home=98
Game 1
Away: 123 vs. Home 98
<br>
[[Click to continue]]
[[Click to continue]]:
//indent 4 spaces for this one line of javascript: minus "Away" from "Home"//
squiffy.set("ScoreResult", get("Home") - get("Away"));
//use this syntax with if command//
{if ScoreResult<0:[[AWAYWINS]]}
{if ScoreResult=0:[[TIE GAME]]}
{if ScoreResult>0:[[HOMEWINS]]}
Swamp Dragon
27 Jul 2018, 15:18It just occured to me you might have being trying to redirect, rather than provide links. If so, don't include the square brackets and be sure to close the argument properly:
{if ScoreResult<0:{AWAYWINS}}
{if ScoreResult=0:{TIE GAME}}
{if ScoreResult>0:{HOMEWINS}}
[[HOMEWINS]]:
Some content
[[TIE GAME]]:
Some content
[[AWAYWINS]]:
Some content
LA-Laker
29 Jul 2018, 05:42Thanks! I've tested the code and it really worked out!