Difference between revisions of "DSB/Basic DSB Terminology"

From DmWiki
Jump to navigationJump to search
(New page: The terms "object," "item" and so on can be somewhat ambiguous. Dungeon objects in DSB should be thought of in two broad categories. * <b>Archetype</b> (arch) - a general category, such a...)
 
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
The terms "object," "item" and so on can be somewhat ambiguous. Dungeon objects in DSB should be thought of in two broad categories.
 
The terms "object," "item" and so on can be somewhat ambiguous. Dungeon objects in DSB should be thought of in two broad categories.
  
* <b>Archetype</b> (arch) - a general category, such as "Axe" or "Iron Keyhole."
+
* <b>[[DSB/Archetypes|Archetype]]</b> (arch) - a general category, such as "Axe" or "Iron Keyhole."
 
* <b>Instance</b> (inst) - one specific thing that is found in the dungeon, assigned an id (an integer from 1 to 32767).
 
* <b>Instance</b> (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.
 
So, "Screamer Slice" is an archetype, a particular screamer slice that Daroou just popped in his mouth is an inst.
  
* <b>Exvar</b> - 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 [[DSB/Base Code|Base Code]] includes quite a few exvars, [[DSB/Exvars|Exvars]].
+
* <b>Exvar</b> - 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 [[DSB/Base Code|Base Code]] includes quite a few [[DSB/Exvars|Exvars]].
  
 
Each inst can have exvars associated with it in the form of Lua table, such as:
 
Each inst can have exvars associated with it in the form of Lua table, such as:
 
<pre>
 
<pre>
exvar~[[ DSBFuncs#dsb''msg|id] = { msg = M''ACTIVATE, target = some''other''id, opby''party = true }
+
exvar[id] = { msg = M_ACTIVATE, target = some_other_id, opby_party = true }
 
</pre>
 
</pre>
  
* <b>Message</b> - An instruction sent from one inst to another, using the [[dsb''msg ]]] command. Messages are documented [[ DSBMsgs|here ]].
+
* <b>Message</b> - An instruction sent from one inst to another, using the [[DSB/Exposed functions|dsb_msg]]] command. [[DSB/Messages|Messages]] documentation.
  
 
* <b>Ppos</b> - 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.
 
* <b>Ppos</b> - 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.
Line 19: Line 19:
 
* <b>System Function</b> - 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.
 
* <b>System Function</b> - 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.
  
''' <b>Event</b> - 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.
+
* <b>Event</b> - 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.
  
 
[[DSB/Events and System Functions|Events and System Functions]] documentation.
 
[[DSB/Events and System Functions|Events and System Functions]] documentation.

Latest revision as of 02:03, 29 November 2012

The 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.