Solarus Forum

Community => Your scripts => Topic started by: boaromayo on March 06, 2019, 02:22:36 pm

Title: Custom delay for dialogs
Post by: boaromayo 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:

(https://i.imgur.com/a2IXYP2.gif)

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!).
Title: Re: Custom delay for dialogs
Post by: froggy77 on March 06, 2019, 09:53:50 pm
Thank you for sharing. This little effect for the dialog box is a good idea.