This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| 4rpl:commands:while [2021/01/08 16:01] – external edit 127.0.0.1 | 4rpl:commands:while [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ~~NOTOC~~ | ~~NOTOC~~ | ||
| - | < | + | <= [[4rpl: |
| + | <= [[4rpl: | ||
| ====== while ====== | ====== while ====== | ||
| Line 12: | Line 14: | ||
| ===== Examples ===== | ===== Examples ===== | ||
| <code 4rpl> | <code 4rpl> | ||
| + | # CONSOLE SCRIPT | ||
| 5 ->y | 5 ->y | ||
| while < | while < | ||
| Line 17: | Line 20: | ||
| trace(< | trace(< | ||
| <-y sub(1) -> | <-y sub(1) -> | ||
| + | endwhile | ||
| + | </ | ||
| + | <code 4rpl> | ||
| + | # UNIT SCRIPT | ||
| + | |||
| + | # This script increases the max health of the unit over time. | ||
| + | # The script won't be stuck in the loop since it's limited by the unit's | ||
| + | # Health regen rate or " | ||
| + | |||
| + | while eq(GetUnitHealth(self) GetUnitMaxHealth(self)) | ||
| + | repeat | ||
| + | SetUnitMaxHealth(self GetUnitMaxHealth 0.5 add) #Add 0.5 points of max health to the unit | ||
| + | SetUnitDebugText(self Concat(" | ||
| endwhile | endwhile | ||
| </ | </ | ||
| < | < | ||