Please note that, at the moment, the script import/export facility is highly experimental and largely untested.
The file format is based on the in-built capabilities of the development tools, since speed of development was the overwhelming priority, hence it is simple and fairly inflexible.
Each command has to be on its own line. It cannot stretch over multiple lines, and there cannot be more than one command per line. Anything that is not recognised is skipped, so comments can be added as long as they don't begin with a command (I'd suggest starting with one of the common comment indicators: // ' ; or # ). Anything after the end of a command is also ignored, so in-line comments should also be okay.
The command elements should be separated by spaces. Leading spaces and multiple spaces are ignored. Using double-quotes around the whole item will enable a space to be embedded within a name (eg. "Flag 11"). I do not recommend that you use double-quotes or commas in any names.
Where appropriate, items are specified by name. The names are case-sensitive, and must match the name you have given the item in KQ2ED precisely. If you have duplicate names (eg. two tiles named "grass"), then the first will be matched (and it's a bad idea anyway, so don't do it).
Keywords are also case-sensitive and should all be in lower-case.
Use the export scripts facility in KQ2Tool to see some examples.
The following conventions are used in this document: bold items are literal keywords, italic items are names (eg. TownMap), and plain items are numeric values.
script objectscript globalscript deathscript startscript |
script-name |
conditions: |
condition . . . |
commands: |
command . . . |
end | script |
Note: script is a synonym for objectscript.
Conditions | |
---|---|
Condition | Description |
always | Always fire |
flag | Flag value |
location | Location |
attribute | Attribute |
item | Item |
charset | Character graphic |
palette | Palette |
incombat | Combat status |
time | Time |
color | Color support |
registered | Registered |
tileexists | Tile Exists |
spell | Spell |
equipped | Equipped |
Commands | |
---|---|
Command | Description |
nothing | Do nothing |
changeflag | Change flag value |
warp | Warp |
changeattribute | Change attribute |
givetake | Give/take item |
changecharset | Change character graphic |
showgraphic | Display graphic |
showtext | Display text |
[ex-command] | Obsolete - do not use |
play | Play song |
wait | Wait |
learn | Learn spell |
moveobj | Place/remove object |
changetiles | Change map tiles |
run | Run script |
gameover | End game |
changepalette | Change palette |
changeobjpic | Change object graphic |
shop | Display shop |
combat | Start/end combat |
redrawmap | Redraw map |
changescreen | Change custom screen |
clear | Clear screen |
stopscripts | Stop execution of scripts |
advshowgraphic | Advanced display graphic |
advchangetiles | Advanced tile change |
advmoveobj | Advanced place/remove object |
redoglobals | Redo global scripts |
returntomap | Return to map screen |
showlist | Dislpay list |
unlearn | Remove spell |
customtap | Get custom screen tap |
walk | Walk player |
equip | Equip/unequip |
deletelayer | Delete tile layer |
Comparisons | >= <= == <> > < |
---|
Target Types | |
---|---|
val | value |
att | attribute |
rand | rand-max |
flag | flag-name |
Attributes |
---|
str agl int hp sp level maxhp maxsp money exp map x y dir obj.map obj.x obj.y monster.str monster.agl monster.int monster.hp monster.sp monster.level monster.maxhp monster.maxsp monster.money monster.exp |
Operations |
---|
inc dec set mult div mod |
always |
flag | flag-value | >= <= == <> > < |
|
location | not at |
|
|
|
attribute | attribute | >= <= == <> > < |
|
item | has missing |
item-name |
charset | is not |
charset-name |
palette | is not |
palette-name |
incombat | true false |
time | minute hour day month year |
>= <= == <> > < |
|
color | true false |
registered | true false |
tileexists |
|
|
bottom middle top |
exists missing |
spell | known unknown |
spell-name |
equipped | item-name | equipped unequipped |
nothing |
changeflag | inc dec set mult div mod |
flag-name |
|
warp |
|
|
|
changeattribute | attribute | inc dec set mult div mod |
|
givetake | give take |
item-name |
changecharset | charset-name |
showgraphic | graphic-name | -1 | |
x-val | y-val |
showtext | text-name | color-number | -1 | nowait wait | |||
topleft-x | topleft-y | bottomright-x | bottomright-y |
[ex-command] |
play | song-name |
wait | -1 milliseconds |
learn | spell-name |
moveobj | place remove |
object-name | map-name | x-coord | y-coord |
changetiles | from-tile-name | to-tile-name | -1 | ||
on-map-name | -1 | ||||
x-coord | y-coord |
run | script-name | process ignore |
|
gameover |
changepalette | palette-name |
changeobjpic | object-name | graphic-name | -1 | ||
on-map-name | -1 | ||||
x-coord | y-coord |
shop | shop-name |
combat | start | monster-name |
stop |
redrawmap |
changescreen | background inventory combat |
graphic-name |
clear | color-number |
stopscripts |
advshowgraphic | graphic-name |
|
|
advchangetiles | tile-name |
|
|
|
advmoveobj | place remove |
object-name |
|
|
|
redoglobals |
returntomap |
showlist | list-name | color-number | -1 | |||
topleft-x | topleft-y | bottomright-x | bottomright-y |
unlearn | spell-name |
customtap | x-flag-name | y-flag-name |
walk | up down left right |
equip | add remove |
item-name |
deletelayer |
|
|
|
bottom middle top |