• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Not a number check

Status
Not open for further replies.
this does not help me. I tried comparing it if it's 0, greater than 0, less than 0, compared each of the player numbers, still crashes.
There must be some other solution....


  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TempInt Less than 1
    • Then - Actions
      • Skip remaining actions
    • Else - Actions
 
Level 15
Joined
Feb 7, 2020
Messages
398
There's probably a JASS method but I don't know it. I made this and it worked. Initialize the number map in an init trigger.

  • Enter Number Command
    • Events
      • Player - Player 1 (Red) types a chat message containing -number as A substring
    • Conditions
    • Actions
      • Set VariableSet enteredStringNumber = (Substring((Entered chat string), 9, 9))
      • Set VariableSet enteredStringIsNumber = False
      • For each (Integer A) from 0 to 9, do (Actions)
        • Loop - Actions
          • Set VariableSet numberMap[(Integer A)] = (String((Integer A)))
      • For each (Integer A) from 0 to 9, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • enteredStringNumber Equal to numberMap[(Integer A)]
            • Then - Actions
              • Set VariableSet enteredStringIsNumber = True
              • Custom script: exitwhen true
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • enteredStringIsNumber Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: (Number found : + (String((Integer(enteredStringNumber)))))
        • Else - Actions
          • Game - Display to (All players) the text: Error: that is not ...
upload_2020-4-18_9-0-16.png

edit: had a typo in the 2nd loop, should match the first loop 0-9
 

Attachments

  • dotDotDotAxman13.w3m
    12.9 KB · Views: 19
Last edited:
Status
Not open for further replies.
Top