Posts: 22
Threads: 6
Joined: Sep 2004
Hi, I just started making a text RPG, but with 2 bit maps on the screen i want to stay on threw out the rpg but i havent been able to get LOCATE command to work in SCREEN 12. I looked for posts and tuts on how to make text box's but i wasnt able to find any.
if anyone could give me an example or a link to a tut i would be very grateful. Thanks,
Posts: 719
Threads: 72
Joined: Mar 2003
i did post something about that recently.......i'll find the link for you...
http://forum.qbasicnews.com/viewtopic.ph...ght=#77971
Tah-dah!
read my last post...
Oz~
Posts: 22
Threads: 6
Joined: Sep 2004
Posts: 22
Threads: 6
Joined: Sep 2004
There is one problem with that code it says that "Element not defined" about info.x in the LINE command. Anyone know wut i have to do to fix it?
Posts: 719
Threads: 72
Joined: Mar 2003
revised SUB
Code:
SUB TextBox (info as TextBoxType)
DIM kbd AS STRING
DIM tkey AS STRING * 1
LINE (info.Posx, info.Posy)-(info.Posx + info.length, info.Posy + info.height), 15,BF
IF TIMER MOD 2 = 0 THEN
dx% = info.Posx + ((LEN(text) + 1) * 8)
LINE (dx%, info.Posy + 1)-(dx%, info.Posy + info.height - 1), 0
END IF
kbd = INKEY$
tkey = kbd
IF kbd = CHR$(32) THEN text = text + "_"
IF ASC(tkey) > 32 AND ASC(tkey) <= 126 THEN
info.text = info.text + tkey
ELSEIF tkey = CHR$(13) THEN
info.selected = 0
ELSEIF tkey = CHR$(8) AND LEN(text) > 0 THEN
text = LEFT$(text, (LEN(text) - 1))
ELSEIF tkey = CHR$(8) AND LEN(text) = 0 THEN
SOUND 200, .5
END IF
keyboard = kbd
RelPRINT text, info.posx, info.posy, 0
END SUB
i mistakenly used .x and .y instead of .PosX and .PosY
Oz~
Posts: 2,771
Threads: 96
Joined: Oct 2003
Quote:Hi, I just started making a text RPG, but with 2 bit maps on the screen i want to stay on threw out the rpg but i havent been able to get LOCATE command to work in SCREEN 12. I looked for posts and tuts on how to make text box's but i wasnt able to find any.
if anyone could give me an example or a link to a tut i would be very grateful. Thanks,
the locate command works just fine in Screen 12. Just remember, the coordinates are NOT pixel relative, they are still relative to the character size.
So:
SCREEN 0
LOCATE 10, 10
will locate to the same position as
SCREEN 12
LOCATE 10, 10