Script Editor
Edit any level's script as QuestScript - convert the disc's, edit with live errors, compare with the original, test in the level, convert every level at once - with the game's natives, the script's functions and templates at hand.
The Script Editor (Scripts, Text & Audio section) edits the level scripts (quests, dialogs, triggers, waves, doors) as QuestScript, the port's readable script language.
The left column lists every level script on the disc and the open mod's custom maps. Blue entries have a script in
the mod. Double-clicking a level in the Content Browser, or a .qs file of the mod, opens it here too.
Opening and editing a level's script
- Pick a level. Its disc
script.scris converted, and the conversion is checked to run as the original. - Edit makes the script editable (it is read-only until then, so you can browse other scripts freely).
- Save writes
BG/DATA/<LEVEL>.GOB/<lump>.lmp/script.qsinto the mod. The cook compiles that file in place of the disc's script the next time the level is opened.
Undo changes goes back to the saved file (or the text as opened). Done editing makes it read-only again.
The script compiles as you type. Errors and warnings appear under the text with their line and column: an unknown function, a wrong argument count, a number where a function takes a name. The editor also warns when a public the original had is gone while the level's objects still name it. Click an error to jump to it.
The text editor
The devkit's script boxes share one editor:
| Keys | Does |
|---|---|
| Ctrl+F | Find (Enter / F3 next, Shift+F3 previous; match case, whole words; every match highlighted) |
| Ctrl+H | Replace, and replace all |
| Ctrl+G | Go to line |
It has line numbers and colouring (keywords, strings, numbers, comments). The cursor's line and column show above the text, and a line with an error is tinted (hover its number for the message).
Compare with original
Compare with original runs every public of the edited script and of the disc's in the same simulated game, many times, and lists the publics that now behave differently. Use it after a change to check that only what you meant to change has changed. See how a conversion is checked.
Test in level
Test in level plays the level with the script as it stands, saved or not. It writes a throwaway custom map on the level, with its objects and this script, and removes the map when you Return to Editor. Stop ends it from the devkit. See Testing.
Reconvert and remove
- Reconvert original converts the disc's script again (to start over).
- Remove from mod... moves the mod's file to its trash, and the level runs the disc's script again.
Custom maps
maps/<id>.qs is a custom map's own script, run in place of its base level's. A map without one starts from a
start() template. The Level Editor's Details > Map opens it here with Edit as text.
The Details panel
| Tab | Has |
|---|---|
| Natives | The game's 191 functions by group, with their parameters and what they do, searchable. A click appends a call to the script. |
| Functions | The script's publics and functions, with the objects that run each public (deathscript, dialogscript, t, key, action...) |
| Templates | A level start, a trigger area (with its leaving half), a monster's death, an NPC dialog with its "!" check, a door or chest key, a helper function, a global |
| All levels | Convert all levels writes every level's script into the mod at once |
Convert all levels keeps the scripts the mod already has unless Replace the mod's own scripts is ticked.
Afterwards the scripts can be edited with any text editor and checked with rta-qsc (see
Command line tools).
Example Make the orcs of a level count down on screen.
- Open the level, press Edit, and find its orcs'
deathscriptin the Functions tab.- Add a global
var orcsLeft = 12;and, in that public,orcsLeft--;and ashowBust(...)call (from the Natives tab, under Dialog & HUD).- Compare with original: only that public should be listed.
- Test in level, then Save.
Blueprints
Scripts can also be written as node graphs in the Blueprint Editor: a blueprint can write a whole level script, or an include file the level's script includes. Open script there opens the result here.
Validate compiles every script of the mod.
