Solarus-Games English Forum

Solarus => Development => Topic started by: Yruama on June 14, 2015, 06:45:57 PM

Title: [Solarus 1.4] NPC Dialog
Post by: Yruama on June 14, 2015, 06:45:57 PM
Hi.

I don't find the doc for dialog.
How can i answer a question with the new editor ?

Thanks
Title: Re: [Solarus 1.4] NPC Dialog
Post by: the bread on June 15, 2015, 05:07:35 PM
Just as before I think: Just add a
$?
and the whole line after it becomes a possible answer.
Title: Re: [Solarus 1.4] NPC Dialog
Post by: Christopho on June 15, 2015, 05:34:51 PM
Nothing changes in dialogs features with the new editor.
The question/answer system is not documented in the Lua API because it simply does not exist :) It is up to quests to implement it. In the tutorials, I use indeed the $? syntax to turn a line into a question with an arrow cursor at this position.
Title: Re: [Solarus 1.4] NPC Dialog
Post by: Yruama on June 15, 2015, 07:03:34 PM
I DL the source code of ZSDX and i look what you do.

Found_fairy.1 :

Que vas-tu en faire ?
Récupérer des Coeurs
La conserver


There is no

$?

What this means ? : http://puu.sh/ipSDk/6adbf6da90.png
Title: Re: [Solarus 1.4] NPC Dialog
Post by: Christopho on June 16, 2015, 10:15:24 AM
ZSDX is older, it does not use the $? syntax, but adds a field "question = true" to add a question. And the answers are implicitly the last two lines of the final group of 3 lines of the dialog.
The $? of the tutorial quest is more powerful. Any line can be an answer or not, and the cursor position on the line can be customized.
Title: Re: [Solarus 1.4] NPC Dialog
Post by: Yruama on July 08, 2015, 03:37:55 PM
There are a function to add a sprite at the left of the dialob box ?
Or i have to create a new sprite ?
Title: Re: [Solarus 1.4] NPC Dialog
Post by: Christopho on July 08, 2015, 03:51:34 PM
You can customize the drawing yourself by defining the on:draw() event of your dialog box.

This is the case in ZSDX. If you are using the dialog box from ZSDX, then dialogs have an optional property "icon", which is a number referring to a 16x16 icon in the image "sprites/hud/dialog_icons.png". When this property is set, the corresponding icon is displayed on the left of the dialog box.

If you are using the dialog box from the tutorial, or another one, there is nothing to draw additional images or sprite, so you have to do some work yourself in the on:draw() event.
Title: Re: [Solarus 1.4] NPC Dialog
Post by: Yruama on July 08, 2015, 04:21:58 PM
Thank's a lot :)
Title: Re: [Solarus 1.4] NPC Dialog
Post by: Christopho on July 08, 2015, 04:24:31 PM
I just edited my message because I was not completely accurate. The dialog box of the tutorial does implement an on:draw() event (this is actually mandatory if you want to see anything :P)), but has no support for displaying additional sprites.