numberInput?

Discussion forum for Devil Whiskey 3rd Party MODS.

Moderator: Admin

Post Reply
User avatar
origen
Dark Sidhe Lord
Posts: 903
Joined: Thu Feb 10, 2005 5:54 pm
Location: Secret League of Nirulat Headquarters
Contact:

numberInput?

Post by origen »

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.
User avatar
HGamer
War Monger
Posts: 188
Joined: Thu Feb 10, 2005 7:59 pm
Location: Land of fruits & nuts, i.e. SoCal
Contact:

Post by HGamer »

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!
User avatar
origen
Dark Sidhe Lord
Posts: 903
Joined: Thu Feb 10, 2005 5:54 pm
Location: Secret League of Nirulat Headquarters
Contact:

Post by origen »

That seems like too much work right now. There will always be someone who will try to put something in that can't be converted.
User avatar
HGamer
War Monger
Posts: 188
Joined: Thu Feb 10, 2005 7:59 pm
Location: Land of fruits & nuts, i.e. SoCal
Contact:

Post by HGamer »

In that case, assume they typed in "ALL". :twisted:
1 point 21 jigawatts!
User avatar
origen
Dark Sidhe Lord
Posts: 903
Joined: Thu Feb 10, 2005 5:54 pm
Location: Secret League of Nirulat Headquarters
Contact:

Post by origen »

That is so mean, it just might work!
Post Reply