DSB/Basic DSB Terminology
From DmWiki
Jump to navigationJump to searchThe terms "object," "item" and so on can be somewhat ambiguous. Dungeon objects in DSB should be thought of in two broad categories.
- Archetype (arch) - a general category, such as "Axe" or "Iron Keyhole."
- Instance (inst) - one specific thing that is found in the dungeon, assigned an id (an integer from 1 to 32767).
So, "Screamer Slice" is an archetype, a particular screamer slice that Daroou just popped in his mouth is an inst.
- Exvar - For reasons of speed and space, many instances don't have a full representation in Lua. Instead, exvars (external variables) can be used to store essential information about an instance that its archetype doesn't have. For example, the power of a ful bomb, or the target of a pushbutton, or whatever else you can imagine. The Base Code includes quite a few Exvars.
Each inst can have exvars associated with it in the form of Lua table, such as:
exvar[id] = { msg = M_ACTIVATE, target = some_other_id, opby_party = true }
- Message - An instruction sent from one inst to another, using the dsb_msg] command. Messages documentation.
- Ppos - A party position, usually represented "ppos" in the code, is a number from 0 to 3 that refers to the slot occupied by a given character. This is different than the character id of the character him/herself.
There are two main times the game engine will call custom Lua code the dungeon designer has created:
- System Function - A system function is a Lua function that begins with the prefix sys_, and is called by the game engine in order to do some task or perform some calculation. They can be modified to change the game behavior in subtle or dramatic ways.
- Event - An event is similar to a system function, in that it is called by the engine, only it is usually prefixed with "on_*" (or sometimes "off_*") and is associated with a given arch.
Events and System Functions documentation.
One special type of function called by the game engine is called a subrenderers.
- Subrenderer - A subrenderer is a special Lua function that renders the large area in the lower-right corner of the inventory screen. In the default code provided in base/, subrenderers are used to create the chest and scroll, and concievably about anything else could be built.