Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / In an input command can i...

Author
Message
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 15th Jul 2008 01:01
can i make it that it doesnt accept any letters or %-^£^(&%£ figures?

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
SirFire
19
Years of Service
User Offline
Joined: 4th Apr 2005
Location: North America
Posted: 15th Jul 2008 04:15 Edited at: 15th Jul 2008 04:16
Nope.

You can perform a check after the input to see if the entry is a number, if not then print an error message and loop back to the input so they can try again.

Unfortunately, DBP doesn't have an instr$ function, but you might find the function in the first post here
http://forum.thegamecreators.com/?m=forum_view&t=126869&b=6 useful for finding certain non-numerical characters.

This code will only allow numbers to be entered:


_____________________
Windows Vista: Just say no.
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 15th Jul 2008 10:30
that was exactly what i was after lol and was expecting like that
i probibly didnt explain exactly what i was after but that was what i was after lol =D thankyou!!!!!!!!!!1

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 15th Jul 2008 14:12
What if you want the number 0

MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 15th Jul 2008 14:57
Aswell as using the Input Command, you could also try using the Entry$() Command so you can read the keyboard entry without pausing your programme.

Everyone Be Cool, You, Be Cool.
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 15th Jul 2008 15:18
Quote: "What if you want the number 0"

i dont want people attacking with 0 men =D

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 16th Jul 2008 13:59 Edited at: 16th Jul 2008 14:01
Instr can always be emulated using mid$ and len, allthough it's of course slower than a built in command would be.

Of course, that simple function only gives you the position of the first occurence of the search string in your string.

"I kören hörs de brummande busarna Björnligan och Gondolen"

Login to post a reply

Server time is: 2024-09-27 18:25:40
Your offset time is: 2024-09-27 18:25:40