DialogueBox.zh
Overview
Creator:
Moosh
Updated: 18 Apr 2023
Tags:
Library
Downloads: 82
|
View Script
Download Script (6.82 KB) |
Information
A few functions for handling dialogue boxes. Plus some string reading functions I use with them.
Special thanks to Saffith for his Tango.zh font definitions which I reused here.
Special thanks to Saffith for his Tango.zh font definitions which I reused here.
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:
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.
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.
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_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
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
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