> For the complete documentation index, see [llms.txt](https://bothelp.hktrpg.com/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bothelp.hktrpg.com/guide/en/entertainment-features/storyteller-hu-dong-gu-shi-xi-tong/fan-li/04.-test.md).

# 04. test

```
// RUN_DESIGN feature test script (v4: extensive variable combinations and if/ifs separation test)

[meta] title "Extensive Variable Combinations and if/ifs Separation Test"
[meta] author "SAD"
[intro] The core of this script is the starting page (label 0), which runs intensive condition checks to verify the engine's evaluation logic. This version specifically distinguishes the behavior of if condition chains from ifs independent conditions, and adds more than 50 complex logic and arithmetic comparisons.

// --- Player variable definitions ---
[player_var] player_name "Enter your adventurer name:" "e.g. Tester"

// --- Game stat definitions (4) ---
[stat_def] Strength 1 10 "Strength"
[stat_def] Agility 1 10 "Agility"
[stat_def] Wit 1 10 "Wit"
[stat_def] Charm 1 10 "Charm"

// --- Story begins ---

[label] 0
[title] Variable Test Platform
[text] Welcome, {player_name}! The system is running extensive condition checks...
[text] ---
[text] [ sezione 1: 'ifs' independent condition test (should display all matching items) ]

// Exact stat values (using ifs)
[text|ifs=Strength==1]Exact stat value -> Strength: 1
[text|ifs=Strength==2]Exact stat value -> Strength: 2
[text|ifs=Strength==3]Exact stat value -> Strength: 3
[text|ifs=Strength==4]Exact stat value -> Strength: 4
[text|ifs=Strength==5]Exact stat value -> Strength: 5
[text|ifs=Strength==6]Exact stat value -> Strength: 6
[text|ifs=Strength==7]Exact stat value -> Strength: 7
[text|ifs=Strength==8]Exact stat value -> Strength: 8
[text|ifs=Strength==9]Exact stat value -> Strength: 9
[text|ifs=Strength==10]Exact stat value -> Strength: 10
[text]
[text|ifs=Agility==1]Exact stat value -> Agility: 1
[text|ifs=Agility==2]Exact stat value -> Agility: 2
[text|ifs=Agility==3]Exact stat value -> Agility: 3
[text|ifs=Agility==4]Exact stat value -> Agility: 4
[text|ifs=Agility==5]Exact stat value -> Agility: 5
[text|ifs=Agility==6]Exact stat value -> Agility: 6
[text|ifs=Agility==7]Exact stat value -> Agility: 7
[text|ifs=Agility==8]Exact stat value -> Agility: 8
[text|ifs=Agility==9]Exact stat value -> Agility: 9
[text|ifs=Agility==10]Exact stat value -> Agility: 10
[text]
[text|ifs=Wit==1]Exact stat value -> Wit: 1
[text|ifs=Wit==2]Exact stat value -> Wit: 2
[text|ifs=Wit==3]Exact stat value -> Wit: 3
[text|ifs=Wit==4]Exact stat value -> Wit: 4
[text|ifs=Wit==5]Exact stat value -> Wit: 5
[text|ifs=Wit==6]Exact stat value -> Wit: 6
[text|ifs=Wit==7]Exact stat value -> Wit: 7
[text|ifs=Wit==8]Exact stat value -> Wit: 8
[text|ifs=Wit==9]Exact stat value -> Wit: 9
[text|ifs=Wit==10]Exact stat value -> Wit: 10
[text]
[text|ifs=Charm==1]Exact stat value -> Charm: 1
[text|ifs=Charm==2]Exact stat value -> Charm: 2
[text|ifs=Charm==3]Exact stat value -> Charm: 3
[text|ifs=Charm==4]Exact stat value -> Charm: 4
[text|ifs=Charm==5]Exact stat value -> Charm: 5
[text|ifs=Charm==6]Exact stat value -> Charm: 6
[text|ifs=Charm==7]Exact stat value -> Charm: 7
[text|ifs=Charm==8]Exact stat value -> Charm: 8
[text|ifs=Charm==9]Exact stat value -> Charm: 9
[text|ifs=Charm==10]Exact stat value -> Charm: 10

// Pairwise stat comparisons (using ifs)
[text] ---
[text|ifs=Strength>Agility]Comparison -> Strength ({Strength}) > Agility ({Agility})
[text|ifs=Strength<Agility]Comparison -> Strength ({Strength}) < Agility ({Agility})
[text|ifs=Strength==Agility]Comparison -> Strength ({Strength}) == Agility ({Agility})
[text|ifs=Strength>Wit]Comparison -> Strength ({Strength}) > Wit ({Wit})
[text|ifs=Strength<Wit]Comparison -> Strength ({Strength}) < Wit ({Wit})
[text|ifs=Strength==Wit]Comparison -> Strength ({Strength}) == Wit ({Wit})
[text|ifs=Strength>Charm]Comparison -> Strength ({Strength}) > Charm ({Charm})
[text|ifs=Strength<Charm]Comparison -> Strength ({Strength}) < Charm ({Charm})
[text|ifs=Strength==Charm]Comparison -> Strength ({Strength}) == Charm ({Charm})
[text|ifs=Agility>Wit]Comparison -> Agility ({Agility}) > Wit ({Wit})
[text|ifs=Agility<Wit]Comparison -> Agility ({Agility}) < Wit ({Wit})
[text|ifs=Agility==Wit]Comparison -> Agility ({Agility}) == Wit ({Wit})
[text|ifs=Agility>Charm]Comparison -> Agility ({Agility}) > Charm ({Charm})
[text|ifs=Agility<Charm]Comparison -> Agility ({Agility}) < Charm ({Charm})
[text|ifs=Agility==Charm]Comparison -> Agility ({Agility}) == Charm ({Charm})
[text|ifs=Wit>Charm]Comparison -> Wit ({Wit}) > Charm ({Charm})
[text|ifs=Wit<Charm]Comparison -> Wit ({Wit}) < Charm ({Charm})
[text|ifs=Wit==Charm]Comparison -> Wit ({Wit}) == Charm ({Charm})

[text] ---
[text] [ sezione 2: 'if' condition chain test (should display only the first matching item) ]
[text|if=Strength > Agility && Strength > Wit && Strength > Charm]IF chain test -> Strength is the highest stat.
[text|if=Agility > Strength && Agility > Wit && Agility > Charm]IF chain test -> Agility is the highest stat.
[text|if=Wit > Strength && Wit > Agility && Wit > Charm]IF chain test -> Wit is the highest stat.
[text|if=Charm > Strength && Charm > Agility && Charm > Wit]IF chain test -> Charm is the highest stat.
[text|if=Strength == Agility && Strength > Wit && Strength > Charm]IF chain test -> Strength and Agility are tied for highest.
[text|else]IF chain test -> The highest stat is not unique or the condition is not covered.

[text] ---
[text] [ sezione 3: 'ifs' independent condition test - 50+ complex cases ]
// Arithmetic and comparisons
[text|ifs=(Strength + Agility) > 15]Compound condition -> Sum of Strength and Agility exceeds 15
[text|ifs=(Wit + Charm) < 5]Compound condition -> Sum of Wit and Charm is less than 5
[text|ifs=(Strength + Wit) > (Agility + Charm)]Compound condition -> Sum of Strength and Wit > sum of Agility and Charm
[text|ifs=(Strength - Agility) > 5]Compound condition -> Strength exceeds Agility by more than 5
[text|ifs=Strength == (Agility + Wit)]Compound condition -> Strength equals the sum of Agility and Wit
[text|ifs=Charm * 2 > Strength]Compound condition -> Twice Charm is greater than Strength
[text|ifs=Strength > 5 && Agility > 5]Compound condition -> Both Strength and Agility are above 5
[text|ifs=Wit <= 3 && Charm <= 3]Compound condition -> Both Wit and Charm are less than or equal to 3
[text|ifs=Strength >= 9 || Agility >= 9]Compound condition -> Either Strength or Agility is very high (>= 9)
[text|ifs=Wit == 10 || Charm == 10]Compound condition -> Either Wit or Charm reaches the maximum (== 10)
[text|ifs=Strength > 5 && Wit > 5 && Charm > 5]Compound condition -> Strength, Wit, and Charm are all high (each > 5)
[text|ifs=Strength < 5 || Agility < 5 || Wit < 5]Compound condition -> At least one of Strength, Agility, or Wit is below 5
[text|ifs=(Strength > 7 && Agility > 7) || (Wit > 7 && Charm > 7)]Compound condition -> (STR+AGI pair > 7) or (WIT+CHM pair > 7)
[text|ifs=Strength >= Agility && Agility >= Wit && Wit >= Charm]Compound condition -> Stats show a descending or equal trend (STR>=AGI>=WIT>=CHM)
[text|ifs=Strength + Agility + Wit + Charm >= 35]Compound condition -> Total of all four stats reaches 35 or above
[text|ifs=Strength + Agility + Wit + Charm < 10]Compound condition -> Total of all four stats is below 10
[text|ifs=Strength > 3 && Strength < 8]Compound condition -> Strength is in the mid range (3 < STR < 8)
[text|ifs=Agility == 1 || Agility == 10]Compound condition -> Agility is an extreme value (1 or 10)
[text|ifs=Strength == Wit && Agility == Charm]Compound condition -> Stats are equal in pairs (STR=WIT, AGI=CHM)
[text|ifs=Strength != Agility && Strength != Wit && Strength != Charm && Agility != Wit && Agility != Charm && Wit != Charm]Compound condition -> All stat values are different from one another
[text|ifs=Strength == Agility && Agility == Wit && Wit == Charm]Compound condition -> All stat values are identical
[text|ifs=(Strength * Wit) > (Agility * Charm)]Compound condition -> Product of Strength and Wit > product of Agility and Charm
[text|ifs=Agility / 2 > Charm]Compound condition -> Half of Agility is still greater than Charm
[text|ifs=Strength % 2 == 0]Compound condition -> Strength is even
[text|ifs=Agility % 2 != 0]Compound condition -> Agility is odd
[text|ifs=(Wit + Charm) % 2 == 0]Compound condition -> Sum of Wit and Charm is even
[text|ifs=(Strength > Agility || Strength > Wit) && Strength > Charm]Compound condition -> Strength is higher than at least Agility or Wit, and always higher than Charm
[text|ifs=Strength == 5 && Agility == 5 && Wit == 5 && Charm == 5]Compound condition -> All stats are 5
[text|ifs=Strength > 1 && Agility > 1 && Wit > 1 && Charm > 1]Compound condition -> No stat is 1
[text|ifs=Strength == 10 && Agility == 10 && Wit == 10 && Charm == 10]Compound condition -> All stats are at maximum
[text|ifs=(Strength + Agility) - (Wit + Charm) > 5]Compound condition -> (STR+AGI) total exceeds (WIT+CHM) total by more than 5
[text|ifs=Strength * Strength > 80]Compound condition -> Square of Strength is greater than 80 (i.e. Strength > 8)
[text|ifs=Strength > Wit + 5]Compound condition -> Strength exceeds Wit by more than 5 points
[text|ifs=Charm < Agility - 3]Compound condition -> Charm is more than 3 points lower than Agility
[text|ifs=Strength == Agility || Strength == Wit || Strength == Charm]Compound condition -> Strength equals at least one other stat
[text|ifs=Agility != Charm]Compound condition -> Agility and Charm have different values
[text|ifs=Wit > (Strength + Agility + Charm) / 3]Compound condition -> Wit is above the average of the other three stats
[text|ifs=Strength * 10 + Agility > 80]Compound condition -> Compound weight check (10*STR + AGI > 80)
[text|ifs=Strength == 1 && Charm == 10]Compound condition -> Strength is lowest and Charm is highest
[text|ifs=(Strength > 8 && Agility < 4) || (Wit > 8 && Charm < 4)]Compound condition -> A "high offense, low defense" or "high wit, low charm" combination exists
[text|ifs=Agility % Strength == 0 && Strength > 1]Compound condition -> Agility is a multiple of Strength (and Strength > 1)
[text|ifs=Strength + Wit == Agility + Charm]Compound condition -> Grouped stat totals are equal
[text|ifs=(Agility - 5) * (Wit - 5) > 0]Compound condition -> Agility and Wit are on the same side of 5 (both above 5 or both below 5)
[text|ifs=(Strength > 5) && !(Agility > 5)]Compound condition -> Strength is greater than 5, but Agility is not greater than 5
[text|ifs=Strength - Wit == 1 || Wit - Strength == 1]Compound condition -> Strength and Wit have adjacent values
[text|ifs=Strength > 5 && Agility > 5 || Charm < 3]Compound condition -> (Both Strength and Agility are high) or (Charm is extremely low)
[text|ifs=(Strength + Agility + Wit + Charm) / 4 > 6]Compound condition -> Average stat is greater than 6
[text|ifs=Strength * Agility * Wit * Charm > 5000]Compound condition -> Product of all four stats exceeds 5000
[text|ifs=Strength > Charm * 2 && Agility > Wit * 2]Compound condition -> Physical stats are each more than twice their corresponding stats
[text|ifs=Strength == 1 && Agility == 2 && Wit == 3 && Charm == 4]Compound condition -> Specific combination of stats 1, 2, 3, 4
[text|ifs=Wit - Strength > 3]Compound condition -> Wit is significantly higher than Strength (gap > 3)
[text|ifs=Agility * Charm > Strength * Wit]Compound condition -> Product of AGI*CHM exceeds product of STR*WIT

[text] ---
[text] [ sezione 4: standalone 'if/else' chain test (unchanged) ]
[text|if=Wit >= 10 && Strength >= 8]If/Else chain -> Trigger condition: high Wit and high Strength
[text|if=Strength >= 9 && Agility <= 2]If/Else chain -> Trigger condition: high Strength, low Agility
[text|if=Agility >= 9 && Strength < 5]If/Else chain -> Trigger condition: high Agility, low Strength
[text|if=Strength == Agility && Agility == Wit && Wit == Charm]If/Else chain -> Trigger condition: all four stats perfectly balanced
[text|if=Strength + Agility + Wit + Charm >= 35]If/Else chain -> Trigger condition: extremely high total of all four stats
[text|if=Charm >= 8 && Wit < 5]If/Else chain -> Trigger condition: high Charm but low Wit
[text|else]If/Else chain -> Fallback: does not match the "high Charm but low Wit" condition

[text] ---
[text] [ sezione 5: standalone 'if/else' chain test (advanced 1) ]
[text|if=!(Strength > Wit)]If/Else chain -> Negation: Strength is not higher than Wit
[text|if=!(Agility <= 2)]If/Else chain -> Negation: Agility is not less than or equal to 2
[text|else]If/Else chain -> Fallback: negation conditions not matched

[text] ---
[text] [ sezione 6: standalone 'if/else' chain test (advanced 2) ]
[text|if=(Strength + Agility) >= (Wit + Charm)]If/Else chain -> Compound total: STR+AGI is not lower than WIT+CHM
[text|if=(Strength >= 8) && (Wit >= 8) && !(Charm < 5)]If/Else chain -> Compound condition: high Strength and Wit, and Charm is not low
[text|else]If/Else chain -> Fallback: advanced compound conditions not matched

[text] ---
[text] [ sezione 7: standalone 'if/else' chain test (advanced 3) ]
[text|if=Strength % 2 == 0 && Wit % 2 == 0]If/Else chain -> Both even: Strength and Wit
[text|if=Strength % 2 != 0 && Wit % 2 != 0]If/Else chain -> Both odd: Strength and Wit
[text|if=(Strength % 2) != (Wit % 2)]If/Else chain -> Different parity: Strength and Wit
[text|else]If/Else chain -> Fallback: parity conditions not matched

[text] ---
[text] Testing complete. Choose your next step.

[choice]
-> Continue the story | 1
-> Jump directly to the ending | 100

[text] ---
[text] [ sezione 8: dice and set test ]
[set] roll=3d6+2
[text] Roll result (3d6+2): {roll}
[text|ifs=2d20>25]Conditional roll 2d20>25 matched
[text|ifs=2d20<=25]Conditional roll 2d20<=25 matched
[set|if=roll>=12] Strength=Strength+1
[set] mood=HAPPY
[text] Current mood: {mood}

[text] ---
[text] [ sezione 9: random test (0%/100%) ]
[random] 0%
[text] This line should almost never appear (0%)
[random] 100%
[text] This line should always appear (100%)

[text] ---
[text] [ sezione 10: speaker test ]
[text|speaker=Guide] This is text with a speaker attribute (currently displayed the same as regular text).

[text] ---
[text] [ sezione 11: choice and stat change test (2a/2b/2c same-page jump) ]
[choice]
-> Test jump to page 2 (route a, Strength+2) | 2a | stat=Strength+2
-> Test jump to page 2 (route b, Agility+3) | 2b | stat=Agility+3
-> Test jump to page 2 (route c, Wit+4) | 2c | stat=Wit+4
-> End this turn immediately | END

[text] ---
[text] [ sezione 12: var_def and conditional set/display test ]
[var_def] luck 3 18 "Luck"
[set] luck=3d6
[text] Your Luck value is: {luck}
[text] Test placeholder roll ({1D100}): displays the roll result only, no other effect
[set|ifs=luck>=15] Charm=Charm+1
[set|ifs=luck<14] Agility=Agility-1
[text|ifs=luck>=15]Excellent luck: Charm +1
[text|ifs=luck<14]Poor luck: Agility -1
[set|if=luck>50]Strength=Strength+1
[text|ifs=luck>50]Excellent luck: Strength +1
[set|if=luck<50]Wit=Wit+1
[text|ifs=luck<50]Excellent luck: Wit +1

[text] ---
[text] [ sezione 13: conditional choice display/allow test ]
[text] The following choices appear based on conditions:
[choice]
-> (Requires Strength>=10) Test conditional choice | 3 | if=Strength>=10
-> (Requires Agility>=5) Test conditional choice | 3 | if=Agility>=5
-> (Requires Wit<=3) Test conditional choice | 3 | if=Wit<=3

[text] ---
[text] [ sezione 14: if/else chain (total comparison and tie) ]
[text|if=Strength+Agility > Wit+Charm]If/Else chain -> STR+AGI total is higher
[text|if=Strength+Agility == Wit+Charm]If/Else chain -> Both totals are equal
[text|else]If/Else chain -> WIT+CHM total is higher

[text] ---
[text] [ sezione 15: random 30% and conditional speaker ]
[random] 30%
[text] This line has a 30% chance to appear
[text|speaker=Guide,if=Charm>=7](Guide) This line appears only when Charm is 7 or above

// Subsequent pages remain unchanged so you can continue after testing
[label] 1
[title] Dark Path
[text] You set foot on the dark path...
[choice]
-> Continue deeper into the forest. | 3
-> Return to the crossroads. | 0

[label] 2
[title] Multi-Branch Same-Page Test
[text] You have arrived at the same page (2). Current stats:
[text] Strength={Strength}, Agility={Agility}, Wit={Wit}, Charm={Charm}
[text] Mood: {mood}
[choice]
-> Return to start | 0
-> Go to ending | 100

[label] 3
[title] Challenge in the Deep Forest
[text] At the heart of the forest, you discover an ancient altar covered in vines.
[choice]
-> View the ending. | 100

[label] 100
[title] Ending
[ending]
[text|if=Wit>=10]Ending -> Victory through Wit.
[text|if=Strength>=10]Ending -> Victory through Strength.
[text|if=Agility>=10]Ending -> Victory through Agility.
[text|else]Ending -> You completed this expedition successfully. Although you did not earn a remarkable title, the experience helped you grow a great deal. It was an ordinary yet fulfilling adventure.
[choice]
-> Start a new adventure | 0
-> End game | END
```
