-- List of stuff to say over and over again
local closetSpeech = {
"Help I'm locked in the closet",
"Please let me out",
"You can't do this to me",
"Why won't anyone help me?",
"When I get out of hear you'll be sorry"
}
-- always loop and say this stuff.
while (true) do
for i = 1, #closetSpeech, 1 do
-- Trying to display object text using lua
--Scenes["Office"].SceneObjects["Closet"].ActiveText.TextCurrentText = closetSpeech[i]
--pause for x milliseconds or seconds
-- not sure how to pause with lua
end
end
--[[
-- want a function that will disable/hide or enable/show object text
-- depending on if it is shown/hidden already.
function ChangeClosetTextStatus()
if Scenes["Office"].SceneObjects["Closet"].ActiveText.TextActive == true then
Scenes["Office"].SceneObjects["Closet"].ActiveText.TextActive = false
else
Scenes["Office"].SceneObjects["Closet"].ActiveText.TextActive = true
end
end
]]
ChangeClosetText(Closet) -- closet is the Object Name
-- Definition script
registerHookFunction("setTextPosition", "ChangeClosetText")
registerEventHandler("textStarted", "ChangeClosetText")
function ChangeClosetText(text)
text:setValue(ClosetSpeechText, "Please Let Me Out")
end
print(Values["ClosetSpeechText"].String)
object (-1,-1)
the string stuff seems to be correct by you.Yes it's likely the print() function messing up that script as print should be in lowercase & you are also calling something that doesn't exist. Have you actually created a value somewhere in the editor called ClosetSpeechText?Maybe the script is failing because of your "print":It tries to print a lua value "ClosetSpeechText", which doesn't exist (or does it elsewhere?)try either to save your VS-value saving in a lua variable or just print the whole declaration:print(Values["ClosetSpeechText"].String)
also i am not sure if your Print needs to be lowercase...Another thing what seems a bit odd is that the console saysobject (-1,-1)
which is not a typical table id nor an object id... As far as i know the object table id is "6" and the specific objects in this table has to be >= 1 ... Maybe your object is defect (?)In VS5 you can rightclick your scene object and choose "copy id" which you can paste inside a text editor for example... should be something like (6,somenumber)
Scenes["example"].SceneValues["example"].String = "hello world"