Thanks!
That worked!
But other scripts that I used as refence are not working...
For example there was a sample of a keyboard and text appearing in the screen... and this are also not working...
Do you know if there was an update of this scripts?
Thanks!
key_imput
---------------
local result = "" -- create an empty string
local val
function add(c)
val = getObject("Game.GameCurrentScene.SceneValues[str_txt]")
result = val:getStr(VValueString) .. c
updateStr()
end
function remove()
val = getObject("Game.GameCurrentScene.SceneValues[str_txt]")
if string.len( val:getStr(VValueString) ) > 0 then result = string.sub( val:getStr(VValueString), 1, -2); updateStr() end
end
function updateStr()
val = getObject("Game.GameCurrentScene.SceneValues[str_txt]")
val:setValue(VValueString, result)
end
function clear()
stopAction("ActiveActions[display_text]")
getObject("Game.GameCurrentScene.SceneValues[str_txt]"):setValue(VValueString, "")
getObject("Game.GameCurrentScene.SceneValues[str_question]"):setValue(VValueString, "")
getObject("Conditions[key_input_active]"):setValue(VConditionValue, false)
end
-----------
typewriter_text
------------------
local i = 0
local time = 0
local result = ""
local txt = ""
local name = ""
local delay = 0
function typewriter(v, t, d)
val = v; txt = t; delay = d
registerEventHandler("mainLoop", "loopTypewriter")
end
function loopTypewriter()
if time == 0 or getTime() >= time + delay then
if i < string.len(txt) then
i = i + 1; result = result .. string.sub(txt, i, i)
getObject("Game.GameCurrentScene.SceneValues[" .. val .. "]"):setValue(VValueString, result)
time = getTime()
else
unregisterEventHandler("mainLoop", "loopTypewriter"); result = ""; i = 0
startAction("Game.GameCurrentScene.SceneActions[display_text]")
getObject("Conditions[key_input_active]"):setValue(VConditionValue, true)
--getObject("Game.GameCurrentScene.SceneValues[str_question]"):setValue(VValueString, "")
end
end
end
-------
quiz_table
-----------
local i = 0
local val
local true1= 0
local true2= 0
local true3= 0
local true4= 0
local false1= 0
local false2= 0
local false3= 0
local false4= 0
local flag = {}
flag[1] = {v= 0}
flag[2] = {v= 0}
flag[3] = {v= 0}
flag[4] = {v= 0}
local t = {}
t[1] = {q = "Este episodio hace una parodia a una famosa serie del Reino Unido. ¿Cual es esa serie?", a = "el prisionero"}
t[2] = {q = "¿Cual es el verdadero nombre de ese dispositivo con forma de globo blanco que caza al protagonista?", a = "rover"}
t[3] = {q = "¿De que año es dicha serie?", a = "1967"}
t[4] = {q = "En los simpsons un personaje es atrapado por la bola. ¿Que personaje es?", a="juan topo"}
t[5] = {q = "Comprobando respuestas. Presione Return para continuar"}
function updateQuiz()
i = i + 1
if i >5 then
startSound('vispath:Sounds/Typewriter.ogg', {flags=1, volume=0, balance=-10, loop = false})
else
startSound('vispath:Sounds/Typewriter.ogg', {flags=1, volume=70, balance=-10, loop = true})
end
if i 7 then t = 7 end
game:setValue(VGameFadeEffect, t); game:setValue(VGameFadeDelay, d)
-- + --
game:setValue( VGameCurrentScene, getObject("Scenes[" .. s .. "]") )
-- + --
game:setValue(VGameFadeEffect, fe); game:setValue(VGameFadeDelay, fd)
end
function checkAnswer()
val = getObject("Game.GameCurrentScene.SceneValues[str_txt]")
if i < table.maxn(t) then
if t.a == val:getStr(VValueString) then
getObject("Game.GameCurrentScene.SceneConditions[true_" .. i .. "]"):setValue(VConditionValue, true); clear(); flag.v = 1;
else
getObject("Game.GameCurrentScene.SceneConditions[false_" .. i .. "]"):setValue(VConditionValue, true); clear(); flag.v = 0;
end
else
if flag[1].v == 1 and flag[2].v == 1 and flag[3].v == 1 and flag[4].v == 1 then
val:setValue(VValueString, "")
clear()
changeScene("Sala de control 2", 3, 500,"","")
else
i= 0
getObject("Game.GameCurrentScene.SceneConditions[true_1]"):setValue(VConditionValue, false)
getObject("Game.GameCurrentScene.SceneConditions[false_1]"):setValue(VConditionValue, false)
getObject("Game.GameCurrentScene.SceneConditions[true_2]"):setValue(VConditionValue, false)
getObject("Game.GameCurrentScene.SceneConditions[false_2]"):setValue(VConditionValue, false)
getObject("Game.GameCurrentScene.SceneConditions[true_3]"):setValue(VConditionValue, false)
getObject("Game.GameCurrentScene.SceneConditions[false_3]"):setValue(VConditionValue, false)
getObject("Game.GameCurrentScene.SceneConditions[true_4]"):setValue(VConditionValue, false)
getObject("Game.GameCurrentScene.SceneConditions[false_4]"):setValue(VConditionValue, false)
clear()
typewriter("str_question", t.q, 100)
end
end
end
-----------------