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 / Higscore table and problem with len of the name

Author
Message
Rehak
14
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Scotland
Posted: 7th Feb 2010 19:46
HI i got small problem with playername input.
What i want to do is don't allowed player to put his name below 3 and more than 6, and that is working, but when you don't put anything just press enter when input is display then program save name as empty....
Any ideas. [for x = 1 to len(playername$)
while len(playername$) < 3 or LEN(playername$)> 6 or asc(mid$(playername$,x)) <65 or asc(mid$(playername$,x)) > 90 or asc(mid$(playername$,0)) <65 or asc(mid$(playername$,0)) > 90
sprite alphabet2,0,0,15
wait key
cls
set cursor 20,200
delete sprite alphabet2
wait 100
sprite record1 ,5,40,12
sprite playern ,5,100,13
sprite alphabet1 ,5,300,14
input " ",playername$
playername$ = upper$(playername$)
delete sprite record1
delete sprite playern
delete sprite alphabet1
endwhile
next x]

Try be yourself.
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 7th Feb 2010 20:47 Edited at: 8th Feb 2010 03:19
First of all, to put code in a snippet box on the forum, press the CODE button, paste your code and then press the CODE button again.

As to the problem, you should check for the length of playername$ before you ever get to the loop. Something like this will work:


Rehak
14
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Scotland
Posted: 8th Feb 2010 01:39
i was try like that but after doing that player can put what he wants but on my desing for college player can only put letters

Try be yourself.
Rehak
14
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Scotland
Posted: 8th Feb 2010 11:23
Thats the code


Try be yourself.
Rehak
14
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Scotland
Posted: 8th Feb 2010 12:13
sorry mate i wasn't pay attention that code you was post should work mant thanks !!!!

Try be yourself.
Rehak
14
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Scotland
Posted: 8th Feb 2010 12:21
that's final code that work for sure. But you have to remember to put player name uppercase before check lenght and if the name have letters or numbers.


Try be yourself.

Login to post a reply

Server time is: 2024-09-28 14:24:47
Your offset time is: 2024-09-28 14:24:47