Ok firstly to make this clear, to change the output of text to the screen you set the font using the
set text font "Verdana" or any other font name
and print or text it accordingly.
I was going to direct you to the character map to get the bullet character from Arial and dynamically use that as the password hiding character.
Then i thought it would be easier to just use a string of the asterix *.
This then reminded to do a search on the boards for the keyword "password".
Low and behold I found a great example by Grog Grueslayer.
set text opaque
` Passwords need to be all highercase (or lowercase). "A" and "a" are two different letters
Password$="PIZZA"
` Make a$ = the string returned from the GetPassword function
a$=GetPassword()
` Check if user input is anything but the password
if a$<>Password$
text 0,20,"Wrong!"
wait key
end
endif
` Password right... program goes on.
text 0,20,"Correct!"
wait key
end
function GetPassword()
do
text 0,0,"User Input: "+Star$+" "
a$=inkey$()
` Check if a key was pressed
if a$<>""
` Loop till the user lets go of the key
repeat
b$=inkey$()
until b$=""
endif
` Backspace
if a$=chr$(8)
Pass$ = left$(Pass$,len(Pass$)-1)
a$=""
endif
if a$=chr$(13) then exit
if a$<>"" then Pass$ = Pass$ + a$
` Create the *'s
Star$=""
for t=1 to len(Pass$)
Star$=Star$+"*"
next t
loop
` Make password uppercase (so it's not case sensitive)
Pass$=upper$(Pass$)
` Return Pass$ so it is seen on the outside of the function
endfunction Pass$
I then pulled apart my old editors input box routines, and namely the town generation input box as another cleaner example of entering in data.
Press Control T on this example and hit enter once you have entered in the name you wish to use. I have not added a password asterix feature to the 2nd example, but you should have enough to get you started.
REM TEMP SETUP
sync on : sync rate 60 : backdrop on
rem make a temp cube
make object cube 1,1
rem ------------------------------------------------------------------------------------------
rem Town Input Arrays
rem ------------------------------------------------------------------------------------------
dim Town_oldkey$(1) : Town_oldkey$(1)=""
dim Town_newkey$(1) : Town_newkey$(1)=""
dim Town_text$(1) : Town_text$(1)=""
dim Town_finaltext$(1) : Town_finaltext$(1) = ""
dim Town_InputBox_Toggle(1) : Town_InputBox_Toggle(1) = 0
dim Town_InputBox_Switch(1) : Town_InputBox_Switch(1) = 0
dim Town$(1) : Town$(1) = Generate_Town_NAME$()
REM TEMP MAIN LOOP
disable escapekey : while escapekey()=0
rem ------------------------------------------------------------------------------------------
rem Town_Input Dialogue Box CONTROL and T to activate
rem ------------------------------------------------------------------------------------------
If controlkey() = 1 and keystate(20)=1 and Town_InputBox_Switch(1)=0
Town_InputBox_Toggle(1)=1-Town_InputBox_Toggle(1)
Town_InputBox_Switch(1)=1
Endif
If keystate(20)=0 then Town_InputBox_Switch(1)=0
if Town_InputBox_Toggle(1)=1
Town_InputBox(10,"Town Name","Eg:Torindort")
endif
rem rotate the temp 3d object
r = wrapvalue(r+1) : rotate object 1,r,r,r
REM END MAIN LOOP
sync : endwhile
end
REM FUNCTIONS
rem ---------------------------------------------------------------------------
rem Town Input Box Function
rem ---------------------------------------------------------------------------
function Town_InputBox(maxchars,VarName$,InfoString$)
Town_oldkey$(1) = Town_newkey$(1)
Town_newkey$(1) = INKEY$()
IF KEYSTATE(14)
IF LEN(Town_text$(1)) > 0 THEN Town_text$(1) = LEFT$(Town_text$(1),LEN(Town_text$(1))-1)
ELSE
if returnkey()=1
Town_InputBox_Switch(1)=0
Town_InputBox_Toggle(1)=0
endif
IF RETURNKEY()
IF Town_text$(1) <> "" THEN Town_finaltext$(1) = Town_text$(1) : Town_text$(1) = ""
ELSE
if LEN(Town_text$(1)) < maxchars
IF Town_newkey$(1) <> Town_oldkey$(1) THEN Town_text$(1) = Town_text$(1) + Town_newkey$(1)
endif
ink rgb(65,65,65),1
box screen width()/2-105 , screen height()/2-40 , screen width()/2+105 , screen height()/2+80
ink rgb(192,192,192),1
box screen width()/2-104 , screen height()/2-39 , screen width()/2+104 , screen height()/2+79
ink rgb(15,15,15),1
CENTER TEXT screen width()/2,screen height()/2-30,"Enter "+VarName$
ink rgb(255,255,255),1
box screen width()/2-90 , screen height()/2-10 , screen width()/2+90 , screen height()/2+10
ink rgb(65,65,65),1
box screen width()/2-88 , screen height()/2-8 , screen width()/2+88 , screen height()/2+8
ink rgb(192,192,192),1
CENTER TEXT screen width()/2,screen height()/2-7,"|"+Town_text$(1)+"|"
ink rgb(15,15,15),1
CENTER TEXT screen width()/2,screen height()/2+15,InfoString$
CENTER TEXT screen width()/2,screen height()/2+35,"Maximum Characters : "+STR$(maxchars)
CENTER TEXT screen width()/2,screen height()/2+55,"Last Entry : "+Town_finaltext$(1)
endif
endif
Town$(1) = Town_finaltext$(1)
endfunction
function Generate_Town_NAME$()
dim tNAME$(5)
tNAME$(0)="Pravinca"
tNAME$(1)="Thaedora keep "
tNAME$(2)="Guthunder"
tNAME$(3)="Budalands"
tNAME$(4)="Tallion"
tNAME$(5)="Cin-mael"
townnum = rnd(5)
TownNAME$ = tNAME$(townnum)
undim tNAME$(5)
endfunction TownNAME$
