Text display pre-processor?

  • #1, by daniel-lowesTuesday, 25. February, 08:04 6 months ago
    Hi guys! I have  question that I hope someone can help me with.

    I am trying to make it possible for my players to choose whether they want text to auto-advance or not. From reading the docs, it appears the only mechanism that currently exists is the <p> tag in the text itself. However, adding that will make it pause for everyone, of course.

    So I was wondering if there isn't a Lua function that currently runs just before text is rendered, to allow you to modify it. That way, I could check the value of the option and append a <p> at the end if it is enabled.

    Does something like this exist in the engine?

    Newbie

    5 Posts


  • #2, by afrlmeTuesday, 25. February, 11:48 6 months ago
    I'm sure I wrote something a little while back for someone else that did something like this, but it was to do with waiting until the audio finished playing for auto-skip or if a particular option was enabled then it would require the player to click to skip/progress the displayed texts.

    Do you plan on adding audio (voice over) files to your texts?

    Anyway, this was the small function I wrote for the other person.

    -- * on text display function * --
    function sText(text)

    if Conditions["manual_text"].Value and text.Owner:getId().tableId == eCharacters then
    text.TimeToWait = -1
    text.WaitForAudio = false
    end

    end

    registerEventHandler("textStarted", "sText") -- event handler for begin text
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11


    It needs to be added to the script section of the editor as a definition type script. You also need to create a condition somewhere & call it manual_text, which you should set as true whenever you want the player to manually skip/progress the displayed texts.

    The function above is an event listener. It listens out for when texts are displayed & when a text is displayed it checks if the text belongs to a character & whether or not the condition manual_text is set to true. If it's true then it will set the TimeToWait data strucute entry for the current text to -1 which means that the engine requires the player to skip the text manually.

    Imperator

    6816 Posts

  • #3, by daniel-lowesTuesday, 25. February, 12:16 6 months ago
    Ah I see, I did not know about that event. That should work very well smile

    And yes, there will be audio.

    Thank you!

    Newbie

    5 Posts

  • #4, by afrlmeTuesday, 25. February, 12:20 6 months ago
    No problem, have fun. smile

    Imperator

    6816 Posts

Write post