[CUSTOM] dialog system (working/tutorial pending)

  • #20, z ke4Tuesday, 27. September 2016, 10:00 hodinky 8 years ago
    Damn this looks quite complex grin

    Are you using the DialogPart table? Or is it possible to execute the classic "display text" action part via Lua and get by just with that?

    Zabiják klíčů

    810 Posts


  • #21, z sebastianTuesday, 27. September 2016, 10:39 hodinky 8 years ago
    The dialog system is completely independent from the buildin system.

    I created a dialogpart table myself
    which gets fed by the texts (and other information) for the current started dialog and let object texts output the parsed texts from a script.
    The script itself runs a "displayDialog" function after getting the dialog data. It starts the actions to display the texts which were saved in a value string before.

    Kind of complicated to write, but its very straight forward

    Kapitán

    2346 Posts

  • #22, z ke4Tuesday, 27. September 2016, 14:47 hodinky 8 years ago
    Well you inspired me that i might try to create something similar at some point too. ( some sliding in animation would be cool )

    Is it possible to display the text with Lua? I didn't find it in the data structure.
    Or you need to call a "called by other action" that display the text with the "< vs=value >" thing? The problem is that it needs to be given for a specific character in the editor, so i guess in that case there would need to be a "called by other action" for each character.

    ..thanks for the additional info.

    Zabiják klíčů

    810 Posts

  • #23, z sebastianTuesday, 27. September 2016, 15:18 hodinky 8 years ago
    yep, it starts an action which shows the text for interface object (button) 1-4 (i show only 4 choosable lines at the same time)

    I will post another diagramm which shows the logic of the dialog system and hiw the things work together. May it helps for better understanding whats going on.

    Kapitán

    2346 Posts

  • #24, z afrlmeTuesday, 27. September 2016, 15:18 hodinky 8 years ago
    vs=value thing, though in next build you should be able to correctly display text with the new Lua draw features. I think Simon told me it's a bit buggy at the minute or something - I forget exactly what he said.

    Imperátor

    7285 Posts

  • #25, z ke4Tuesday, 27. September 2016, 16:57 hodinky 8 years ago
    Okay thanks guys wink

    Zabiják klíčů

    810 Posts

  • #26, z sebastianTuesday, 27. September 2016, 21:00 hodinky 8 years ago
    I tried to paint some chart for you guys to make the logic of my dialog system more clear:
    https://cl.ly/432B2p060y2H/dialogsystem.png
    It shows how each part interacts with each other. its roughly sketched, so not every aspect is broken down to every aspect. But you get the idea i hope ^^

    Kapitán

    2346 Posts

  • #27, z ke4Wednesday, 28. September 2016, 11:54 hodinky 8 years ago
    I still can't get my head around that mate, looks interesting though.

    I wrote this simple code, how did you manage to run the text one at a time? In this case it plays only the last one.

    Zabiják klíčů

    810 Posts

  • #28, z afrlmeWednesday, 28. September 2016, 12:34 hodinky 8 years ago
    Because your iterating through it with a for loop & there's nothing to stop it progressing through the lines of code seeing as there's no simple way of adding a pause between the Lua lines.

    What you could do is utilize the textStarted & textStopped event handlers. Use the textStopped one for example to check current table index against table total entries, then update an integer value & then call a function which returns a dialog from the table based on the new value... At least that would be one way to auto-iterate through texts without having to resort to a mainLoop & because you are waiting on texts to stop, you are getting the desired break between each one. wink

    Imperátor

    7285 Posts

  • #29, z ke4Wednesday, 28. September 2016, 12:42 hodinky 8 years ago
    I completely forgot that there's something like textStarted & textStopped event handlers. I'll try to figure it out with this. Thanks.

    Zabiják klíčů

    810 Posts

  • #30, z ke4Wednesday, 28. September 2016, 13:27 hodinky 8 years ago
    Okay this works even though it gives me an error in the log file.

    Warning: Unsupported event 'textStopped'.
    Error: Failed to execute hook function 'onTextStopped': [string "customDialog"]:34: Failed to execute command unregisterEventHandler
    

    Zabiják klíčů

    810 Posts