numberInput?
Moderator: Admin
- origen
- Dark Sidhe Lord
- Posts: 903
- Joined: Thu Feb 10, 2005 5:54 pm
- Location: Secret League of Nirulat Headquarters
- Contact:
numberInput?
Is there a command that will allow the user to only enter numbers, instead of text? The stringInput only allows text. If there is, can you then break down that information into ranges, for example if the number was entered was between 100 and 199, or between 200 or 299. This will help for things like tipping and such.
- HGamer
- War Monger
- Posts: 188
- Joined: Thu Feb 10, 2005 7:59 pm
- Location: Land of fruits & nuts, i.e. SoCal
- Contact:
Nothing directly that I can see. I would just grab input from the user as a string using stringInput(), and validate it using int() and then some if and elif comparisons for the range you want. May have to check and recover from a Type Error if the dumb user doesn't give you anything that int() can convert to an integer. The Python tutorial and language reference should have enough to get you going.
1 point 21 jigawatts!