Info:
A slightly more advanced input display box then a simple
textual prompt. This could be improved by making it a 3d panel.
great for editors or user input
Usage :
Once loaded press control and t
Once you have entered in your town name press enter.
repeat to see results
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$
