• 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.

entering a number in chat

Status
Not open for further replies.

007

007

Level 6
Joined
May 3, 2009
Messages
175
i want a player to type in a number between 1 and 100 and this value will be used afterwards. it does not work with the random number (only if i enter this exact random number) and the min and max doesnt work either. if min is 1 and max 100 it only works for 1 and 100.
 
Just use (in the trigger with the Player - Player X types <Empty String> as an exact match):
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Integer(Entered chat string)) Greater than or Equal to 1
        • (Integer(Entered chat string)) Less than or Equal to 100
      • Then - Actions
        • Set NumberTyped[(Player number of (Triggering player))] = (Integer(Entered chat string))
If you want reals, use String to real conversion instead, so that numbers like "10.372" can also be accepted, depending on what you want to do with it.
 
Because he talks about string comparison and not about integers/reals.

@007 Don't use string comaparison, since you want to save integer or real number thus you are forced to use their comparisons.
Select the one you need (I suppose it's real one) and from filter, at the top of the list you should find 'Convert String to Integer' or in case for real: 'Convert String to Real'.
 
Status
Not open for further replies.
Top