Scripts / Multiple Text Boxes?

Author
Message
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 9th Jun 2015 06:14
Is there a way to display multiple text boxes? I would like to create a HUD or a line of text that consistently floats on the top of the screen to display how much currency I have and experience. I have no problem doing this with text but once another text attempts to display it conflicts with the HUD text.

Are we stuck with only the single prompt text line?
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 9th Jun 2015 22:18
Yes you can display multiple text lines with or without panels. Snippet below shows how to do one panel with text at top of screen.

The 'Panel' command creates a, err, panel - Panel (x1,y1,x2,y2) - where x1,y1 is top left of panel and x2,y2 is bottom right of panel in screen percentages, so Panel(20,5,80,10) is a panel that has its top left at 20% in from right of screen and is 5% from top, with its bottom right coord at 80% in from right and 10% vertically down from top. The TextCenterOnXColor (x,y,textsize,text string,R,G,B) places the text on the screen centered on x,y (screen percentages again), with text size being 1 to 5 (I think), text string being what you want to display including variables, and R,G,B set the color of the text using RGB values from 0 to 255. Or you can use TextColor(x,y,size,txt,r,g,b) on the same basis, but text starts at the x,y coord rather than centred on it. You can do multiple panels & text. Note you have to call the code all the time to keep the text and panels displayed (not a show/hide situation). Hope this helps. Video just showing multiple text boxes in use. Cheers.



Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 10th Jun 2015 20:42
Thanks so much! I'll poke away at this when I get home from work. I'm looking to create my own HUDs and Status bars. This is preciously what I'm looking for.
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 12th Jun 2015 05:19 Edited at: 12th Jun 2015 06:05
Did you put that code into an entity and place it on the map? Or did you include that somehow into the global script?

I have a set of variables I'd love to be able to put into different locations on the screen, very similar to what you have. Wish I didn't work so late each day or else id be able to have a lot more time to poke around with LUA more to understand it better.
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Jun 2015 18:29
it would need to change so the code needs it's own entity with a script
(global is just for the function setups, not actually running/displaying them)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 12th Jun 2015 21:33
Ah okay. I haven't been able to actually get text boxes working yet in general. So much I got to learn about LUA still.
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT

Login to post a reply

Server time is: 2024-05-03 06:40:09
Your offset time is: 2024-05-03 06:40:09