Scripts / How to actually place text on the screen?

Author
Message
oirwujgoijgokl
4
Years of Service
User Offline
Joined: 30th Nov 2019
Location:
Posted: 30th Nov 2019 19:10
I have tried the most basic scripts, bound them to an always active object, and still no success. Is there something basic that I am missing to show text on the screen?
Example:

function displayText(e)
TextCenterOnXColor(50,50,3,"Text",0,0,0)
end
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Nov 2019 19:50
yes you need to have the 3 functions GG uses (you can still use your own outside but they need to be called from 1 of the 3 standard GG functions)
i.e.
function displaytext_init(e)
function displaytext_main(e)
function displaytext_exit(e)

so in your case
function displaytext_main(e)
TextCenterOnXColor(50,50,3,"Text",0,0,0)
end
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 30th Nov 2019 20:05
You don't actually need the _exit function, it is only for characters.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 30th Nov 2019 22:18
After following the above, remove the color.
0,0,0 will be black and therefore possibly invisible or no color.
try just; TextCenterOnX(50,50,3,"Text")
But if you want black, okay. Color -- just put in higher rbg values.

So in summary, add what smallg posted to your first part, minus the exit part.
Everything lower case in the init and main line.

function displaytext_init(e)
end

function displaytext_main(e)
TextCenterOnX(50,50,3,"Text")
end
PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 5th Dec 2019 16:31
Also keep in mind that the text commands will only stay on the screen for as long as you are calling the command.
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960

Login to post a reply

Server time is: 2024-04-19 13:44:04
Your offset time is: 2024-04-19 13:44:04