IF
- CONDITIONAL
RECEIVER
Used for management of conditional flags, asking players yes/no type questions (Gamer Related Model), displaying messages and pictures, hero variable selection, extended dialog boxes and CMD setup.
P$; W$; We have 1000 flags (from 1 to 1000).
Condition Management of the first ten flags Interpretation of value in IF:Q
Pictures Types and Subtypes: Type Subtype Resource Artifact *Note:
You can calculate the IF:Q subtype number (Format SQ) with the following formula:
!!IF:XXXX;
Management of conditional flags (1-1000), player questions (GRM), plus message
and picture display.
OPTIONS
B#/$1/$2;
Use this
command to set up or change a Single Image/Animation Extended Dialogue
Box to be displayed with the IF:P command.
# - number of dialogue (1..100)
$1 - index of string variable that stores the name of an
image (BMP, GIF or JPG) or AVI file
$2 - for AVI to repeat continuously (1) or not (0)
D#/$1...$15;
Use this
command to set up or change a Multipurpose Extended Dialogue Box to be
displayed with the IF:E command.
# - number of dialogue (1..100)
($=index of z
variable that holds text to use)
$1 - Title Text (White) at top of dialogue box.
$2 - Right Legend (Yellow) above input box.
$3 - Left Legend (Yellow) of 4 checkboxes..
$4 - Pic/AVI 1 (left) File in Heroes3/Maps folder.
$5 - Pic/AVI 2 - File in Heroes3/ Maps folder.
$6 - Pic/AVI 3 - File in Heroes3/ Maps folder.
$7 - Pic/AVI 4 (right) File in Heroes3/ Maps folder.
$8 - Legend of Picture 1 (mouse-over hint)
$9 - Legend of Picture 2 (mouse-over hint)
$10 - Legend of Picture 3 (mouse-over hint)
$11 - Legend of Picture 4 (mouse-over hint)
$12 - Choice 1 (checkbox) - button text.
$13 - Choice 2 (checkbox) - button text.
$14 - Choice 3 (checkbox) - button text.
$15 - Choice 4 (checkbox) - button text.
Comments:
If you use 0 or an empty parameter it means do not change. If you use a null string ^^ for a prompt it means no prompt.
A full path name (up to 256 character) may be included for the
picture files but remember that it starts in the MAPS directory
so use ".." to go up one directory if required. e.g., ^../data/mypic.bmp^.
Maximum picture size is 100*100 but may be less (if less, the picture will be centered
automatically). Setup information will not be saved when game is saved, so always do setup immediately before
using IF:E command.
E$1/$2;
Use this command
to display a Multipurpose Extended Dialogue box, previously set up
with the IF:D (and also possibly IF:F) commands.
$1 - an index of a v variable to store a selection
$2 - number of extended dialogue
Comments:
Variable will receive 1,2,3,4 if one of the buttons was selected and
-1 if none were selected (just exit).
The text answer always (even if there was no prompt)
will be stored in the z1 variable.
F$1/$2/$3/$4/$5/$6;
Use this command
to add hint text to checkboxes in a Multipurpose Extended Dialogue
Box. This command is an extension to the IF:D command.
#1=number of dialog (1..100)
$2=hint for checkbox 1 - index of z variable
$3=hint for checkbox 2 - index of z variable
$4=hint for checkbox 3 - index of z variable
$5=hint for checkbox 4 - index of z variable
$6=enable Cancel/ESC button (1) or not (0)
Comments:
Setup information will not be saved when game is saved so always do setup immediately before using
IF:E command.
G#1/#2/#3/#4/#5/(up
to #16);
Set up Radio or Checkbox Dialogue (Up to 12 choices)
#1= 1 - Radio buttons (one choice)
0 - Check boxes
(multiple choice)
#2= Number of v var that receive a result.
#3= Initial state of buttons
#4= Number of z var with a window header.
#5= Number of z var with a name of the first item
0-do not show
#6= Number of z var with a name of the second item
0-do not show
...
#16= Number of z var with a name of the twelve item
0-do not show
Comments:
1. State that received an stored is "one bit for one item".
Item1=1,
item2=2,
item3=4,
item4=8,
item5=16...
So to set all items val=4095
To set item 2,4,5,8 and 10 val=2+8+16+128
All reset val=0
Example:
L^text^
L$
Add a message to a screen log.
L^text^ - will add text
L$ - will add contents of z[$] variable.
Comments:
It looks as though you press Tab, type a message and press <Enter>.
The message pops up a previous message.
You have up to 20 message on the screen.
Every message stays on the screen for 20 seconds.
It may work at adventure screen and in a battle.
When you go to a battle or from a battle, the message should left on the screen.
M1/$;
Show the message (Text) or contents of z$ variable on the screen immediately.
The message may contain any symbols except the caret (^) and the semicolon
(;).
Example
N...;
IF Receiver command for 8 picture message box.
A message with text and up to 8 pictures of any internal types.
Fisrt, you must set pictures to show by N#1/#2/#3/#4/#5/#6/#7/#8/
#9/#10/#11/#12/#13/#14/#15/#16;
And after that show the dialog with prepared pictures and ^text^ by N^text^; command.
If you set more than 3 parameters, the interpreter treats it as pictures types/numbers the same way as for the IF:Q dialog.
You may set up to 8 pictures (16 parameters) and minimum 2 pictures.
No dialog is shown, just preparation phase.
So:
!!IF:N3/8/10/2/11/3/13/2/17/
1000/21/99/22/4;
means that the first picture (3/8) is a resource - sulfur with quantity 8. The next one is (10/2) a flag of Tan player, then Luck and so on. You can see that here we have 7 pictures.
If you have less than 4 parameters, the interpreter treats it as a command to show the dialog that was prepared with the previous syntax.
The only parameter here is the text to display:
!!IF:N^text^; - direct text
or
!!IF:N1/$;- z var (standard, local or extended)
In any case, the text is parsed for any format commands and as a result you will not see something like this "Hi %Z10!" but "Hi Slava!".
There is one limitation to the text: it can not have too many lines. This example is close to the maximum:
!!IF:N^This
is
a
looo...
..
..
..
..
..
oong
Text^;
If you have more lines, the game crashes.
Use this command to display a Single
Image/Animation Extended Dialogue Box, previously set up with the IF:B command.
# - number of dialogue to display.
Ask the player a question (TEXT) IMMEDIATELY
1. Simple question
Ask the player a question (TEXT)
The answer (Ok=1,
Cancel=0) is put into conditional flag # (from 1 to 10). The message
(TEXT) may contain any symbols except ^.
Example:
Q#1/#2/#3/#4^Text^
#1 - number of flag
#2 - type of the picture (see list below)
#3 - subtype of the picture
#4 - type of message
=1 - message (FLAG #1 WILL NOT BE SET!!!)
=2 - request yes/no (stored to the flag)
=4 - message with no buttons, visible until button is released
Example:
Q#1/#2/#3/#4/#5/#6^Text^
#1 - number of flag
#2 - type of the picture 1
#3 - subtype of the picture 1
#4 - type of the picture 2
#5 - subtype of the picture 2
#6 - type of message
=1 - message (FLAG #1 WILL NOT BE SET!!!)
=2 - request yes/no (stored to the flag)
=4 - message with no buttons, visible until button is released
=7 - choose one of pictures (left=1, right=0)
=10 - choose one of pictures, save result in v#1 (left=1, right=2, escape=0)
Example:
Q#1/#2/#3/#4/#5/#6/#7/#8^Text^
#1 - number of flag
#2 - type of the picture 1
#3 - subtype of the picture 1
#4 - type of the picture 2
#5 - subtype of the picture 2
#6 - type of the picture 3
#7 - subtype of the picture 3
#8 - type of message
=1 - message (FLAG #1 WILL NOT BE SET!!!)
=2 - request yes/no (stored to the flag)
=4 - message with no buttons, visible until button is released
=10 - choose one of pictures, save result in v#1 (left=1, right=2, escape=0)
Note: You must include the ^Text^ parameter or it will not work. If you
don't want any text, use ^^.
Set conditional flag #1 (from 1 to
1000) at once in the meaning #2 (1
or 0).
Set number of hero-recipient of w-variables.
Every hero has 200 w-variables
Comments:
They are called w# (#=1...200)
They may be used everywhere when f...t variables.
You should set the hero you refer to by these vars:
($=1...155,-1=current)
Every time you apply W$ command, you will refer then to a particular hero's variables.
!!IF:W-1 refers to the current hero.
(see also Flags&Variables
section and VR section)
X$;
Answer the gamer
Sphinx question
$ - number of question (-1 = random)
Comments:
This brings up the Sphinx question dialog box.
All Questions and answers are taken from ZSphinx.txt
file. If you have not the TxtEditor, you can
use a CmdEditor to add something there.
First column - question,
second column - answer.
For now the exact coincidence of gamer answer with written one
means correct. ERM Flag1 will be set to 1 if answer is correct
and 0 if answer is wrong.
The game interprets negative value for all resources as a -value/day.
But. If you subtract another -100000, it will be interpreted as +value+100000.
So:
!#IF:Q1/6/200/1^Message^; -> Gold: 200
!#IF:Q1/6/-200/1^Message^; -> Gold: 200/day
!#IF:Q1/6/-100200/1^Message^; -> Gold: -200
The same for money:
!#IF:Q1/36/-100/1^Message^; -> 100/day
!#IF:Q1/36/-100100/1^Message^; -> -100
For monsters you can set their numbers:
subtype=Nums*65536+subtype.
!#IF:Q1/21/327686/1^Message^; -> 5 Swordsmen 65536*5+6
!#IF:Q1/21/65542/1^Message^; -> 1 Swordsman 65536*1+6
!#IF:Q1/21/6/1^Message^; -> Swordsmen
And for secondary skills you can set skill and level:
subtype = (Skill Number * 3) + Skill Level + 2.
!#IF:Q1/20/45/1^Message^; -> Basic Fire Magic 14*3+1+2
!#IF:Q1/20/41/1^Message^; -> Expert Necromancy 12*3+3+2
Type
and subtype of Pictures using the Q command
Type (0...7)
Quantity
8
Number of
artifact
Spell
9
Number of spell
Flag
10
Number of flag
Luck (positive)
11
+ of luck
Luck (neutral)
12
no matter
Luck
(negative) Not supported in heroes.
13
- of luck
Morale
(positive)
14
+ of Morale
Morale
(neutral)
15
no matter
Morale
(negative)
16
- of Morale
Experience
17
Quantity
Secondary Skill
20
Skill + level *
Monster
21
Type of monster
Buildings in Towns
22....30
=0..8 by town type
(Format T)Type of building
(Format U)
Primary skill
31...34 (0..3)
Quantity
Spell Points
35
Quantity
Money
36
Quantity
Subtype = (Skill Number (from Format SS) * 3) + Skill Level + 2.
For example, let's say you want to display the picture for Basic Fire Magic.
Fire Magic is skill number 14 (Format SS), and Basic is skill level 1, therefore:
14*3=42 +1=43 +2=45 (Format SQ). So you would use IF:Q with a type of 20 and
subtype of 45.
This formula should be used to calculate the Format SQ number (for IF:Q display)
in your script when you DON'T know the specific skill number and level ahead of
time, for example if you're displaying a randomly chosen skill.