DIALOGUE CUSTOM  (DL)
RECEIVER

Supports custom dialogue creating.
See DL Trigger

!!DL#:XXXX; Trace into dialogue number #, #>0.

OPTIONS

A#1/#2/$ Change dialogue item characteristic.
 #1 - item ID

#2type$
3Text(string): new text of the item
4Def (number): new cadre in Def
11Pcx (string): new picture
Notes:
May be called in !?DL trigger and so may be used to customize the dialog on a fly.
C# Set a specific callback action OR change current mouse pointer.
  # - type of action
    1 - close dialog with current item return code
    1000+# - set current pointer as # (see format PM2)
Comments:
  For this command you need not to set a dialog Id in DL trigger part. It affect the active dialog and any item.
Example:
  !!DL:C1; - close dialog
  !!DL:C1000; - change mouse pointer to arrow (standard pointer)
  !!DL:C1042; - change mouse pointer to 'Scuttle Boat'
E#1/#2 Enable dialogue item
  #1 - dialogue item ID
  #2 - enable (1) or disable (0) item
H#1/#2 Set hint text for dialogue item
  #1 - dialogue item ID
  #2 - hint text for item (appears when you move a mouse over the item)
Comments:
  #2 may be global or static Z variable.
  The text is parsed before showing (not setting).
N# Parse dialogue template
  # - template file name (may be direct text, global, local or static Z variable)
Comments:
  The text is parsed before using.
  This command load template file (if not loaded already), searches the dialog (using dialog Id) in the file and parses it.
  It does not show the dialog.
  The main aim of it is to give you a chance to adjust loaded dialog settings before showing it.
Results:
  Flag 1 = 1 if Ok
  Flag 1 = 0 if Error happens (no dialog template found)
See template format below.
P$ Pass decision control to function $
Function parameters:
  x1 - action
     0 - mouse move to another square
     12 - left mouse button push
     13 - left mouse button release
     14 - right mouse button push
  x2 - x coordinate of clicked map square
  x3 - y coordinate of clicked map square
  x4 - level of clicked map square
Example:
!?OB8/11/0;
!!DL:P12345;
!!IF:M^Now spell has ended^;

!?FU12345;
!!if&x1=0:; mouse move
!!OBx2/x3/x4:T?y1; get object type at a square
!!if&y1=34:; hero ?
!!DL:C1042; sunk boat cursor
!!el:;
!!DL:C1000; arrow cursor
!!en:;
!!FU:E;
!!en:;
!!if&x1=13:; left mouse release
!!OBx2/x3/x4:T?y1 C?y2;
!!if&y1=34:; hero
!!HEy2:K; kill hero
!!DL:C1000; arrow cursor
!!en:;
!!FU:E;
!!en:;
!!if&x1=14:; right mouse push
!!DL:C1;
!!en:;
S$ Show dialog
  $ - return item (the active item when closed)
Comments:
  Shows the dialog (with a specific Id) and wait until it is closed. This means that the followed command will be executed not immediately but when the dialog is closed by any means.
  You may use no parameter at all, it means that return code is ignored.
  You may show one dialog "from another" and the sequence may be unlimited but you may have only ONE dialog of the same type on the screen at the same moment. This means that you cannot call a dialog X from dialog X.

Template layout.

This is a standard Heroes 3 text table file.
First two lines are ignored (may be filled with text or left empty)
The most left column is also ignored (may be filled with text or left empty).
The dialog starts with the next line items (in column order):

0 ignored
1: '#' sign - means new dialog template starts
2: xxx number - unique dialog Id
3: x pos number - X position of left top corner (-1=auto center)
4: y pos number - Y position of left top corner (-1=auto center)
5: dx number - hor. size of dialog
6: dy number - ver. size of dialog
7: xxx number - number of dialog items (you may have less but not more)
8: xxx number - player to adjust border color (-1 means current player)
9: text - background PCX file name
10: XXX number - Id of text item that is used as hint field

Following lines are parsed as dialog items until the next '#' sign in the 1st column is found. This may be just an empty line with '#' sign or a line with a new dialog start.
The most important thing is the first character in the first column. The next character is supported for now:
';' commented line - skipped
'P' - PCX picture item columns:
'D' - DEF cadre picture item columns:
'A' - Animated DEF item columns:
'B' - Button item (specific DEF)
'T' - Text item columns:
'S' - Text with vertical scroll bar item columns:
'E' - Edited text item columns:
'V' - SMK or BIK video item columns:


Notes:
You may have more than one dialog in one template file.
You may not use dialogs with identical Id in different template files, every dialog should have its own unique Id. This in particular means that we should reserve an Id range for WoG dialogs.
Item with number 30721 is a default cancel item. So if a user press ESC button when a dialog is shown, it is closed.