Jump to content

DialogueBox.zh

Overview
Creator: Moosh Updated: 18 Apr 2023 Tags: Library Downloads: 82
Rating[?]: Rating: 4.6/5 (4 ratings)
View Script Download Script
(6.82 KB)
Information

Description Setup Reviews Comments

First of all, we'll need to set some constants. Other scripts that use this header will use these as defaults. Since these are all quest specific, you'll want multiple copies of this header for each quest that uses it.

GFX:
  • TIL_DB_DIALOGUE_BOX: This is the first of 8 tiles that form the dialogue box. See the included screenshot for how these should be laid out.
  • CS_DB_DIALOGUE_BOX: The CSet of the dialogue box.
  • C_DB_DIALOGUE_BOX_BG: The background color of the dialogue box.
  • TIL_DB_DIALOGUE_SELECTOR: The tile of the dialogue box's selection arrow. This should take up an 8x8 quarter tile in the top left corner instead of a full 16x16 tile.
  • CS_DB_DIALOGUE_SELECTOR: The CSet of the arrow.
SFX:
  • SFX_DB_MOVECURSOR: Sound when the cursor is moved in the dialogue box
  • SFX_DB_CONFIRM: Sound when a selection is confirmed
  • SFX_DB_OPEN: Sound of the box opening
  • SFX_DB_CLOSE: Sound of the box closing
If you're not a scripter, you're done here. Otherwise, here's the functions you use to put dialogue boxes in your scripts:

int DialogueBox_Run(int x, int y, int strings, int tileDB, int csDB, int colorDB, int font, int cFont, int tileArrow, int csArrow){
This function runs until you make a selection and then returns the index of the option you chose.
  • int x, int y: The position of the center point of the dialogue box
  • int strings[]: An array of strings containing all the options in the dialogue box.
  • int tileDB: The first tile of the dialogue box
  • int csDB: The CSet of the dialogue box
  • int colorDB: The background color of the dialogue box
  • int font: The font used for the dialogue box. This will affect the size.
  • int cFont: The font color
  • int tileArrow: The tile of the selection arrow
  • int csArrow: The CSet of the selection arrow
bool DialogueBox_RunSingleFrame(int handler, int x, int y, int strings, int tileDB, int csDB, int colorDB, int font, int cFont, int tileArrow, int csArrow){
This function runs every frame inside a while loop. This way you can do other things in your script while the dialogue box is still running. You can either put the function in the condition of the while loop or just check if handler[1]==0. When the while loop is finished, handler[0] will be the index of the selection in the strings[] array.
  • int handler[6]: An empty array that the function stores data in between frames.
  • int x, int y: The position of the center point of the dialogue box
  • int strings[]: An array of strings containing all the options in the dialogue box.
  • int tileDB: The first tile of the dialogue box
  • int csDB: The CSet of the dialogue box
  • int colorDB: The background color of the dialogue box
  • int font: The font used for the dialogue box. This will affect the size.
  • int cFont: The font color
  • int tileArrow: The tile of the selection arrow
  • int csArrow: The CSet of the selection arrow
Requires std.zh.