On my map I have the following trigger. It works just fine when I enter a player number (ex: -skills 3), but when I 'accidently' leave out a number and just type '-skills' the game crashes. How can I add in some protection for this?
skillchk_playernum...integer array (12)
heroskills...............ability array (84) initally assigned 'acid bomb'..................(7 skills/12 players)
Trigger:
- skillrequest
- Events
- Player - Player 1 (Red) types a chat message containing -skills as A substring
- Player - Player 2 (Blue) types a chat message containing -skills as A substring
- Player - Player 3 (Teal) types a chat message containing -skills as A substring
- Player - Player 4 (Purple) types a chat message containing -skills as A substring
- Player - Player 5 (Yellow) types a chat message containing -skills as A substring
- Player - Player 6 (Orange) types a chat message containing -skills as A substring
- Player - Player 7 (Green) types a chat message containing -skills as A substring
- Player - Player 8 (Pink) types a chat message containing -skills as A substring
- Player - Player 9 (Gray) types a chat message containing -skills as A substring
- Player - Player 10 (Light Blue) types a chat message containing -skills as A substring
- Player - Player 11 (Dark Green) types a chat message containing -skills as A substring
- Player - Player 12 (Brown) types a chat message containing -skills as A substring
- Conditions
- Actions
- Set skillchk_playernum[(Player number of (Triggering player))] = (Integer((Substring((Entered chat string), 9, 10))))
- Game - Display to (All players) the text: ((Name of (Player(skillchk_playernum[(Player number of (Triggering player))]))) + 's Skills<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" />
- For each (Integer A) from ((skillchk_playernum[(Player number of (Triggering player))] x 7) - 6) to (skillchk_playernum[(Player number of (Triggering player))] x 7), do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- heroskills[(Integer A)] Not equal to Acid Bomb
- Then - Actions
- Game - Display to (All players) the text: ((String((Integer A))) + ( + (Name of heroskills[(Integer A)])))
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Integer A) Equal to ((skillchk_playernum[(Player number of (Triggering player))] x 7) - 6)
- Then - Actions
- Game - Display to (All players) the text: None
- Else - Actions
- Do nothing
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Events
skillchk_playernum...integer array (12)
heroskills...............ability array (84) initally assigned 'acid bomb'..................(7 skills/12 players)