Author Topic: Custom delay for dialogs  (Read 6310 times)

0 Members and 1 Guest are viewing this topic.

boaromayo

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • | boaromayo
Custom delay for dialogs
« on: March 06, 2019, 02:22:36 PM »
This feature took two and a half hours of programming and testing last night to get this right, but here it is!

I made some modifications to the dialog_box.lua script in the Solarus 1.6 sample quest. For this script add-on, the dialog can pause for any amount of time instead of using the default dialog box script, which only allows for a 1-second delay.

To get this working, use the '$' character, along with the '|' (pipe) character, then in between brackets, set the amount of time (in milliseconds) the dialog is paused, like so:

$|[sec]: the delay in milliseconds (Don't forget the '|' character!)

Sample dialog here:
Code: [Select]
dialog{
  id = "beavers.eater.1",
  text = [[
$|\[500\].$|\[1000\].$|\[1000\].$|\[1000\]I was hungry.
]]
,
}

Note: When editing the dialogs.dat file directly, you will have to type a backslash before putting in the brackets. When handling it in the editor, it's not needed.

Here is the script in action:



The modified dialog box.lua script is attached below (script is under the GNU GPL v3 license, script author by Christopho, special thanks to him!).
« Last Edit: March 06, 2019, 02:27:54 PM by boaromayo »

froggy77

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: Custom delay for dialogs
« Reply #1 on: March 06, 2019, 09:53:50 PM »
Thank you for sharing. This little effect for the dialog box is a good idea.