Scripts / Can't Prompt() DESCRIPTION variables

Author
Message
SimpDuck
2
Years of Service
User Offline
Joined: 18th Apr 2022
Location:
Posted: 18th Apr 2022 20:50
My first day working with this engine, so forgive me I only know of what is in this forum and previous Lua experience.


I currently have a Description variable shown bellow.
-- DESCRIPTION: [withinText$ = "withinText"]


Now as a test I have the following distance check loop.

if playerdistance < 100 then
Prompt(withinText)
else
Prompt("Too Far")
end

The string works fine but the withinText variable crashes the program (also annoying save system doesn't account for this). All help appreciated.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Apr 2022 23:54
https://forum.game-guru.com/thread/223409
you prompt the variable that holds the text - if you are following the max method it will be stored in the properties function
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Necrym59
8
Years of Service
User Offline
Joined: 2nd Jul 2016
Location:
Posted: 19th Apr 2022 01:44 Edited at: 19th Apr 2022 01:46
Try doing
-- DESCRIPTION: [PROMPT_TEXT$="Do stuff"]

in properties section
object[e].prompt_text = prompt_text

then reference in main section

if playerdistance < 100 then
Prompt(myobject[e].prompt_text)
else
Prompt("Too Far")
end
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 19th Apr 2022 10:27 Edited at: 19th Apr 2022 10:29
and not forgetting:
local object = {} -- above _properties function

function <filename>_properties( e, withinText )
object[e] = { prompt_text = withinText )
end

etc

https://forum.game-guru.com/thread/223409#msg2647159
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-12-03 17:25:23
Your offset time is: 2024-12-03 17:25:23