Author Topic: [Solarus 1.4] NPC Dialog  (Read 5074 times)

0 Members and 1 Guest are viewing this topic.

Yruama
  • Newbie
  • *
  • Posts: 24
    • View Profile
[Solarus 1.4] NPC Dialog
« 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

the bread
  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: [Solarus 1.4] NPC Dialog
« Reply #1 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.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1194
    • View Profile
Re: [Solarus 1.4] NPC Dialog
« Reply #2 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.

Yruama
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: [Solarus 1.4] NPC Dialog
« Reply #3 on: June 15, 2015, 07:03:34 PM »
I DL the source code of ZSDX and i look what you do.

Found_fairy.1 :

Code: [Select]
Que vas-tu en faire ?
Récupérer des Coeurs
La conserver

There is no

Code: [Select]
$?
What this means ? : http://puu.sh/ipSDk/6adbf6da90.png

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1194
    • View Profile
Re: [Solarus 1.4] NPC Dialog
« Reply #4 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.

Yruama
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: [Solarus 1.4] NPC Dialog
« Reply #5 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 ?

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1194
    • View Profile
Re: [Solarus 1.4] NPC Dialog
« Reply #6 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.
« Last Edit: July 08, 2015, 04:23:23 PM by Christopho »

Yruama
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: [Solarus 1.4] NPC Dialog
« Reply #7 on: July 08, 2015, 04:21:58 PM »
Thank's a lot :)

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1194
    • View Profile
Re: [Solarus 1.4] NPC Dialog
« Reply #8 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.