New version - script not working

  • #1, by AndresSaturday, 13. July 2019, 00:47 5 years ago
    Hello, 
    I hope you´re doing well.

    I wasn´t had the time to test previous versions but I installed the last version and some script stopped working.

    for example I copied some script that changed the lighting of the room and it´s not working, or script that simulate a keyboard are not responding... 

    I had no time to debug... but when I started I´m seeing this error:
    Sysbsistem doesn´t support runtime shadders...

    Thanks for your help.
    Andrés

    Newbie

    31 Posts


  • #2, by afrlmeSaturday, 13. July 2019, 13:39 5 years ago

    I assume you are using the shader toolkit? If so, then you probably need to update it to the latest version.

    Imperator

    7278 Posts

  • #3, by AndresSunday, 21. July 2019, 01:24 5 years ago
    Thanks! 
    That worked! grin

    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
     
    -----------------

    Newbie

    31 Posts

  • #4, by afrlmeSunday, 21. July 2019, 12:25 5 years ago
    I wrote that thing ages ago. We upgraded to Lua 5.3 earlier this year & some of the old Lua functions/operators were deprecated with that version. Replace any instances of table.maxn with an # instead, so fo example...

    if i < table.maxn(t) then 

    should be changed to this...

    if i < #t then 


    also this script is using the old longhand scripting method, though it's still valid, it's not so pretty. we have an improved shorthand scripting solution now & lots of new functions as well that makes writing scripts easier.

    Imperator

    7278 Posts

  • #5, by AndresWednesday, 07. August 2019, 21:09 5 years ago
    Thanks! it works... but there is still one thing I couldn´t fix.

    When it changes scene it got freeze in the next room.  I thinking perhaps it has something to do with fe and fd... I tried with string empty and with 1, but nothing happens...

    It works on the windows version, but it doesn´t work on HTML5.

    Do you have any idea?

    Thanks!!! smile


    function changeScene(s, t, d, fe, fd)
     fe = game:getInt(VGameFadeEffect); fd = game:getInt(VGameFadeDelay)
     -- + --
     if t 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 < #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

    Newbie

    31 Posts

  • #6, by afrlmeThursday, 08. August 2019, 14:01 5 years ago
    It's possible that something isn't supported. html5 has the least supported VS features I believe compared to all the other available platform targets.

    Imperator

    7278 Posts

  • #7, by AndresMonday, 27. January 2020, 21:07 4 years ago
    Hello!

    Sorry for the delays... I didn't have much time since my son was born.

    Is there a command to go to a different room from the script that works for HTML 5?

    Thanks, 
    Andrés

    Newbie

    31 Posts