• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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.
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
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