<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dmwiki.atomas.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sophia</id>
	<title>DmWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://dmwiki.atomas.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sophia"/>
	<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/wiki/Special:Contributions/Sophia"/>
	<updated>2026-04-15T14:14:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Subrenderers&amp;diff=3331</id>
		<title>DSB/Subrenderers</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Subrenderers&amp;diff=3331"/>
		<updated>2024-01-06T18:37:06Z</updated>

		<summary type="html">&lt;p&gt;Sophia: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;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 &amp;lt;i&amp;gt;base/&amp;lt;/i&amp;gt;, subrenderers are used to create the chest and scroll, and concievably about anything else could be built.&lt;br /&gt;
&lt;br /&gt;
See the stats and inventory screen renderers in &amp;lt;i&amp;gt;base/render.lua&amp;lt;/i&amp;gt; for more information on subrenderers. (Another place to look is the implementation of chests and scrolls in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
A subrenderer is called any time it is clicked or interacted with; it is also updated several times per second, but the actual rate can vary.&lt;br /&gt;
&lt;br /&gt;
Any efforts to reconstruct the Amiga CSB magic map are quite welcome.&lt;br /&gt;
&lt;br /&gt;
==Callbacks==&lt;br /&gt;
&lt;br /&gt;
Some callback hooks that may be useful while working with subrenderers:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;inst_outgoing&amp;lt;/b&amp;gt;: something gets removed from a container&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;inst_incoming&amp;lt;/b&amp;gt;: something gets added to a container&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_unlook&amp;lt;/b&amp;gt;: called after an item is removed from the hover-on-eyeball examination&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;after_from_r_hand&amp;lt;/b&amp;gt;: called after an item is removed from the active hand, which will close those subrenderers&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Subrenderers]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=3262</id>
		<title>DSB/Exposed functions</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=3262"/>
		<updated>2018-12-20T19:41:46Z</updated>

		<summary type="html">&lt;p&gt;Sophia: Conditions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Functions are given in the form:&lt;br /&gt;
;&amp;lt;b&amp;gt;function&amp;lt;/b&amp;gt;(arguments, ~[optional arguments]) = return value&lt;br /&gt;
:If the terminology doesn&#039;t make sense, check [[DSB/Basic DSB Terminology]].&lt;br /&gt;
Functions without a dsb_ prefix are part of [[DSB/Base Code|base/]], not the core engine.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_insts&amp;lt;/b&amp;gt;()&lt;br /&gt;
:This is an iterator used in Lua&#039;s for loops. To iterate over all instances of objects in a DSB dungeon, use something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for i in dsb_insts()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_in_obj&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Another iterator; see above for usage. This one is used to iterate all over all instances that are inside the given instance.&lt;br /&gt;
&lt;br /&gt;
==Bitmaps and Drawing==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name) = bitmap&lt;br /&gt;
:Searches the dungeon&#039;s directory for the bitmap, and then &amp;lt;i&amp;gt;graphics.dsb&amp;lt;/i&amp;gt;, and finally the default &amp;lt;i&amp;gt;graphics.dat&amp;lt;/i&amp;gt;. Returns a truecolor bitmap, but the bitmap can be 256 colors on disk to save space. Don&#039;t specify a file extension as DSB will figure it out.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name, relative_path) = bitmap&lt;br /&gt;
:Same as above but with subdirectories.  Example: &amp;quot;path/to/actual/file.ext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mask_bitmap(name)&amp;lt;/b&amp;gt; = bitmap&lt;br /&gt;
:This function loads a bitmap that requires two distinct regions of transparency that are used at different times, such as see-through door decorations or magic windows. The region that is transparent when the image is first blitted is represented by color 0, whereas the region that is &amp;quot;see through&amp;quot; is in the usual magenta color. This requires a 256 color bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_new_bitmap&amp;lt;/b&amp;gt;(xsize, ysize) = bitmap&lt;br /&gt;
:Creates a brand new bitmap and returns a reference to it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_destroy_bitmap&amp;lt;/b&amp;gt;(bitmap)&lt;br /&gt;
:Completely destroys a bitmap. Rarely needed, as Lua&#039;s garbage collector will automatically scoop up out-of-scope bitmaps. You should only invoke this by hand if you know for sure why you need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_clone_bitmap&amp;lt;/b&amp;gt;(bitmap) = bitmap&lt;br /&gt;
:Creates a &amp;quot;virtual bitmap&amp;quot; clone of the specified bitmap. It shares the same actual memory, but can have different offsets. This is useful if you, for example, have several wallitems for which you want to draw the same image on different parts of the wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_animate&amp;lt;/b&amp;gt;(bitmap, frames, frame_delay)&lt;br /&gt;
:Sets up a bitmap that is a series of frames for animation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_clear&amp;lt;/b&amp;gt;(bitmap, RGB)&lt;br /&gt;
:Clears a bitmap to the specified RGB value. An RGB is specified as a table of { R, G, B }.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_blit&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x_src, y_src, x_dest, y_dest, width, height)&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_blit&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x_src, y_src, x_dest, y_dest, src_width, src_height, final_width, final_height)&lt;br /&gt;
:Blits one bitmap onto another.&lt;br /&gt;
:This function takes either 8 or 10 parameters. In the 10 parameter version, the last two parameters define the size of the final bitmap to be rendered. This allows you to scale bitmaps dynamically. There&#039;s no anti-aliasing, so this works best with simple pixel images.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_draw&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x, y, flip)&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_draw&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x, y, src_width, src_height, final_width, final_height, flip)&lt;br /&gt;
:Draws the entire source bitmap on to the destination, taking any animation or offsets into account. Pass true to the last parameter to horizontally flip the bitmap. Pass only 5 parameters to draw a simple bitmap at x,y, or pass 9 parameters to scale the bitmap dynamically.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_width&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_height&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
:Returns the dimension of the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_rect&amp;lt;/b&amp;gt;(bitmap, x_src, y_src, x_dest, y_dest, color, filled)&lt;br /&gt;
:Draws a rectangle. Pass true to filled for a filled rectangle.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;(bitmap, font, string, x, y, alignment, color) = integer&lt;br /&gt;
:Renders text onto a bitmap in the specified font and color, with the specified alignment: (LEFT, RIGHT, CENTER, or MULTILINE).  Returns the number of lines printed.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_dungeon_view&amp;lt;/b&amp;gt;(lev, x, y, dir, light) = bitmap&lt;br /&gt;
:Return a rendering of the viewport.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport_distort&amp;lt;/b&amp;gt;(effect)&lt;br /&gt;
:For viewport postprocessing&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pixel&amp;lt;/b&amp;gt;(bmp, x, y) = {R,G,B},[alpha]&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_pixel&amp;lt;/b&amp;gt;(bmp, x, y, {R,G,B}, [alpha])&lt;br /&gt;
:These are used for per-pixel bitmap manipulation. &lt;br /&gt;
:If the pixel queried with &#039;&#039;&#039;dsb_get_pixel()&#039;&#039;&#039; has an alpha channel, then the function returns two values: the {R,G,B} table, and an extra parameter containing the alpha. If there is no alpha, this second one will be &#039;&#039;&#039;nil&#039;&#039;&#039;. &lt;br /&gt;
:Alpha values for both &#039;&#039;&#039;dsb_get_pixel()&#039;&#039;&#039; and &#039;&#039;&#039;dsb_set_pixel()&#039;&#039;&#039; are in the range 0-255, where 0 is fully transparent and 255 is fully opaque.&lt;br /&gt;
:Here is a short example of how you might use these function to tint a bitmap:&lt;br /&gt;
:http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28859&amp;amp;p=135634#p135634&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rgb_to_hsv&amp;lt;/b&amp;gt;({R,G,B}) = {H,S,V}&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_hsv_to_rgb&amp;lt;/b&amp;gt;({H,S,V}) = {R,G,B}&lt;br /&gt;
:Converts color model.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_screen_bitmap&amp;lt;/b&amp;gt;() = bitmap&lt;br /&gt;
:Takes a screenshot of the entire Windows screen and assigns it to a bitmap you can use later. If you&#039;re running the game in fullscreen mode, this will allow you to screenshot the entire game window. If you&#039;re running in Windowed mode, this will screenshot your visible Windows screen from the top/left 0,0 coordinate (probably not very useful in your dungeon!)&lt;br /&gt;
&lt;br /&gt;
==Fonts and Text==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_font&amp;lt;/b&amp;gt;(name, relative_path) = font&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a font.  Example with a subdirectory: &lt;br /&gt;
:&amp;lt;code&amp;gt;gfx[&amp;quot;GAUDYMEDIEVALFONT&amp;quot;] = dsb_get_font(&amp;quot;GAUDYMEDIEVAL&amp;quot;, &amp;quot;fonts/gaudymedieval.pcx&amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_textformat&amp;lt;/b&amp;gt;(chars_per_line, y_offset_per_line, max_lines)&lt;br /&gt;
:This controls the format of MULTILINE text output by &amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;. The Y offsets are also used by the console (the text below the game view). By setting chars_per_line to something unreasonable, you can effectively disable word wrapping.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_write&amp;lt;/b&amp;gt;(RGB, string)&lt;br /&gt;
:Outputs the given text string in the given color to the console. (that is, a table of { R, G, B })&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_text_size(font, string) = width, height&amp;lt;/b&amp;gt; [DSB 0.54+]&lt;br /&gt;
: Returns the width and height in pixels of the supplied string for the specified font.&lt;br /&gt;
&lt;br /&gt;
==Sound and Music==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sound&amp;lt;/b&amp;gt;(name) = sound&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_sound&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound. An optional boolean parameter allows you to specify if the sound should loop. Be careful, the only way to stop a looping sound is via &amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;, so don&#039;t lose the channel handle!&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays a sound file directly from disk instead of loading into memory first. This function only works with direct filenames, you can&#039;t send it a full path -- so your music file must be in the root of your dungeon directoy.  If you use &amp;lt;i&amp;gt;dsb_music&amp;lt;/i&amp;gt;, it will at least load it on demand and destroy it when it&#039;s finished, so your memory usage will be lower than if you loaded it directly as a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_3dsound&amp;lt;/b&amp;gt;(sound, lev, x, y, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound as though it originated from the given location in the dungeon. An optional boolean parameter allows you to specify if the sound should loop. Note that &amp;lt;i&amp;gt;base/util.lua&amp;lt;/i&amp;gt; also includes a useful function, explained next:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;local_sound&amp;lt;/b&amp;gt;(id, sound) = chan_handle&lt;br /&gt;
:Plays a sound that appears to originate from the location of a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music_to_background&amp;lt;/b&amp;gt;(?) = ?&lt;br /&gt;
:Allows multiple music streams.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Stops the sound playing on a channel handle previously returned by a call to a sound playing function. As of DSB 0.70, passing a channel handle of -1 will stop all currently playing sounds (and release their handles).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_soundvol&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Obtains the current volume of the sound, ranging from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_soundvol&amp;lt;/b&amp;gt;(chan_handle, volume) &lt;br /&gt;
:Adjusts the volume of the sound, with the volume range from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
==Levels and Wallsets==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_getinfo&amp;lt;/b&amp;gt;(level) = x_size, y_size, light, xp_multiplier, wallset_name&lt;br /&gt;
:Returns the basic info about a level.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_tint&amp;lt;/b&amp;gt;(level, RGB, ~[level])&lt;br /&gt;
:Tells DSB to tint the dynamically scaled and shaded objects in a level a certain way. By default, this is {0, 0, 0}, causing the dungeon to fade to black, just like DM, but if the ambient light color is different, or you are outdoors and fade to a misty grey instead of black, you will probably want to change this. The third parameter is to control the level of tint applied. The default is 64 but a value of over 200 or so will make everything so dark you can&#039;t see anything.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. Wallsets in DM 2.x ([CSBwin]) are easiest to use with this command, as they have a single very long wall, as opposed to assembling the front view out of &amp;quot;left&amp;quot; and &amp;quot;front&amp;quot; bitmaps. (see the next command)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, left1, left1alt, left2, left2alt, left3, left3alt, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. This command takes 6 more arguments: 6 &amp;quot;left side&amp;quot; bitmaps. If you&#039;re using a converted DM2, [[DSB/DSB for RTC users|DSB for RTC users]], or WHACK wallset, you&#039;ll find this command useful.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_wallset&amp;lt;/b&amp;gt;(level, wallset)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_use_wallset&amp;lt;/b&amp;gt;(level, wallset) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Tells DSB to use the specified wallset on the specified level.&lt;br /&gt;
Note: this function was formerly known as &amp;quot;dsb_use_wallset,&amp;quot; and that is still a synonym for it, for now. In new dungeons, please use the new name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_alt_wallset&amp;lt;/b&amp;gt;(wallset, level, x, y, dir)&lt;br /&gt;
:Tells DSB to use the specified wallset only on the given direction of the given tile. If CENTER is specified, it will use that wallset on all directions of the given tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the roof every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the floor with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a second bitmap name to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the roof with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the roof every other step, like standard roofs, or pass a second bitmap name to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_text2map&amp;lt;/b&amp;gt;(level, x_size, y_size, light, xp_multiplier, maptable)&lt;br /&gt;
:Converts a table with a text-based map into a level. Each row of the table should represent a row of the dungeon, and contain a string with 0&#039;s or 1&#039;s representing walls and floors in that row. In this way, it is very similar to how dungeons are declared in an [[DSB/DSB for RTC users|DSB for RTC users]] text file.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_image2map&amp;lt;/b&amp;gt;(level, filename, light, xp_multiplier) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Converts a bitmap image into a level. One pixel = one square. It must be a 256 color image, where color 0 represents walls, color 1 represents open space, and further colors can be used to represent various objects in the dungeon by means of a conversion table. This function is now mostly deprecated because everyone is using ESB anyway.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_cell&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns a boolean specifying whether or not the given cell in the dungeon is a wall. Use &amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt; to find out anything else about what&#039;s there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_cell&amp;lt;/b&amp;gt;(level, x, y, value)&lt;br /&gt;
:Sets whether the given cell in the dungeon is a wall or open space. A value of nil, false, or 0 represents open space. A value of true or any other integer represents a wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_visited&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns whether the party has visited the given dungeon cell. A wall will never be visited, unless it wasn&#039;t a wall at some point in the past.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp_multiplier&amp;lt;/b&amp;gt;(level) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp_multiplier&amp;lt;/b&amp;gt;(level, integer)&lt;br /&gt;
:Gets or sets the XP multiplier for a given level of the dungeon.&lt;br /&gt;
&lt;br /&gt;
==Characters==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_champion&amp;lt;/b&amp;gt;(portrait_gfxname, first_name, last_name, health, stamina, mana, strength, dexterity, wisdom, vitality, anti-magic, anti-fire, luck, fighter_level, ninja_level, priest_level, wizard_level) = char_id&lt;br /&gt;
:Adds a character to the roster and returns his/her id number, which can then be used for adjusting various stats or putting items in his/her pack. Note that the internal representations of the three bars and the 7 statistics are 10 times what is actually displayed. (That is, 100 health in-game is represented by 1000)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_offer_champion&amp;lt;/b&amp;gt;(char_id, mode, take_function)&lt;br /&gt;
:Offers the given char_id, with the options specified by &amp;quot;mode&amp;quot; available.&lt;br /&gt;
:~[1 = resurrect, 2 = reincarnate, 3 = both]. The take_function is a Lua function that is executed if the offered character is resurrected or reincarnated. It is typically used to clear out the champion&#039;s mirror, or do something else to denote that the character is no longer available.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_toparty&amp;lt;/b&amp;gt;(ppos, char)&lt;br /&gt;
:Adds the specified character at the specified party position. (Unlike dsb_offer_champion the player is given no choice, the character is just added) It will fail silently if that position is already occupied.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_fromparty&amp;lt;/b&amp;gt;(ppos)&lt;br /&gt;
:Removes anyone at the specified party position. It will fail silently if no one is there. If the party is reduced to nothing, the game will revert to &amp;quot;ghost mode.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charname&amp;lt;/b&amp;gt;(char) = string&lt;br /&gt;
:Returns the character&#039;s name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_chartitle&amp;lt;/b&amp;gt;(char) = string&lt;br /&gt;
:Returns the character&#039;s lastname or title.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s three bars. (HEALTH, STAMINA or MANA)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_stat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_stat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s stats. (STAT_STR, STAT_DEX, STAT_WIS, STAT_VIT, STAT_AMA, STAT_AFI, STAT_LUC)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxbar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxbar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxstat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxstat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:As above, only pertaining to maximum values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;do_damage(ppos, char, type, amount)&amp;lt;/b&amp;gt;&lt;br /&gt;
:This function will damage the given character at the given ppos the given amount of the given type (HEALTH, STAMINA, or MANA). The units specified here are as the player perceives them (that is, divided by ten from internal representations and the same scale used by monsters)&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_load&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxload&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
:Returns the load or max load of a given character.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_food&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_food&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_water&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_water&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
:Get or set the character&#039;s food and water values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_injury&amp;lt;/b&amp;gt;(char, location) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_injury&amp;lt;/b&amp;gt;(char, location, integer)&lt;br /&gt;
:Gets or sets the amount of injury a given location on the given character has sustained. This number is 0 if the location is uninjured and can go up to 100, but anything nonzero will highlight it in red and use the &amp;quot;bandaged&amp;quot; bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_portrait&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:Replaces the portrait of a character with the given image. This can happen on-the-fly at any time. Note that the portrait must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;portrait&amp;quot;, not gfx.portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_portraitname&amp;lt;/b&amp;gt;(char) = portrait_name&lt;br /&gt;
:Retrieves the name of a character&#039;s portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_portraitname&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:An alias for dsb_replace_portrait (for symmetry).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_topimages&amp;lt;/b&amp;gt;(char, hands_image_name, portrait_background_image_name, death_image_name)&lt;br /&gt;
:Replaces the top &amp;quot;hands&amp;quot;, &amp;quot;portrait background&amp;quot; and &amp;quot;death&amp;quot; images.  Pass the image names nil to leave the image alone, or 0 to go back to the default.  Remember that we pass the image parameters as strings, and not a direct reference to the &#039;&#039;gfx&#039;&#039; table.  Example: &#039;&#039;dsb_replace_topimages(char, nil, nil, &amp;quot;frozen_face_halk&amp;quot;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_charhand&amp;lt;/b&amp;gt;(char, hand_name)&lt;br /&gt;
:Replaces the &amp;quot;hand&amp;quot; of a character with the given image. This can happen on-the-fly at any time. Note that the image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;hand_image&amp;quot;, not gfx.hand_image.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_inventory&amp;lt;/b&amp;gt;(char, inventory_image_name)&lt;br /&gt;
:Replaces the inventory background of a character with the given image. This can happen on-the-fly at any time. Note that the background image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;inventory&amp;quot;, not gfx.inventory.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_methods&amp;lt;/b&amp;gt;(char, methods_table_name)&lt;br /&gt;
:Replaces the default attack methods of a character with the given table of methods, or function returning a table. This can happen on-the-fly at any time. Note that the method table or function must be specified by name as a string, not as an actual table. It must a single global variable (not be contained in any other table).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_xp_level&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_xp_level_nobonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
:These functions return the character&#039;s level of mastery at a certain skill (a class such as &#039;ninja&#039;) and subskill (or 0 for no subskill). The &amp;quot;nobonus&amp;quot; form does not take temporary XP or level-boosting items into account.  All references to the &amp;lt;i&amp;gt;dsb_xp_level&amp;lt;/i&amp;gt; call are wrapped by function &amp;lt;i&amp;gt;determine_xp_level(char, class, subskill)&amp;lt;/i&amp;gt; so that [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28487&amp;amp;p=106622#p106622 it can be overridden].&lt;br /&gt;
  &lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_give_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gives the specified amount of XP in the specified skill and subskill (or 0 for no subskill).&lt;br /&gt;
:Important: This function gives XP only. It doesn&#039;t deal with XP multipliers, leveling up, bonuses, or anything else.&lt;br /&gt;
:More useful to most designers will be the helper function &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:This function takes XP multipliers, leveling up, etc. into account.&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/xp.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets the character&#039;s amount of experience directly. Setting XP directly doesn&#039;t do anything with stats, leveling up or down, or anything of that sort, so it is of limited use unless you really know what you&#039;re doing.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets a temporary XP bonus. This, too, is handled by &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt; automatically.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bonus&amp;lt;/b&amp;gt;(char, skill, subskill, integer)&lt;br /&gt;
:Gets or sets a level bonus associated with a given skill or subskill (or 0 for no subskill), such as what may be given by a magic item held in hand or worn around the neck.&lt;br /&gt;
&lt;br /&gt;
==The Party==&lt;br /&gt;
Many of these commands include optional support for [[DSB/Multiple Parties|Multiple Parties]]. In a standard DM dungeon, you can ignore all of that.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt;(~[party]) = level, x, y, facing&lt;br /&gt;
:Returns the ~[specified] party&#039;s location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_at&amp;lt;/b&amp;gt;(level, x, y) = party&lt;br /&gt;
:Returns which party is at a specified location, or nil if no party is there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_place&amp;lt;/b&amp;gt;(level, x, y, facing, ~[party])&lt;br /&gt;
:Places the ~[specified] party at a specific location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pfacing&amp;lt;/b&amp;gt;(ppos) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_pfacing&amp;lt;/b&amp;gt;(ppos, direction)&lt;br /&gt;
:Get or set the direction a given party position is facing relative to the rest of the party. (This changes when the members are attacked from monsters to the sides or behind)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_idle&amp;lt;/b&amp;gt;(ppos) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_idle&amp;lt;/b&amp;gt;(ppos, integer)&lt;br /&gt;
:Gets or sets the amount of time the given party position must be idle (that is, the attack method icons are ghosted). Note that these take party positions, not character numbers.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_leader&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:Returns the party position of the party&#039;s leader.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_char&amp;lt;/b&amp;gt;(ppos, ~[party]) = char&lt;br /&gt;
:Returns the character at the given party position, or nil if there isn&#039;t one.&lt;br /&gt;
If a party is specified, that party will be searched. If there is no party specified, only the current party will be searched. To search all parties, specify VARIABLE as the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_char_ppos&amp;lt;/b&amp;gt;(char) = ppos&lt;br /&gt;
:Returns the party position a given character occupies, or nil if he/she isn&#039;t in the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_tile&amp;lt;/b&amp;gt;(ppos, ~[party]) = tile_dir&lt;br /&gt;
:Returns the tile location that the given party position occupies.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tile_ppos(tile_dir, ~[party])&amp;lt;/b&amp;gt; = ppos&lt;br /&gt;
:Returns the party position occupied by the given tile location, or nil if nobody is there.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sleepstate&amp;lt;/b&amp;gt;() = boolean&lt;br /&gt;
:Returns whether or not the party is asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wakeup&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Wakes up the party if they are asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_current_inventory&amp;gt;&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:If someone&#039;s inventory is being looked at, this returns the party position of the character that is being looked at. Otherwise, it returns nil.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lastmethod&amp;lt;/b&amp;gt;(ppos) = method, location, inst&lt;br /&gt;
:Returns the last attack method invoked by the given ppos.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_scanfor&amp;lt;/b&amp;gt;(arch) = id&lt;br /&gt;
:Scans the entire party&#039;s inventory for a given arch. Returns the id for the first instance of that arch if it is found, or nil if nothing is found.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_caster&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:Returns the current spell caster.&lt;br /&gt;
&lt;br /&gt;
==Multiple Parties==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mpartyflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Multiple Parties|Multiple Parties]] flag.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_exviewinst&amp;lt;/b&amp;gt;(char, monster_id)&lt;br /&gt;
:This will associate a given monster inst with a character. The monster must be in LIMBO. From then on, whenever that character is seen from a 3rd person perspective, that monster will be drawn to represent that character. Don&#039;t kill this monster or bad things will happen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_apush&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_party_apop&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
:The game uses a &amp;quot;party stack&amp;quot; to keep track of which sub-party the various party-related commands affect. The currently viewed party is always at the bottom. When a party steps on a trigger, it is pushed onto the stack before the trigger is processed. This means things like &amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt; will generally affect the &amp;quot;right&amp;quot; party. You can directly manipulate the stack with these commands, but be careful. If you&#039;re not sure what to do with these commands, you probably don&#039;t need them.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_contains&amp;lt;/b&amp;gt;(ppos) = party_id&lt;br /&gt;
:Returns the party containing a given character ppos&lt;br /&gt;
&lt;br /&gt;
==Interacting with Insts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt;(object_arch, level, x, y, tile_location) = id&lt;br /&gt;
:Spawns a new instance at the specified coordinates and returns its id.&lt;br /&gt;
Note that if &amp;quot;level&amp;quot; is negative, various [[DSB/Special Values|Special Values]] can be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;(id, level, x, y, tile_location)&lt;br /&gt;
:Moves an instance to the specified location. The [[DSB/Special Values|Special Values]] can also be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_reposition&amp;lt;/b&amp;gt;(id, tile_location)&lt;br /&gt;
:Moves an instance to a new tile location on the same tile. Useful for rearranging monsters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Note: &amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt; etc. will not always immediately put the spawned/moved object into position. During the processing of a triggering event (wallitem or flooritem), all spawns and moves will be queued until the end of the processing in order to avoid changing the dungeon state while the triggering objects are still being iterated over. In most cases, the change will not be noticable, but you should be wary of this fact, especially if you are expecting to be able to manipulate the just-moved object in the same function.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move_moncol&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
Allow moving a monster and automatically handle flyer collisions.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_coords&amp;lt;/b&amp;gt;(id) = level, x, y, tile_location&lt;br /&gt;
:Returns the coordinates of an instance. This is either the location in the dungeon, or, using special coordinates, its location in a character or monster&#039;s inventory, in limbo, etc.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_coords_prev&amp;lt;/b&amp;gt;(id) = level, x, y, tile_location&lt;br /&gt;
:Returns the object&#039;s coordinates before its most recent movement.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt;(level, x, y, tile_location) = id (or table of ids), ~[number]&lt;br /&gt;
:Checks a specified location and returns what&#039;s there. If this is a special coordinate, it is either nil or just an id number. If this is a dungeon location (that is, a level &amp;gt;= 0) or if the special specifier TABLE is used for tile_location, it will return a table of ids. -1 can also be used for the y coordinate when using a special coordinate to return a table of all matching ids, for example, IN_OBJ will give everything inside that object. In these cases, a number is also returned matching the number of instances fetched (but can be ignored if you choose)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_find_arch&amp;lt;/b&amp;gt;(id) = arch&lt;br /&gt;
:Determines the arch of the given instance id. This is often needed in order to access information about the object&#039;s general type.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_swap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Totally destroys the targeted instance and creates a new one at its location with its id number and the new archetype. Things like exvars are not preserved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_qswap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Quick-swaps an instance to a new archetype. That is, it changes only the arch, but no internal variables or exvars. This means that if the new arch is a radically different type, strange things will probably happen and the game might crash. It&#039;s quite handy for making push-buttons that change appearance and such, though.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delete&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Completely destroys an instance from the dungeon.&lt;br /&gt;
In most cases, it is better to send the instance an M_DESTROY message instead.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_facedir&amp;lt;/b&amp;gt;(id) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_facedir&amp;lt;/b&amp;gt;(id, direction)&lt;br /&gt;
:Gets or sets the direction a monster is facing or a flying instance is currently travelling.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_shoot&amp;lt;/b&amp;gt;(id, level, x, y, direction, tile_pos, power, damage, delta, ~[damage_delta])&lt;br /&gt;
:Sends the specified instance flying through the air. It originates at the given level, x, y, and tile_pos, flying in the given direction. Power and damage are variables used by the game to control how far the object flies and how hard it hits. Delta represents how much is subtracted from power each subtile of flight. Delta is also subtracted from damage, unless an optional damage delta is specified instead. When the instance runs out of power, it falls to the ground (or vanishes if &amp;lt;b&amp;gt;flying_only&amp;lt;/b&amp;gt; is set on its archetype)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_flystate&amp;lt;/b&amp;gt;(id) = power, direction, damage&lt;br /&gt;
:Returns the information on a flying instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_openshot&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:This is a minor hack used to specify that the instance has been shot in open space (by a champion or monster, instead of by a wall shooter, for example) and thus should not have collision detection immediately. If this is not set, the instance will instantly run into the character or monster that was supposed to have &amp;quot;launched&amp;quot; it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_collide&amp;lt;/b&amp;gt;(id, lev, x, y, tile, direction) = { {id, tile}, ~[...] }&lt;br /&gt;
:Performs collision detection on a flying object for the specified location. This is useful when directly moving monsters around (e.g., via &amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;) so that they will not apparently move &amp;quot;through&amp;quot; flying missiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_flyreps&amp;lt;/b&amp;gt;(id, repetitions)&lt;br /&gt;
:Allows you to set the number of update &amp;lt;b&amp;gt;repetitions&amp;lt;/b&amp;gt; (default value is 1) that a flying object performs per tick. For example, a value of 8 will cause the &amp;lt;b&amp;gt;id&amp;lt;/b&amp;gt; flying object to move 8 sub-tiles per tick, or 4 full tiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gfxflag&amp;lt;/b&amp;gt;(id, flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Graphics Flag|Graphics Flag]] for a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charge&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_charge&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets the charge of a given instance. This is normally used by limited-use items but it can have other applications. It is used to set the size of clouds and spells, too. It must be a number from 0 to 63.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_crop&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_crop&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets how much a door is cropped in its display. This is used when they open and close.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawnburst_begin&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_spawnburst_end&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Begins or ends a [[DSB/Spawnburst|Spawnburst]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_push_mouse&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:A shortcut command to push the specified instance into the mouse hand.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_pop_mouse&amp;lt;/b&amp;gt;() = id&lt;br /&gt;
:A shortcut command to pop anything in the mouse hand out, returning its id at the same time.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_valid_inst&amp;lt;/b&amp;gt;(id) = ternary value&lt;br /&gt;
:Returns true if the instance exists, false if it doesn&#039;t but the id is valid, and nil if it is not a valid instance id.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:Creates a new arch type.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Monsters==&lt;br /&gt;
Monsters are insts as well, and (almost?) all commands that affect insts will work just the same on monsters, but monsters have their own specialized functionality as well.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_hp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_hp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s HP. Please note that this function has nothing to do with how to get or set a character&#039;s HP. In addition, the scale used by monster HP is &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; scaled up by a factor of 10.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxhp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxhp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s max HP.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_tint&amp;lt;/b&amp;gt;(id, RGB, ~[intensity])&lt;br /&gt;
:Sets the &#039;tint&#039; of a monster, to give it a glowing effect. Monsters flash when they are hit by various spells.  There is finally an optional intensity level parameter, set at 127 by default with a range of 0 to 255.  0 Being completely black.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai&amp;lt;/b&amp;gt;(id, message, data) ~[= result]&lt;br /&gt;
:Sends an [[DSB/Monster AI|Monster AI]] message to the given monster.&lt;br /&gt;
If data is QUERY then the function will return information on the given value, rather than setting it. For example, dsb_ai(id, AI_FEAR, QUERY) will return the monster&#039;s current level of fear. [[DSB/Monster AI|Monster AI]] documentation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_boss&amp;lt;/b&amp;gt;(id) = boss_id&lt;br /&gt;
:Returns the given monster id&#039;s boss. The &amp;quot;boss&amp;quot; is the monster in each tile who controls when the entire group moves and attacks. This allows DSB monsters to all be distinct entities, but move in DM-style groups.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_promote&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Promotes the given monster id to be the boss of its tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_subordinates&amp;lt;/b&amp;gt;(boss_id) = { {id, tile}, [...] }&lt;br /&gt;
:Returns all monsters who are subordinate to the given boss.&lt;br /&gt;
&lt;br /&gt;
==Messaging==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg&amp;lt;/b&amp;gt;(delay, id, message, data, ~[sender])&lt;br /&gt;
:Sends the specified [[DSB/Messages|Messages]] to the specified instance after the specified delay. Messages are simply integers. The object responds to the message as specified by its msg_handler, defined in its archetype. See &amp;lt;i&amp;gt;base/msg_handlers.lua&amp;lt;/i&amp;gt; for many examples of what can be done with message handlers. Normally it doesn&#039;t matter where a message comes from. However, it is possible to assert the sender of the message, in the rare cases where it is needed. (See [[DSB/Messages]] for more information on how to use messages)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg_chain&amp;lt;/b&amp;gt;(id, target_id)&lt;br /&gt;
:This causes the first instance to relay any messages it receives to the second instance. This is useful for making ceiling pits close at the same time floor pits do, and other situations where an instance should pass messages along.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_msgs_to&amp;lt;/b&amp;gt;(id, delay)&lt;br /&gt;
:Delays all messages bound for a given instance by the specified delay.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_enable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Enables an instance. This will clear its INACTIVE flag as well as make sure any events, triggerings, etc. that should happen do happen. This function is easier and safer to use than setting the flag directly.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_disable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Disables an instance. This will set its INACTIVE flag and make sure that any objects on it stop triggering it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_toggle&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:See the previous two.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_msgtype&amp;lt;/b&amp;gt;(code_name,int_value) &amp;lt;font color=&amp;quot;#999&amp;quot;&amp;gt; = none?&amp;lt;/font&amp;gt;&lt;br /&gt;
:Adds a new message type to the system. Values above 100000 are reserved for the base code.&lt;br /&gt;
:Custom msg types will presumably still be handled the same way the built in ones are, so may be useful for triggering events on custom archs.&lt;br /&gt;
:Hmm. This could get messy if you combine msgtypes with importable archs...&lt;br /&gt;
&lt;br /&gt;
==Light==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light&amp;lt;/b&amp;gt;(handle) = lightlevel&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_light&amp;lt;/b&amp;gt;(handle, lightlevel)&lt;br /&gt;
:Gets or sets the light level on the given light handle, which is an integer from 0 to 9. The light level displayed is the sum of the dungeon level&#039;s base light level plus the 10 light handles. Currently, light handle 0 is used for light spells, handle 1 is used for torches, and 2 is used by illumulets.&lt;br /&gt;
&lt;br /&gt;
==Conditions==&lt;br /&gt;
:Conditions (i.e., status variables) are added to the game by modifying the &amp;lt;b&amp;gt;conditions&amp;lt;/b&amp;gt; table, which is defined in &amp;lt;i&amp;gt;base/conditions.lua&amp;lt;/i&amp;gt;. See that file for examples.&lt;br /&gt;
:The &amp;lt;b&amp;gt;scope&amp;lt;/b&amp;gt; of the condition is either PARTY (affects the whole party) or INDIVIDUAL (affects one person). You can also specify images for the condition, like a &amp;lt;b&amp;gt;subrenderer_image&amp;lt;/b&amp;gt; or a &amp;lt;b&amp;gt;portrait_image&amp;lt;/b&amp;gt;. PARTY conditions can instead have an &amp;lt;b&amp;gt;overlay_image&amp;lt;/b&amp;gt; that goes over the entire game&#039;s viewport.  &lt;br /&gt;
:If &amp;lt;b&amp;gt;update_rate&amp;lt;/b&amp;gt; is &amp;gt; 0, the specified &amp;lt;b&amp;gt;update_func&amp;lt;/b&amp;gt; will be called at the specified number of ticks. The function takes the following form:&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
   function update_func(char, condition_strength)&lt;br /&gt;
     return new_condition_strength&lt;br /&gt;
   end&lt;br /&gt;
:&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_condition&amp;lt;/b&amp;gt;(type, inventory_gfx, portrait_gfx, update_freq, function, [flags]) = condition_id &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Adds a condition (status variable) to the list of those available, but see above. &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_condition&amp;lt;/b&amp;gt;(condition_id, type, inventory_gfx, portrait_gfx, update_freq, function) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Replaces the information for the condition with the given id with the new condition.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_condition&amp;lt;/b&amp;gt;(char, condition) = strength&lt;br /&gt;
:Returns the strength of the specified condition for the specified character (or, in the case of conditions for the whole party, pass PARTY as the character)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_condition&amp;lt;/b&amp;gt;(char, condition, strength)&lt;br /&gt;
:Sets the strength of the condition. See previous function.&lt;br /&gt;
&lt;br /&gt;
==Popups and Readouts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_damage_popup&amp;lt;/b&amp;gt;(ppos, damage_type, integer)&lt;br /&gt;
:Shows the amount of damage taken by a character in a little popup over the character&#039;s name or portrait. The type is either HEALTH, STAMINA, or MANA, and a different background icon is displayed for each. The amount of damage shown should be in units as the player perceives them, not internal (so, divided by ten from internal representations)-- the default functions in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt; take care of this for you.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_damage&amp;lt;/b&amp;gt;(integer)&lt;br /&gt;
:This causes a number in a little explosion to appear in the area occupied by the attack icons. This is used for showing the amount of damage inflicted upon a monster by a melee attack.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_text&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:This causes text to momentarily appear in the area occupied by the attack icons. This is used for things like &amp;quot;CAN&#039;T REACH&amp;quot; or &amp;quot;NEED AMMO.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Fullscreen==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;(bitmap_or_func, click_func, update_func, mouse, { fade = true, game_draw = true })&lt;br /&gt;
:This engages the full-screen renderer, and is used for cut scenes or other interludes. If the first parameter passed is a bitmap, that bitmap will be displayed. If the first parameter is instead a function, that function will be executed every frame. The draw function will be passed the bitmap to draw to, the mouse&#039;s x location, and the mouse&#039;s y location, in the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;draw_function&amp;lt;/b&amp;gt;(bitmap, mouse_x, mouse_y)&amp;lt;/code&amp;gt;&lt;br /&gt;
:The click_func, if provided, will be executed every time the mouse is clicked. It is of the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;click_func&amp;lt;/b&amp;gt;(mouse_x, mouse_y, mouse_buttons)&amp;lt;/code&amp;gt;&lt;br /&gt;
:Update_func, if provided, will be executed every game tick. It takes no parameters.&lt;br /&gt;
:If mouse is nil or false, no mouse pointer will be drawn. If it is true, the standard &amp;quot;yellow arrow&amp;quot; mouse pointer will be drawn. If it is a bitmap, that bitmap will be drawn as the mouse pointer.&lt;br /&gt;
:There is an optional 5th parameter (a table of booleans) that allows a fade in/fade out. The &amp;lt;b&amp;gt;game_draw&amp;lt;/b&amp;gt; allows you to have the game view drawn in the background. So, for example, for a fullscreen view that fades in and draws the game view.&lt;br /&gt;
:The full-screen renderer will run until any of its associated functions returns something other than false or nil, and the game logic does not advance while in &amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Subrenderers and System Renderers==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_subrenderer_target&amp;lt;/b&amp;gt;() = bitmap&lt;br /&gt;
:Returns a bitmap to be drawn upon. Use only in a [[DSB/Subrenderers|Subrenderer]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_objzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y)&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer or system bitmap. This object zone can be used to access instances that are stored inside of the given instance. See the implementation of chests in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for more information and examples.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msgzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y, width, height, msg, ~[data1, data2])&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer or system bitmap, with the given width and height. When it is clicked, the specified message will be sent to the instance. This can allow fairly complicated user interfaces in subrenderers.&lt;br /&gt;
:The third parameter, number, allows you to override/replace zones by specifying an existing handle. It also allows msgzones to have more information about where you clicked, because the zone number you clicked is passed as the msg&#039;s data parameter. If you don&#039;t care about any of this, just keep incrementing the number for every new zone. (See [[DSB/Messages]] for more information on how to use messages)&lt;br /&gt;
&lt;br /&gt;
==Global Data, Utility Functions, and Misc.==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gameflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_clear_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_toggle_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Global Flags|Global Flag]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_hide_mouse&amp;lt;/b&amp;gt;(~[bool])&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_show_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Functions to make the mouse pointer appear or disappear. &amp;lt;i&amp;gt;dsb_hide_mouse&amp;lt;/i&amp;gt; Takes an optional parameter of true to allow the pointer to return after a successful melee attack, after moving the mouse.&lt;br /&gt;
;dsb_mouse_state() = x, y, button1, button2&lt;br /&gt;
:Gets the current state of the mouse: its current x,y position relative to the entire game screen, and &#039;&#039;&#039;true&#039;&#039;&#039; or &#039;&#039;&#039;false&#039;&#039;&#039; for button1 or button2 currently being pressed (left mouse button and right mouse button respectively).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_unlock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
:Functions to lock or unlock the game. Complete locking prevents most timers from running (though animations and delayed functions still will), processing any player input, or triggering anything. If you lock the game and forget to unlock it, it will be left in an unplayable state, so be very careful how you use this! Note that this takes effect immediately (that is, even before any queued moves), which may not always be what you want. You can also lock only certain parts of the game, using the [[DSB/Locking Flags|locking flags]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rand&amp;lt;/b&amp;gt;(min, max) = integer&lt;br /&gt;
:Generates a random integer between min and max, inclusive.&lt;br /&gt;
:You should &amp;lt;b&amp;gt;always&amp;lt;/b&amp;gt; use this function for random number generation, not anything built into Lua.&lt;br /&gt;
:While larger ranges will not cause errors per-se, the output of dsb_rand seems to be a 15 bit range (0-32767) modulused across the input range&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_linesplit&amp;lt;/b&amp;gt;(string, split) = lines, number_of_lines&lt;br /&gt;
:A utility function that splits up a string into individual lines (placing the number of lines returned in number_of_lines) demarcated by the split character. &amp;quot;/&amp;quot; (slash) is a common choice for a a split character. See the implementation of scrolls in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for an example.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_forward&amp;lt;/b&amp;gt;(direction) = x, y&lt;br /&gt;
:A utility function that, given a direction, returns the x and y offsets of which way is &amp;quot;forward.&amp;quot; One will always be 1 or -1, the other will always be 0.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileshift&amp;lt;/b&amp;gt;(location, direction) = location&lt;br /&gt;
:A utility function that shifts the specified location in the specified direction. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lookup_global&amp;lt;/b&amp;gt;(string) = variable&lt;br /&gt;
:Returns the variable named by the specified string. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_func&amp;lt;/b&amp;gt;(delay, function)&lt;br /&gt;
:Executes the given function after the given delay in ticks. References to Lua functions cannot be saved, so queued functions will &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; be saved. This should be something nonvital if the game is not locked, and should happen quickly. In most cases, using a message on a delay, which is saved, would work better.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_inventory_info&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the inventory_info has been changed, this lets the engine know. Note that this state is not saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_system&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the system strings or player colors have been changed, this lets the engine know. This may or may not be useful. With the moving of most inventory rendering into Lua-controlled subrenderers, this function has limited use.&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_export&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:Normally, Lua global variables aren&#039;t saved in savegames, however, a few usually need to be. If you need to store a global variable, add it to the export list with this function. Note that dsb_export requires a string giving the name of the variable. Don&#039;t pass the variable itself! You should also note that if you have a very long export list, you&#039;re probably doing something that could be done more easily with specialized code or more careful use of instances with exvars. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport&amp;lt;/b&amp;gt;(x, y)&lt;br /&gt;
:Sets the viewport. Odds are you should leave this one alone.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_enable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_disable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Enables or disables the specified magical rune for use in spells. All runes are enabled by default, just like in original DM. The rune is specified as an integer, where 1 = LO, 2 = UM, 7 = YA, and so on.&lt;br /&gt;
:These functions are now deprecated. You should manipulate the &amp;lt;b&amp;gt;g_disabled_runes&amp;lt;/b&amp;gt; table directly. For example, disabling the VI rune (rune 8) is as simple as &amp;lt;code&amp;gt;g_disabled_runes[8] = false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_game_end&amp;lt;/b&amp;gt;(~[bool])&lt;br /&gt;
:Shows a game ending screen. Normally it&#039;s a bit more fun than the screen you get when the party dies, but if you pass it a boolean &#039;true&#039;, it will just show the standard blue &amp;quot;The End&amp;quot; screen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:This function creates a new arch type, from the original passed in as a parameter.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_import_arch&amp;lt;/b&amp;gt;(lua_filename,local_name)&amp;lt;font color=&amp;quot;#999&amp;quot;&amp;gt; = none?&amp;lt;/font&amp;gt;&lt;br /&gt;
:Loads and runs a named lua file relative to the dungeon&#039;s directory. The file is loaded with the ROOT_NAME variable set to the given local name, so that the code being loaded can use that to avoid interfering with the parent codebase. Can only be used from the objects.lua file. Several examples are found in the test_dungeon. [http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=27277&amp;amp;p=83877&amp;amp;hilit=dsb_import_arch#p83877 Some][http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=29188&amp;amp;p=128330&amp;amp;hilit=dsb_import_arch#p128330 more][http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28859&amp;amp;sid=c8dec8095c76d7ce5937980e94499ceb&amp;amp;p=130029#p130029 info]&lt;br /&gt;
&lt;br /&gt;
;dsb_include_file(shortname, filetype, filename)&lt;br /&gt;
:When compiling a DSB dungeon for distribution, most sounds and graphics are automatically compiled into a new &#039;&#039;&#039;graphics.dsb&#039;&#039;&#039;. Music however is normally left as a file to be streamed on-demand from the filesystem. This lowers the memory required by DSB and speeds up loading time. However, if you prefer, you can force music (and other files) to be included in the &#039;&#039;&#039;graphics.dsb&#039;&#039;&#039; by using this command. For example: &#039;&#039;&#039;dsb_include_file(&amp;quot;MYMUSIC&amp;quot;, &amp;quot;ogg&amp;quot;, &amp;quot;mypath/mymusic.ogg&amp;quot;)&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Pending Documentation==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_cache_invalidate&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileptr_exch&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_viewing&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_affecting&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_checksound&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gamelocks&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light_total&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_light_totalmax&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_exviewinst&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Exposed functions]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=2975</id>
		<title>DSB/Exposed functions</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=2975"/>
		<updated>2012-11-18T18:34:17Z</updated>

		<summary type="html">&lt;p&gt;Sophia: /* Bitmaps and Drawing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Functions are given in the form:&lt;br /&gt;
;&amp;lt;b&amp;gt;function&amp;lt;/b&amp;gt;(arguments, ~[optional arguments]) = return value&lt;br /&gt;
:If the terminology doesn&#039;t make sense, check [[DSB/Basic DSB Terminology]].&lt;br /&gt;
Functions without a dsb_ prefix are part of [[DSB/Base Code|base/]], not the core engine.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_insts&amp;lt;/b&amp;gt;()&lt;br /&gt;
:This is an iterator used in Lua&#039;s for loops. To iterate over all instances of objects in a DSB dungeon, use something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for i in dsb_insts()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_in_obj&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Another iterator; see above for usage. This one is used to iterate all over all instances that are inside the given instance.&lt;br /&gt;
&lt;br /&gt;
==Bitmaps and Drawing==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name) = bitmap&lt;br /&gt;
:Searches the dungeon&#039;s directory for the bitmap, and then &amp;lt;i&amp;gt;graphics.dsb&amp;lt;/i&amp;gt;, and finally the default &amp;lt;i&amp;gt;graphics.dat&amp;lt;/i&amp;gt;. Returns a truecolor bitmap, but the bitmap can be 256 colors on disk to save space. Don&#039;t specify a file extension as DSB will figure it out.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name, relative_path) = bitmap&lt;br /&gt;
:Same as above but with subdirectories.  Example: &amp;quot;path/to/actual/file.ext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mask_bitmap(name)&amp;lt;/b&amp;gt; = bitmap&lt;br /&gt;
:This function loads a bitmap that requires two distinct regions of transparency that are used at different times, such as see-through door decorations or magic windows. The region that is transparent when the image is first blitted is represented by color 0, whereas the region that is &amp;quot;see through&amp;quot; is in the usual magenta color. This requires a 256 color bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_new_bitmap&amp;lt;/b&amp;gt;(xsize, ysize) = bitmap&lt;br /&gt;
:Creates a brand new bitmap and returns a reference to it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_destroy_bitmap&amp;lt;/b&amp;gt;(bitmap)&lt;br /&gt;
:Completely destroys a bitmap. Rarely needed, as Lua&#039;s garbage collector will automatically scoop up out-of-scope bitmaps. You should only invoke this by hand if you know for sure why you need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_clone_bitmap&amp;lt;/b&amp;gt;(bitmap) = bitmap&lt;br /&gt;
:Creates a &amp;quot;virtual bitmap&amp;quot; clone of the specified bitmap. It shares the same actual memory, but can have different offsets. This is useful if you, for example, have several wallitems for which you want to draw the same image on different parts of the wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_animate&amp;lt;/b&amp;gt;(bitmap, frames, frame_delay)&lt;br /&gt;
:Sets up a bitmap that is a series of frames for animation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_clear&amp;lt;/b&amp;gt;(bitmap, RGB)&lt;br /&gt;
:Clears a bitmap to the specified RGB value. An RGB is specified as a table of { R, G, B }.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_blit&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x_src, y_src, x_dest, y_dest, width, height)&lt;br /&gt;
:Blits one bitmap onto another.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_draw&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x, y, flip)&lt;br /&gt;
:Draws the entire source bitmap on to the destination, taking any animation or offsets into account. Pass true to flip to horizontally flip the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_width&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_bitmap_height&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
:Returns the dimension of the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_rect&amp;lt;/b&amp;gt;(bitmap, x_src, y_src, x_dest, y_dest, color, filled)&lt;br /&gt;
:Draws a rectangle. Pass true to filled for a filled rectangle.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;(bitmap, font, string, x, y, alignment, color) = integer&lt;br /&gt;
:Renders text onto a bitmap in the specified font and color, with the specified alignment: (LEFT, RIGHT, CENTER, or MULTILINE).  Returns the number of lines printed.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_dungeon_view&amp;lt;/b&amp;gt;(lev, x, y, dir, light) = bitmap&lt;br /&gt;
:Return a rendering of the viewport.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport_distort&amp;lt;/b&amp;gt;(effect)&lt;br /&gt;
:For viewport postprocessing&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pixel&amp;lt;/b&amp;gt;(bmp, x, y)&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_pixel&amp;lt;/b&amp;gt;(bmp, x, y, {R,G,B}, [alpha])&lt;br /&gt;
:These are used for per-pixel bitmap manipulation. &lt;br /&gt;
:If the pixel queried with &#039;&#039;&#039;dsb_get_pixel()&#039;&#039;&#039; has an alpha channel, then the function returns two values: the {R,G,B} table, and an extra parameter containing the alpha. If there is no alpha, this second one will be &#039;&#039;&#039;nil&#039;&#039;&#039;. &lt;br /&gt;
:Alpha values for both &#039;&#039;&#039;dsb_get_pixel()&#039;&#039;&#039; and &#039;&#039;&#039;dsb_set_pixel()&#039;&#039;&#039; are in the range 0-255, where 0 is fully transparent and 255 is fully opaque.&lt;br /&gt;
:Here is a short example of how you might use these function to tint a bitmap:&lt;br /&gt;
:http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28859&amp;amp;p=135634#p135634&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rgb_to_hsv&amp;lt;/b&amp;gt;({R,G,B}) = {H,S,V}&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_hsv_to_rgb&amp;lt;/b&amp;gt;({H,S,V}) = {R,G,B}&lt;br /&gt;
:Converts color model.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Fonts and Text==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_font&amp;lt;/b&amp;gt;(name, relative_path) = font&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a font.  Example with a subdirectory: &lt;br /&gt;
:&amp;lt;code&amp;gt;gfx[&amp;quot;GAUDYMEDIEVALFONT&amp;quot;] = dsb_get_font(&amp;quot;GAUDYMEDIEVAL&amp;quot;, &amp;quot;fonts/gaudymedieval.pcx&amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_textformat&amp;lt;/b&amp;gt;(chars_per_line, y_offset_per_line, max_lines)&lt;br /&gt;
:This controls the format of MULTILINE text output by &amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;. The Y offsets are also used by the console (the text below the game view). By setting chars_per_line to something unreasonable, you can effectively disable word wrapping.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_write&amp;lt;/b&amp;gt;(RGB, string)&lt;br /&gt;
:Outputs the given text string in the given color to the console. (that is, a table of { R, G, B })&lt;br /&gt;
&lt;br /&gt;
==Sound and Music==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sound&amp;lt;/b&amp;gt;(name) = sound&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_sound&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound. An optional boolean parameter allows you to specify if the sound should loop. Be careful, the only way to stop a looping sound is via &amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;, so don&#039;t lose the channel handle!&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays a sound file directly from disk instead of loading into memory first. This function only works with direct filenames, you can&#039;t send it a full path -- so your music file must be in the root of your dungeon directoy.  If you use &amp;lt;i&amp;gt;dsb_music&amp;lt;/i&amp;gt;, it will at least load it on demand and destroy it when it&#039;s finished, so your memory usage will be lower than if you loaded it directly as a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_3dsound&amp;lt;/b&amp;gt;(sound, lev, x, y, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound as though it originated from the given location in the dungeon. An optional boolean parameter allows you to specify if the sound should loop. Note that &amp;lt;i&amp;gt;base/util.lua&amp;lt;/i&amp;gt; also includes a useful function, explained next:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;local_sound&amp;lt;/b&amp;gt;(id, sound) = chan_handle&lt;br /&gt;
:Plays a sound that appears to originate from the location of a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music_to_background&amp;lt;/b&amp;gt;(?) = ?&lt;br /&gt;
:Allows multiple music streams.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Stops the sound playing on a channel handle previously returned by a call to a sound playing function.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_soundvol&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Obtains the current volume of the sound, ranging from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_soundvol&amp;lt;/b&amp;gt;(chan_handle, volume) &lt;br /&gt;
:Adjusts the volume of the sound, with the volume range from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
==Levels and Wallsets==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_getinfo&amp;lt;/b&amp;gt;(level) = x_size, y_size, light, xp_multiplier, wallset_name&lt;br /&gt;
:Returns the basic info about a level.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_tint&amp;lt;/b&amp;gt;(level, RGB, ~[level])&lt;br /&gt;
:Tells DSB to tint the dynamically scaled and shaded objects in a level a certain way. By default, this is {0, 0, 0}, causing the dungeon to fade to black, just like DM, but if the ambient light color is different, or you are outdoors and fade to a misty grey instead of black, you will probably want to change this. The third parameter is to control the level of tint applied. The default is 64 but a value of over 200 or so will make everything so dark you can&#039;t see anything.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. Wallsets in DM 2.x ([CSBwin]) are easiest to use with this command, as they have a single very long wall, as opposed to assembling the front view out of &amp;quot;left&amp;quot; and &amp;quot;front&amp;quot; bitmaps. (see the next command)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, left1, left1alt, left2, left2alt, left3, left3alt, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. This command takes 6 more arguments: 6 &amp;quot;left side&amp;quot; bitmaps. If you&#039;re using a converted DM2, [[DSB/DSB for RTC users|DSB for RTC users]], or WHACK wallset, you&#039;ll find this command useful.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_wallset&amp;lt;/b&amp;gt;(level, wallset)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_use_wallset&amp;lt;/b&amp;gt;(level, wallset) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Tells DSB to use the specified wallset on the specified level.&lt;br /&gt;
Note: this function was formerly known as &amp;quot;dsb_use_wallset,&amp;quot; and that is still a synonym for it, for now. In new dungeons, please use the new name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_alt_wallset&amp;lt;/b&amp;gt;(wallset, level, x, y, dir)&lt;br /&gt;
:Tells DSB to use the specified wallset only on the given direction of the given tile. If CENTER is specified, it will use that wallset on all directions of the given tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the roof every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the floor with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a second bitmap name to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the roof with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the roof every other step, like standard roofs, or pass a second bitmap name to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_text2map&amp;lt;/b&amp;gt;(level, x_size, y_size, light, xp_multiplier, maptable)&lt;br /&gt;
:Converts a table with a text-based map into a level. Each row of the table should represent a row of the dungeon, and contain a string with 0&#039;s or 1&#039;s representing walls and floors in that row. In this way, it is very similar to how dungeons are declared in an [[DSB/DSB for RTC users|DSB for RTC users]] text file.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_image2map&amp;lt;/b&amp;gt;(level, filename, light, xp_multiplier) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Converts a bitmap image into a level. One pixel = one square. It must be a 256 color image, where color 0 represents walls, color 1 represents open space, and further colors can be used to represent various objects in the dungeon by means of a conversion table. This function is now mostly deprecated because everyone is using ESB anyway.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_cell&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns a boolean specifying whether or not the given cell in the dungeon is a wall. Use &amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt; to find out anything else about what&#039;s there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_cell&amp;lt;/b&amp;gt;(level, x, y, value)&lt;br /&gt;
:Sets whether the given cell in the dungeon is a wall or open space. A value of nil, false, or 0 represents open space. A value of true or any other integer represents a wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_visited&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns whether the party has visited the given dungeon cell. A wall will never be visited, unless it wasn&#039;t a wall at some point in the past.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp_multiplier&amp;lt;/b&amp;gt;(level) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp_multiplier&amp;lt;/b&amp;gt;(level, integer)&lt;br /&gt;
:Gets or sets the XP multiplier for a given level of the dungeon.&lt;br /&gt;
&lt;br /&gt;
==Characters==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_champion&amp;lt;/b&amp;gt;(portrait_gfxname, first_name, last_name, health, stamina, mana, strength, dexterity, wisdom, vitality, anti-magic, anti-fire, luck, fighter_level, ninja_level, priest_level, wizard_level) = char_id&lt;br /&gt;
:Adds a character to the roster and returns his/her id number, which can then be used for adjusting various stats or putting items in his/her pack. Note that the internal representations of the three bars and the 7 statistics are 10 times what is actually displayed. (That is, 100 health in-game is represented by 1000)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_offer_champion&amp;lt;/b&amp;gt;(char_id, mode, take_function)&lt;br /&gt;
:Offers the given char_id, with the options specified by &amp;quot;mode&amp;quot; available.&lt;br /&gt;
:~[1 = resurrect, 2 = reincarnate, 3 = both]. The take_function is a Lua function that is executed if the offered character is resurrected or reincarnated. It is typically used to clear out the champion&#039;s mirror, or do something else to denote that the character is no longer available.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_toparty&amp;lt;/b&amp;gt;(ppos, char)&lt;br /&gt;
:Adds the specified character at the specified party position. (Unlike dsb_offer_champion the player is given no choice, the character is just added) It will fail silently if that position is already occupied.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_fromparty&amp;lt;/b&amp;gt;(ppos)&lt;br /&gt;
:Removes anyone at the specified party position. It will fail silently if no one is there. If the party is reduced to nothing, the game will revert to &amp;quot;ghost mode.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charname&amp;lt;/b&amp;gt;(char) = string&lt;br /&gt;
:Returns the character&#039;s name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s three bars. (HEALTH, STAMINA or MANA)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_stat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_stat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s stats. (STAT_STR, STAT_DEX, STAT_WIS, STAT_VIT, STAT_AMA, STAT_AFI, STAT_LUC)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxbar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxbar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxstat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxstat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:As above, only pertaining to maximum values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;do_damage(ppos, char, type, amount)&amp;lt;/b&amp;gt;&lt;br /&gt;
:This function will damage the given character at the given ppos the given amount of the given type (HEALTH, STAMINA, or MANA). The units specified here are as the player perceives them (that is, divided by ten from internal representations and the same scale used by monsters)&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_load&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxload&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
:Returns the load or max load of a given character.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_food&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_food&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_water&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_water&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
:Get or set the character&#039;s food and water values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_injury&amp;lt;/b&amp;gt;(char, location) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_injury&amp;lt;/b&amp;gt;(char, location, integer)&lt;br /&gt;
:Gets or sets the amount of injury a given location on the given character has sustained. This number is 0 if the location is uninjured and can go up to 100, but anything nonzero will highlight it in red and use the &amp;quot;bandaged&amp;quot; bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_portrait&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:Replaces the portrait of a character with the given image. This can happen on-the-fly at any time. Note that the portrait must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;portrait&amp;quot;, not gfx.portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_portraitname&amp;lt;/b&amp;gt;(char) = portrait_name&lt;br /&gt;
:Retrieves the name of a character&#039;s portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_portraitname&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:An alias for dsb_replace_portrait (for symmetry).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_topimages&amp;lt;/b&amp;gt;(char, hands_image_name, portrait_background_image_name, death_image_name)&lt;br /&gt;
:Replaces the top &amp;quot;hands&amp;quot;, &amp;quot;portrait background&amp;quot; and &amp;quot;death&amp;quot; images.  Pass the image names nil to leave the image alone, or 0 to go back to the default.  Remember that we pass the image parameters as strings, and not a direct reference to the &#039;&#039;gfx&#039;&#039; table.  Example: &#039;&#039;dsb_replace_topimages(char, nil, nil, &amp;quot;frozen_face_halk&amp;quot;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_charhand&amp;lt;/b&amp;gt;(char, hand_name)&lt;br /&gt;
:Replaces the &amp;quot;hand&amp;quot; of a character with the given image. This can happen on-the-fly at any time. Note that the image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;hand_image&amp;quot;, not gfx.hand_image.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_inventory&amp;lt;/b&amp;gt;(char, inventory_image_name)&lt;br /&gt;
:Replaces the inventory background of a character with the given image. This can happen on-the-fly at any time. Note that the background image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;inventory&amp;quot;, not gfx.inventory.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_methods&amp;lt;/b&amp;gt;(char, methods_table_name)&lt;br /&gt;
:Replaces the default attack methods of a character with the given table of methods, or function returning a table. This can happen on-the-fly at any time. Note that the method table or function must be specified by name as a string, not as an actual table. It must a single global variable (not be contained in any other table).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_xp_level&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_xp_level_nobonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
:These functions return the character&#039;s level of mastery at a certain skill (a class such as &#039;ninja&#039;) and subskill (or 0 for no subskill). The &amp;quot;nobonus&amp;quot; form does not take temporary XP or level-boosting items into account.  All references to the &amp;lt;i&amp;gt;dsb_xp_level&amp;lt;/i&amp;gt; call are wrapped by function &amp;lt;i&amp;gt;determine_xp_level(char, class, subskill)&amp;lt;/i&amp;gt; so that [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28487&amp;amp;p=106622#p106622 it can be overridden].&lt;br /&gt;
  &lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_give_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gives the specified amount of XP in the specified skill and subskill (or 0 for no subskill).&lt;br /&gt;
:Important: This function gives XP only. It doesn&#039;t deal with XP multipliers, leveling up, bonuses, or anything else.&lt;br /&gt;
:More useful to most designers will be the helper function &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:This function takes XP multipliers, leveling up, etc. into account.&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/xp.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets the character&#039;s amount of experience directly. Setting XP directly doesn&#039;t do anything with stats, leveling up or down, or anything of that sort, so it is of limited use unless you really know what you&#039;re doing.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets a temporary XP bonus. This, too, is handled by &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt; automatically.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bonus&amp;lt;/b&amp;gt;(char, skill, subskill, integer)&lt;br /&gt;
:Gets or sets a level bonus associated with a given skill or subskill (or 0 for no subskill), such as what may be given by a magic item held in hand or worn around the neck.&lt;br /&gt;
&lt;br /&gt;
==The Party==&lt;br /&gt;
Many of these commands include optional support for [[DSB/Multiple Parties|Multiple Parties]]. In a standard DM dungeon, you can ignore all of that.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt;(~[party]) = level, x, y, facing&lt;br /&gt;
:Returns the ~[specified] party&#039;s location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_at&amp;lt;/b&amp;gt;(level, x, y) = party&lt;br /&gt;
:Returns which party is at a specified location, or nil if no party is there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_place&amp;lt;/b&amp;gt;(level, x, y, facing, ~[party])&lt;br /&gt;
:Places the ~[specified] party at a specific location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pfacing&amp;lt;/b&amp;gt;(ppos) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_pfacing&amp;lt;/b&amp;gt;(ppos, direction)&lt;br /&gt;
:Get or set the direction a given party position is facing relative to the rest of the party. (This changes when the members are attacked from monsters to the sides or behind)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_idle&amp;lt;/b&amp;gt;(ppos) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_idle&amp;lt;/b&amp;gt;(ppos, integer)&lt;br /&gt;
:Gets or sets the amount of time the given party position must be idle (that is, the attack method icons are ghosted). Note that these take party positions, not character numbers.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_leader&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:Returns the party position of the party&#039;s leader.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_char&amp;lt;/b&amp;gt;(ppos, ~[party]) = char&lt;br /&gt;
:Returns the character at the given party position, or nil if there isn&#039;t one.&lt;br /&gt;
If a party is specified, that party will be searched. If there is no party specified, only the current party will be searched. To search all parties, specify VARIABLE as the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_char_ppos&amp;lt;/b&amp;gt;(char) = ppos&lt;br /&gt;
:Returns the party position a given character occupies, or nil if he/she isn&#039;t in the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_tile&amp;lt;/b&amp;gt;(ppos, ~[party]) = tile_dir&lt;br /&gt;
:Returns the tile location that the given party position occupies.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tile_ppos(tile_dir, ~[party])&amp;lt;/b&amp;gt; = ppos&lt;br /&gt;
:Returns the party position occupied by the given tile location, or nil if nobody is there.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sleepstate&amp;lt;/b&amp;gt;() = boolean&lt;br /&gt;
:Returns whether or not the party is asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wakeup&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Wakes up the party if they are asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_current_inventory&amp;gt;&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:If someone&#039;s inventory is being looked at, this returns the party position of the character that is being looked at. Otherwise, it returns nil.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lastmethod&amp;lt;/b&amp;gt;(ppos) = method, location, inst&lt;br /&gt;
:Returns the last attack method invoked by the given ppos.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_scanfor&amp;lt;/b&amp;gt;(arch) = id&lt;br /&gt;
:Scans the entire party&#039;s inventory for a given arch. Returns the id for the first instance of that arch if it is found, or nil if nothing is found.&lt;br /&gt;
&lt;br /&gt;
==Multiple Parties==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mpartyflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Multiple Parties|Multiple Parties]] flag.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_exviewinst&amp;lt;/b&amp;gt;(char, monster_id)&lt;br /&gt;
:This will associate a given monster inst with a character. The monster must be in LIMBO. From then on, whenever that character is seen from a 3rd person perspective, that monster will be drawn to represent that character. Don&#039;t kill this monster or bad things will happen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_apush&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_party_apop&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
:The game uses a &amp;quot;party stack&amp;quot; to keep track of which sub-party the various party-related commands affect. The currently viewed party is always at the bottom. When a party steps on a trigger, it is pushed onto the stack before the trigger is processed. This means things like &amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt; will generally affect the &amp;quot;right&amp;quot; party. You can directly manipulate the stack with these commands, but be careful. If you&#039;re not sure what to do with these commands, you probably don&#039;t need them.&lt;br /&gt;
&lt;br /&gt;
==Interacting with Insts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt;(object_arch, level, x, y, tile_location) = id&lt;br /&gt;
:Spawns a new instance at the specified coordinates and returns its id.&lt;br /&gt;
Note that if &amp;quot;level&amp;quot; is negative, various [[DSB/Special Values|Special Values]] can be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;(id, level, x, y, tile_location)&lt;br /&gt;
:Moves an instance to the specified location. The [[DSB/Special Values|Special Values]] can also be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_reposition&amp;lt;/b&amp;gt;(id, tile_location)&lt;br /&gt;
:Moves an instance to a new tile location on the same tile. Useful for rearranging monsters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Note: &amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt; etc. will not always immediately put the spawned/moved object into position. During the processing of a triggering event (wallitem or flooritem), all spawns and moves will be queued until the end of the processing in order to avoid changing the dungeon state while the triggering objects are still being iterated over. In most cases, the change will not be noticable, but you should be wary of this fact, especially if you are expecting to be able to manipulate the just-moved object in the same function.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move_moncol&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
Allow moving a monster and automatically handle flyer collisions.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_coords&amp;lt;/b&amp;gt;(id) = level, x, y, tile_location&lt;br /&gt;
:Returns the coordinates of an instance. This is either the location in the dungeon, or, using special coordinates, its location in a character or monster&#039;s inventory, in limbo, etc.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt;(level, x, y, tile_location) = id (or table of ids), ~[number]&lt;br /&gt;
:Checks a specified location and returns what&#039;s there. If this is a special coordinate, it is either nil or just an id number. If this is a dungeon location (that is, a level &amp;gt;= 0) or if the special specifier TABLE is used for tile_location, it will return a table of ids. -1 can also be used for the y coordinate when using a special coordinate to return a table of all matching ids, for example, IN_OBJ will give everything inside that object. In these cases, a number is also returned matching the number of instances fetched (but can be ignored if you choose)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_find_arch&amp;lt;/b&amp;gt;(id) = arch&lt;br /&gt;
:Determines the arch of the given instance id. This is often needed in order to access information about the object&#039;s general type.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_swap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Totally destroys the targeted instance and creates a new one at its location with its id number and the new archetype. Things like exvars are not preserved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_qswap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Quick-swaps an instance to a new archetype. That is, it changes only the arch, but no internal variables or exvars. This means that if the new arch is a radically different type, strange things will probably happen and the game might crash. It&#039;s quite handy for making push-buttons that change appearance and such, though.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delete&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Completely destroys an instance from the dungeon.&lt;br /&gt;
In most cases, it is better to send the instance an M_DESTROY message instead.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_facedir&amp;lt;/b&amp;gt;(id) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_facedir&amp;lt;/b&amp;gt;(id, direction)&lt;br /&gt;
:Gets or sets the direction a monster is facing or a flying instance is currently travelling.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_shoot&amp;lt;/b&amp;gt;(id, level, x, y, direction, tile_pos, power, damage, delta, ~[damage_delta])&lt;br /&gt;
:Sends the specified instance flying through the air. It originates at the given level, x, y, and tile_pos, flying in the given direction. Power and damage are variables used by the game to control how far the object flies and how hard it hits. Delta represents how much is subtracted from power each subtile of flight. Delta is also subtracted from damage, unless an optional damage delta is specified instead. When the instance runs out of power, it falls to the ground (or vanishes if &amp;lt;b&amp;gt;flying_only&amp;lt;/b&amp;gt; is set on its archetype)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_flystate&amp;lt;/b&amp;gt;(id) = power, direction, damage&lt;br /&gt;
:Returns the information on a flying instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_openshot&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:This is a minor hack used to specify that the instance has been shot in open space (by a champion or monster, instead of by a wall shooter, for example) and thus should not have collision detection immediately. If this is not set, the instance will instantly run into the character or monster that was supposed to have &amp;quot;launched&amp;quot; it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_collide&amp;lt;/b&amp;gt;(id, lev, x, y, tile, direction) = { {id, tile}, ~[...] }&lt;br /&gt;
:Performs collision detection on a flying object for the specified location. This is useful when directly moving monsters around (e.g., via &amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;) so that they will not apparently move &amp;quot;through&amp;quot; flying missiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_flyreps&amp;lt;/b&amp;gt;(???, ???, ...) = ???&lt;br /&gt;
:Allows you to set the number of update repetitions that a flying object performs per tick. For example, a value of 8 will cause the object to move 8 sub-tiles per tick, or 4 full tiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gfxflag&amp;lt;/b&amp;gt;(id, flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Graphics Flag|Graphics Flag]] for a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charge&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_charge&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets the charge of a given instance. This is normally used by limited-use items but it can have other applications. It is used to set the size of clouds and spells, too. It must be a number from 0 to 63.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_crop&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_crop&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets how much a door is cropped in its display. This is used when they open and close.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawnburst_begin&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_spawnburst_end&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Begins or ends a [[DSB/Spawnburst|Spawnburst]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_push_mouse&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:A shortcut command to push the specified instance into the mouse hand.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_pop_mouse&amp;lt;/b&amp;gt;() = id&lt;br /&gt;
:A shortcut command to pop anything in the mouse hand out, returning its id at the same time.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_valid_inst&amp;lt;/b&amp;gt;(id) = ternary value&lt;br /&gt;
:Returns true if the instance exists, false if it doesn&#039;t but the id is valid, and nil if it is not a valid instance id.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:Creates a new arch type.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Monsters==&lt;br /&gt;
Monsters are insts as well, and (almost?) all commands that affect insts will work just the same on monsters, but monsters have their own specialized functionality as well.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_hp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_hp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s HP. Please note that this function has nothing to do with how to get or set a character&#039;s HP. In addition, the scale used by monster HP is &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; scaled up by a factor of 10.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxhp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxhp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s max HP.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_tint&amp;lt;/b&amp;gt;(id, RGB, ~[intensity])&lt;br /&gt;
:Sets the &#039;tint&#039; of a monster, to give it a glowing effect. Monsters flash when they are hit by various spells.  There is finally an optional intensity level parameter, set at 127 by default with a range of 0 to 255.  0 Being completely black.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai&amp;lt;/b&amp;gt;(id, message, data) ~[= result]&lt;br /&gt;
:Sends an [[DSB/Monster AI|Monster AI]] message to the given monster.&lt;br /&gt;
If data is QUERY then the function will return information on the given value, rather than setting it. For example, dsb_ai(id, AI_FEAR, QUERY) will return the monster&#039;s current level of fear. [[DSB/Monster AI|Monster AI]] documentation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_boss&amp;lt;/b&amp;gt;(id) = boss_id&lt;br /&gt;
:Returns the given monster id&#039;s boss. The &amp;quot;boss&amp;quot; is the monster in each tile who controls when the entire group moves and attacks. This allows DSB monsters to all be distinct entities, but move in DM-style groups.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_promote&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Promotes the given monster id to be the boss of its tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_subordinates&amp;lt;/b&amp;gt;(boss_id) = { {id, tile}, [...] }&lt;br /&gt;
:Returns all monsters who are subordinate to the given boss.&lt;br /&gt;
&lt;br /&gt;
==Messaging==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg&amp;lt;/b&amp;gt;(delay, id, message, data, ~[sender])&lt;br /&gt;
:Sends the specified [[DSB/Messages|Messages]] to the specified instance after the specified delay. Messages are simply integers. The object responds to the message as specified by its msg_handler, defined in its archetype. See &amp;lt;i&amp;gt;base/msg_handlers.lua&amp;lt;/i&amp;gt; for many examples of what can be done with message handlers. Normally it doesn&#039;t matter where a message comes from. However, it is possible to assert the sender of the message, in the rare cases where it is needed. (See [[DSB/Messages]] for more information on how to use messages)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg_chain&amp;lt;/b&amp;gt;(id, target_id)&lt;br /&gt;
:This causes the first instance to relay any messages it receives to the second instance. This is useful for making ceiling pits close at the same time floor pits do, and other situations where an instance should pass messages along.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_msgs_to&amp;lt;/b&amp;gt;(id, delay)&lt;br /&gt;
:Delays all messages bound for a given instance by the specified delay.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_enable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Enables an instance. This will clear its INACTIVE flag as well as make sure any events, triggerings, etc. that should happen do happen. This function is easier and safer to use than setting the flag directly.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_disable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Disables an instance. This will set its INACTIVE flag and make sure that any objects on it stop triggering it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_toggle&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:See the previous two.&lt;br /&gt;
&lt;br /&gt;
==Light==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light&amp;lt;/b&amp;gt;(handle) = lightlevel&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_light&amp;lt;/b&amp;gt;(handle, lightlevel)&lt;br /&gt;
:Gets or sets the light level on the given light handle, which is an integer from 0 to 9. The light level displayed is the sum of the dungeon level&#039;s base light level plus the 10 light handles. Currently, light handle 0 is used for light spells, handle 1 is used for torches, and 2 is used by illumulets.&lt;br /&gt;
&lt;br /&gt;
==Conditions==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_condition&amp;lt;/b&amp;gt;(type, inventory_gfx, portrait_gfx, update_freq, function, ~[flags]) = condition_id&lt;br /&gt;
:Adds a condition (status variable) to the list of those available. The type is either PARTY (affects the whole party) or INDIVIDUAL (affects one person). For individual conditions, two graphics can be specified, one that affects the inventory screen, the other that affects the portrait area. If type is PARTY the third parameter portrait_gfx is now considered as overlay_gfx and will be seen in the dungeon view port.  We can apply an underwater effect for example, as the overlay includes support for alpha channels if you want transparent parts.  &lt;br /&gt;
:If update_freq is &amp;gt; 0, the specified function will be called at the specified number of ticks. The function takes the following form:&lt;br /&gt;
&lt;br /&gt;
   function update_func(char, condition_strength)&lt;br /&gt;
     return new_condition_strength&lt;br /&gt;
   end&lt;br /&gt;
:&lt;br /&gt;
:Flags can be specified to control other aspects of the condition&#039;s appearance on the inventory screen. These flags are COND_MOUTH_RED, COND_MOUTH_GREEN, COND_EYE_RED, and COND_EYE_GREEN. These flags only affect INDIVIDUAL conditions. There was formerly a condition type called BAD_INDIVIDUAL that was an INDIVIDUAL condition with COND_MOUTH_RED. It is now &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;deprecated&amp;lt;/font&amp;gt;. Please don&#039;t use it in new code.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_condition&amp;lt;/b&amp;gt;(condition_id, type, inventory_gfx, portrait_gfx, update_freq, function)&lt;br /&gt;
:Replaces the information for the condition with the given id with the new condition. Good for changing conditions on the fly, but keep in mind that the fact that you&#039;ve changed the condition won&#039;t be saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_condition&amp;lt;/b&amp;gt;(char, condition) = strength&lt;br /&gt;
:Returns the strength of the specified condition for the specified character (or, in the case of conditions for the whole party, pass PARTY as the character)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_condition&amp;lt;/b&amp;gt;(char, condition, strength)&lt;br /&gt;
:Sets the strength of the condition. See previous function.&lt;br /&gt;
&lt;br /&gt;
==Popups and Readouts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_damage_popup&amp;lt;/b&amp;gt;(ppos, damage_type, integer)&lt;br /&gt;
:Shows the amount of damage taken by a character in a little popup over the character&#039;s name or portrait. The type is either HEALTH, STAMINA, or MANA, and a different background icon is displayed for each. The amount of damage shown should be in units as the player perceives them, not internal (so, divided by ten from internal representations)-- the default functions in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt; take care of this for you.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_damage&amp;lt;/b&amp;gt;(integer)&lt;br /&gt;
:This causes a number in a little explosion to appear in the area occupied by the attack icons. This is used for showing the amount of damage inflicted upon a monster by a melee attack.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_text&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:This causes text to momentarily appear in the area occupied by the attack icons. This is used for things like &amp;quot;CAN&#039;T REACH&amp;quot; or &amp;quot;NEED AMMO.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Fullscreen==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;(bitmap_or_func, click_func, update_func, mouse, fade)&lt;br /&gt;
:This engages the full-screen renderer, and is used for cut scenes or other interludes. If the first parameter passed is a bitmap, that bitmap will be displayed. If the first parameter is instead a function, that function will be executed every frame. The draw function will be passed the bitmap to draw to, the mouse&#039;s x location, and the mouse&#039;s y location, in the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;draw_function&amp;lt;/b&amp;gt;(bitmap, mouse_x, mouse_y)&amp;lt;/code&amp;gt;&lt;br /&gt;
:The click_func, if provided, will be executed every time the mouse is clicked. It is of the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;click_func&amp;lt;/b&amp;gt;(mouse_x, mouse_y, mouse_buttons)&amp;lt;/code&amp;gt;&lt;br /&gt;
:Update_func, if provided, will be executed every game tick. It takes no parameters.&lt;br /&gt;
:If mouse is nil or false, no mouse pointer will be drawn. If it is true, the standard &amp;quot;yellow arrow&amp;quot; mouse pointer will be drawn. If it is a bitmap, that bitmap will be drawn as the mouse pointer.&lt;br /&gt;
:There is an optional 5th parameter that allows a fade in/fade out.&lt;br /&gt;
:The full-screen renderer will run until any of its associated functions returns something other than false or nil, and the game logic does not advance while in &amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Subrenderers and System Renderers==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_subrenderer_target&amp;lt;/b&amp;gt;() = bitmap&lt;br /&gt;
:Returns a bitmap to be drawn upon. Use only in a [[DSB/Subrenderers|Subrenderer]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_objzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y)&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer or system bitmap. This object zone can be used to access instances that are stored inside of the given instance. See the implementation of chests in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for more information and examples.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msgzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y, width, height, msg, ~[data1, data2])&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer or system bitmap, with the given width and height. When it is clicked, the specified message will be sent to the instance. This can allow fairly complicated user interfaces in subrenderers.&lt;br /&gt;
:The third parameter, number, allows you to override/replace zones by specifying an existing handle. It also allows msgzones to have more information about where you clicked, because the zone number you clicked is passed as the msg&#039;s data parameter. If you don&#039;t care about any of this, just keep incrementing the number for every new zone. (See [[DSB/Messages]] for more information on how to use messages)&lt;br /&gt;
&lt;br /&gt;
==Global Data, Utility Functions, and Misc.==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gameflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Global Flags|Global Flag]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_hide_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_show_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Functions to make the mouse pointer appear or disappear.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_unlock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
:Functions to lock or unlock the game. Complete locking prevents most timers from running (though animations and delayed functions still will), processing any player input, or triggering anything. If you lock the game and forget to unlock it, it will be left in an unplayable state, so be very careful how you use this! Note that this takes effect immediately (that is, even before any queued moves), which may not always be what you want. You can also lock only certain parts of the game, using the [[DSB/Locking Flags|locking flags]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rand&amp;lt;/b&amp;gt;(min, max) = integer&lt;br /&gt;
:Generates a random integer between min and max, inclusive.&lt;br /&gt;
You should &amp;lt;b&amp;gt;always&amp;lt;/b&amp;gt; use this function for random number generation, not anything built into Lua.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_linesplit&amp;lt;/b&amp;gt;(string, split) = lines, number_of_lines&lt;br /&gt;
:A utility function that splits up a string into individual lines (placing the number of lines returned in number_of_lines) demarcated by the split character. &amp;quot;/&amp;quot; (slash) is a common choice for a a split character. See the implementation of scrolls in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for an example.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_forward&amp;lt;/b&amp;gt;(direction) = x, y&lt;br /&gt;
:A utility function that, given a direction, returns the x and y offsets of which way is &amp;quot;forward.&amp;quot; One will always be 1 or -1, the other will always be 0.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileshift&amp;lt;/b&amp;gt;(location, direction) = location&lt;br /&gt;
:A utility function that shifts the specified location in the specified direction. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lookup_global&amp;lt;/b&amp;gt;(string) = variable&lt;br /&gt;
:Returns the variable named by the specified string. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_func&amp;lt;/b&amp;gt;(delay, function)&lt;br /&gt;
:Executes the given function after the given delay in ticks. References to Lua functions cannot be saved, so queued functions will &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; be saved. This should be something nonvital if the game is not locked, and should happen quickly. In most cases, using a message on a delay, which is saved, would work better.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_inventory_info&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the inventory_info has been changed, this lets the engine know. Note that this state is not saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_system&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the system strings or player colors have been changed, this lets the engine know. This may or may not be useful. With the moving of most inventory rendering into Lua-controlled subrenderers, this function has limited use.&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_export&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:Normally, Lua global variables aren&#039;t saved in savegames, however, a few usually need to be. If you need to store a global variable, add it to the export list with this function. Note that dsb_export requires a string giving the name of the variable. Don&#039;t pass the variable itself! You should also note that if you have a very long export list, you&#039;re probably doing something that could be done more easily with specialized code or more careful use of instances with exvars. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport&amp;lt;/b&amp;gt;(x, y)&lt;br /&gt;
:Sets the viewport. Odds are you should leave this one alone.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_enable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_disable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Enables or disables the specified magical rune for use in spells. All runes are enabled by default, just like in original DM. The rune is specified as an integer, where 1 = LO, 2 = UM, 7 = YA, and so on.&lt;br /&gt;
&lt;br /&gt;
These functions are now deprecated. You should manipulate the &amp;lt;b&amp;gt;g_disabled_runes&amp;lt;/b&amp;gt; table directly. For example, disabling the VI rune (rune 8) is as simple as &amp;lt;code&amp;gt;g_disabled_runes~[8] = false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_game_end&amp;lt;/b&amp;gt;(~[bool])&lt;br /&gt;
:Shows a game ending screen. Normally it&#039;s a bit more fun than the screen you get when the party dies, but if you pass it a boolean &#039;true&#039;, it will just show the standard blue &amp;quot;The End&amp;quot; screen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:This function creates a new arch type, from the original passed in as a parameter.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Pending Documentation==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_msgtype&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_include_file&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_screen_bitmap&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_cache_invalidate&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileptr_exch&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_contains&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_viewing&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_affecting&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_checksound&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gamelocks&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light_total&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_light_totalmax&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_exviewinst&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_import_arch&amp;lt;/b&amp;gt;(???) = [http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=27277&amp;amp;p=83877&amp;amp;hilit=dsb_import_arch#p83877 ?][http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=29188&amp;amp;p=128330&amp;amp;hilit=dsb_import_arch#p128330 ?][http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28859&amp;amp;sid=c8dec8095c76d7ce5937980e94499ceb&amp;amp;p=130029#p130029 ?]&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Exposed functions]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=2974</id>
		<title>DSB/Exposed functions</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=2974"/>
		<updated>2012-11-18T18:33:15Z</updated>

		<summary type="html">&lt;p&gt;Sophia: /* Bitmaps and Drawing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Functions are given in the form:&lt;br /&gt;
;&amp;lt;b&amp;gt;function&amp;lt;/b&amp;gt;(arguments, ~[optional arguments]) = return value&lt;br /&gt;
:If the terminology doesn&#039;t make sense, check [[DSB/Basic DSB Terminology]].&lt;br /&gt;
Functions without a dsb_ prefix are part of [[DSB/Base Code|base/]], not the core engine.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_insts&amp;lt;/b&amp;gt;()&lt;br /&gt;
:This is an iterator used in Lua&#039;s for loops. To iterate over all instances of objects in a DSB dungeon, use something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for i in dsb_insts()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_in_obj&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Another iterator; see above for usage. This one is used to iterate all over all instances that are inside the given instance.&lt;br /&gt;
&lt;br /&gt;
==Bitmaps and Drawing==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name) = bitmap&lt;br /&gt;
:Searches the dungeon&#039;s directory for the bitmap, and then &amp;lt;i&amp;gt;graphics.dsb&amp;lt;/i&amp;gt;, and finally the default &amp;lt;i&amp;gt;graphics.dat&amp;lt;/i&amp;gt;. Returns a truecolor bitmap, but the bitmap can be 256 colors on disk to save space. Don&#039;t specify a file extension as DSB will figure it out.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name, relative_path) = bitmap&lt;br /&gt;
:Same as above but with subdirectories.  Example: &amp;quot;path/to/actual/file.ext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mask_bitmap(name)&amp;lt;/b&amp;gt; = bitmap&lt;br /&gt;
:This function loads a bitmap that requires two distinct regions of transparency that are used at different times, such as see-through door decorations or magic windows. The region that is transparent when the image is first blitted is represented by color 0, whereas the region that is &amp;quot;see through&amp;quot; is in the usual magenta color. This requires a 256 color bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_new_bitmap&amp;lt;/b&amp;gt;(xsize, ysize) = bitmap&lt;br /&gt;
:Creates a brand new bitmap and returns a reference to it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_destroy_bitmap&amp;lt;/b&amp;gt;(bitmap)&lt;br /&gt;
:Completely destroys a bitmap. Rarely needed, as Lua&#039;s garbage collector will automatically scoop up out-of-scope bitmaps. You should only invoke this by hand if you know for sure why you need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_clone_bitmap&amp;lt;/b&amp;gt;(bitmap) = bitmap&lt;br /&gt;
:Creates a &amp;quot;virtual bitmap&amp;quot; clone of the specified bitmap. It shares the same actual memory, but can have different offsets. This is useful if you, for example, have several wallitems for which you want to draw the same image on different parts of the wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_animate&amp;lt;/b&amp;gt;(bitmap, frames, frame_delay)&lt;br /&gt;
:Sets up a bitmap that is a series of frames for animation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_clear&amp;lt;/b&amp;gt;(bitmap, RGB)&lt;br /&gt;
:Clears a bitmap to the specified RGB value. An RGB is specified as a table of { R, G, B }.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_blit&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x_src, y_src, x_dest, y_dest, width, height)&lt;br /&gt;
:Blits one bitmap onto another.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_draw&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x, y, flip)&lt;br /&gt;
:Draws the entire source bitmap on to the destination, taking any animation or offsets into account. Pass true to flip to horizontally flip the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_width&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_bitmap_height&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
:Returns the dimension of the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_rect&amp;lt;/b&amp;gt;(bitmap, x_src, y_src, x_dest, y_dest, color, filled)&lt;br /&gt;
:Draws a rectangle. Pass true to filled for a filled rectangle.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;(bitmap, font, string, x, y, alignment, color) = integer&lt;br /&gt;
:Renders text onto a bitmap in the specified font and color, with the specified alignment: (LEFT, RIGHT, CENTER, or MULTILINE).  Returns the number of lines printed.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_dungeon_view&amp;lt;/b&amp;gt;(lev, x, y, dir, light) = bitmap&lt;br /&gt;
:Return a rendering of the viewport.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport_distort&amp;lt;/b&amp;gt;(effect)&lt;br /&gt;
:For viewport postprocessing&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pixel&amp;lt;/b&amp;gt;(bmp, x, y)&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_pixel&amp;lt;/b&amp;gt;(bmp, x, y, {R,G,B}, [alpha])&lt;br /&gt;
:These are used for per-pixel bitmap manipulation. &lt;br /&gt;
:If the pixel queried with &#039;&#039;&#039;dsb_get_pixel()&#039;&#039;&#039; has an alpha channel, then the function returns two values: the {R,G,B} table, and an extra parameter containing the alpha. If there is no alpha, this second one will be &#039;&#039;&#039;nil&#039;&#039;&#039;. &lt;br /&gt;
:Alpha values for both &#039;&#039;&#039;dsb_get_pixel()&#039;&#039;&#039; and &#039;&#039;&#039;dsb_set_pixel()&#039;&#039;&#039; are in the range 0-255, where 0 is fully transparent and 255 is fully opaque.&lt;br /&gt;
:Here is a short example of how you might use these function to tint a bitmap:&lt;br /&gt;
:http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28859&amp;amp;p=135634#p135634&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;dsb_rgb_to_hsv&amp;lt;/b&amp;gt;({R,G,B}) = {H,S,V}&lt;br /&gt;
:&amp;lt;b&amp;gt;dsb_hsv_to_rgb&amp;lt;/b&amp;gt;({H,S,V}) = {R,G,B}&lt;br /&gt;
:Converts color model.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Fonts and Text==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_font&amp;lt;/b&amp;gt;(name, relative_path) = font&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a font.  Example with a subdirectory: &lt;br /&gt;
:&amp;lt;code&amp;gt;gfx[&amp;quot;GAUDYMEDIEVALFONT&amp;quot;] = dsb_get_font(&amp;quot;GAUDYMEDIEVAL&amp;quot;, &amp;quot;fonts/gaudymedieval.pcx&amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_textformat&amp;lt;/b&amp;gt;(chars_per_line, y_offset_per_line, max_lines)&lt;br /&gt;
:This controls the format of MULTILINE text output by &amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;. The Y offsets are also used by the console (the text below the game view). By setting chars_per_line to something unreasonable, you can effectively disable word wrapping.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_write&amp;lt;/b&amp;gt;(RGB, string)&lt;br /&gt;
:Outputs the given text string in the given color to the console. (that is, a table of { R, G, B })&lt;br /&gt;
&lt;br /&gt;
==Sound and Music==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sound&amp;lt;/b&amp;gt;(name) = sound&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_sound&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound. An optional boolean parameter allows you to specify if the sound should loop. Be careful, the only way to stop a looping sound is via &amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;, so don&#039;t lose the channel handle!&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays a sound file directly from disk instead of loading into memory first. This function only works with direct filenames, you can&#039;t send it a full path -- so your music file must be in the root of your dungeon directoy.  If you use &amp;lt;i&amp;gt;dsb_music&amp;lt;/i&amp;gt;, it will at least load it on demand and destroy it when it&#039;s finished, so your memory usage will be lower than if you loaded it directly as a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_3dsound&amp;lt;/b&amp;gt;(sound, lev, x, y, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound as though it originated from the given location in the dungeon. An optional boolean parameter allows you to specify if the sound should loop. Note that &amp;lt;i&amp;gt;base/util.lua&amp;lt;/i&amp;gt; also includes a useful function, explained next:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;local_sound&amp;lt;/b&amp;gt;(id, sound) = chan_handle&lt;br /&gt;
:Plays a sound that appears to originate from the location of a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music_to_background&amp;lt;/b&amp;gt;(?) = ?&lt;br /&gt;
:Allows multiple music streams.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Stops the sound playing on a channel handle previously returned by a call to a sound playing function.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_soundvol&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Obtains the current volume of the sound, ranging from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_soundvol&amp;lt;/b&amp;gt;(chan_handle, volume) &lt;br /&gt;
:Adjusts the volume of the sound, with the volume range from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
==Levels and Wallsets==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_getinfo&amp;lt;/b&amp;gt;(level) = x_size, y_size, light, xp_multiplier, wallset_name&lt;br /&gt;
:Returns the basic info about a level.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_tint&amp;lt;/b&amp;gt;(level, RGB, ~[level])&lt;br /&gt;
:Tells DSB to tint the dynamically scaled and shaded objects in a level a certain way. By default, this is {0, 0, 0}, causing the dungeon to fade to black, just like DM, but if the ambient light color is different, or you are outdoors and fade to a misty grey instead of black, you will probably want to change this. The third parameter is to control the level of tint applied. The default is 64 but a value of over 200 or so will make everything so dark you can&#039;t see anything.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. Wallsets in DM 2.x ([CSBwin]) are easiest to use with this command, as they have a single very long wall, as opposed to assembling the front view out of &amp;quot;left&amp;quot; and &amp;quot;front&amp;quot; bitmaps. (see the next command)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, left1, left1alt, left2, left2alt, left3, left3alt, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. This command takes 6 more arguments: 6 &amp;quot;left side&amp;quot; bitmaps. If you&#039;re using a converted DM2, [[DSB/DSB for RTC users|DSB for RTC users]], or WHACK wallset, you&#039;ll find this command useful.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_wallset&amp;lt;/b&amp;gt;(level, wallset)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_use_wallset&amp;lt;/b&amp;gt;(level, wallset) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Tells DSB to use the specified wallset on the specified level.&lt;br /&gt;
Note: this function was formerly known as &amp;quot;dsb_use_wallset,&amp;quot; and that is still a synonym for it, for now. In new dungeons, please use the new name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_alt_wallset&amp;lt;/b&amp;gt;(wallset, level, x, y, dir)&lt;br /&gt;
:Tells DSB to use the specified wallset only on the given direction of the given tile. If CENTER is specified, it will use that wallset on all directions of the given tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the roof every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the floor with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a second bitmap name to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the roof with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the roof every other step, like standard roofs, or pass a second bitmap name to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_text2map&amp;lt;/b&amp;gt;(level, x_size, y_size, light, xp_multiplier, maptable)&lt;br /&gt;
:Converts a table with a text-based map into a level. Each row of the table should represent a row of the dungeon, and contain a string with 0&#039;s or 1&#039;s representing walls and floors in that row. In this way, it is very similar to how dungeons are declared in an [[DSB/DSB for RTC users|DSB for RTC users]] text file.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_image2map&amp;lt;/b&amp;gt;(level, filename, light, xp_multiplier) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Converts a bitmap image into a level. One pixel = one square. It must be a 256 color image, where color 0 represents walls, color 1 represents open space, and further colors can be used to represent various objects in the dungeon by means of a conversion table. This function is now mostly deprecated because everyone is using ESB anyway.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_cell&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns a boolean specifying whether or not the given cell in the dungeon is a wall. Use &amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt; to find out anything else about what&#039;s there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_cell&amp;lt;/b&amp;gt;(level, x, y, value)&lt;br /&gt;
:Sets whether the given cell in the dungeon is a wall or open space. A value of nil, false, or 0 represents open space. A value of true or any other integer represents a wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_visited&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns whether the party has visited the given dungeon cell. A wall will never be visited, unless it wasn&#039;t a wall at some point in the past.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp_multiplier&amp;lt;/b&amp;gt;(level) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp_multiplier&amp;lt;/b&amp;gt;(level, integer)&lt;br /&gt;
:Gets or sets the XP multiplier for a given level of the dungeon.&lt;br /&gt;
&lt;br /&gt;
==Characters==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_champion&amp;lt;/b&amp;gt;(portrait_gfxname, first_name, last_name, health, stamina, mana, strength, dexterity, wisdom, vitality, anti-magic, anti-fire, luck, fighter_level, ninja_level, priest_level, wizard_level) = char_id&lt;br /&gt;
:Adds a character to the roster and returns his/her id number, which can then be used for adjusting various stats or putting items in his/her pack. Note that the internal representations of the three bars and the 7 statistics are 10 times what is actually displayed. (That is, 100 health in-game is represented by 1000)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_offer_champion&amp;lt;/b&amp;gt;(char_id, mode, take_function)&lt;br /&gt;
:Offers the given char_id, with the options specified by &amp;quot;mode&amp;quot; available.&lt;br /&gt;
:~[1 = resurrect, 2 = reincarnate, 3 = both]. The take_function is a Lua function that is executed if the offered character is resurrected or reincarnated. It is typically used to clear out the champion&#039;s mirror, or do something else to denote that the character is no longer available.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_toparty&amp;lt;/b&amp;gt;(ppos, char)&lt;br /&gt;
:Adds the specified character at the specified party position. (Unlike dsb_offer_champion the player is given no choice, the character is just added) It will fail silently if that position is already occupied.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_fromparty&amp;lt;/b&amp;gt;(ppos)&lt;br /&gt;
:Removes anyone at the specified party position. It will fail silently if no one is there. If the party is reduced to nothing, the game will revert to &amp;quot;ghost mode.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charname&amp;lt;/b&amp;gt;(char) = string&lt;br /&gt;
:Returns the character&#039;s name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s three bars. (HEALTH, STAMINA or MANA)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_stat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_stat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s stats. (STAT_STR, STAT_DEX, STAT_WIS, STAT_VIT, STAT_AMA, STAT_AFI, STAT_LUC)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxbar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxbar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxstat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxstat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:As above, only pertaining to maximum values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;do_damage(ppos, char, type, amount)&amp;lt;/b&amp;gt;&lt;br /&gt;
:This function will damage the given character at the given ppos the given amount of the given type (HEALTH, STAMINA, or MANA). The units specified here are as the player perceives them (that is, divided by ten from internal representations and the same scale used by monsters)&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_load&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxload&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
:Returns the load or max load of a given character.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_food&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_food&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_water&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_water&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
:Get or set the character&#039;s food and water values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_injury&amp;lt;/b&amp;gt;(char, location) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_injury&amp;lt;/b&amp;gt;(char, location, integer)&lt;br /&gt;
:Gets or sets the amount of injury a given location on the given character has sustained. This number is 0 if the location is uninjured and can go up to 100, but anything nonzero will highlight it in red and use the &amp;quot;bandaged&amp;quot; bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_portrait&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:Replaces the portrait of a character with the given image. This can happen on-the-fly at any time. Note that the portrait must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;portrait&amp;quot;, not gfx.portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_portraitname&amp;lt;/b&amp;gt;(char) = portrait_name&lt;br /&gt;
:Retrieves the name of a character&#039;s portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_portraitname&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:An alias for dsb_replace_portrait (for symmetry).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_topimages&amp;lt;/b&amp;gt;(char, hands_image_name, portrait_background_image_name, death_image_name)&lt;br /&gt;
:Replaces the top &amp;quot;hands&amp;quot;, &amp;quot;portrait background&amp;quot; and &amp;quot;death&amp;quot; images.  Pass the image names nil to leave the image alone, or 0 to go back to the default.  Remember that we pass the image parameters as strings, and not a direct reference to the &#039;&#039;gfx&#039;&#039; table.  Example: &#039;&#039;dsb_replace_topimages(char, nil, nil, &amp;quot;frozen_face_halk&amp;quot;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_charhand&amp;lt;/b&amp;gt;(char, hand_name)&lt;br /&gt;
:Replaces the &amp;quot;hand&amp;quot; of a character with the given image. This can happen on-the-fly at any time. Note that the image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;hand_image&amp;quot;, not gfx.hand_image.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_inventory&amp;lt;/b&amp;gt;(char, inventory_image_name)&lt;br /&gt;
:Replaces the inventory background of a character with the given image. This can happen on-the-fly at any time. Note that the background image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;inventory&amp;quot;, not gfx.inventory.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_methods&amp;lt;/b&amp;gt;(char, methods_table_name)&lt;br /&gt;
:Replaces the default attack methods of a character with the given table of methods, or function returning a table. This can happen on-the-fly at any time. Note that the method table or function must be specified by name as a string, not as an actual table. It must a single global variable (not be contained in any other table).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_xp_level&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_xp_level_nobonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
:These functions return the character&#039;s level of mastery at a certain skill (a class such as &#039;ninja&#039;) and subskill (or 0 for no subskill). The &amp;quot;nobonus&amp;quot; form does not take temporary XP or level-boosting items into account.  All references to the &amp;lt;i&amp;gt;dsb_xp_level&amp;lt;/i&amp;gt; call are wrapped by function &amp;lt;i&amp;gt;determine_xp_level(char, class, subskill)&amp;lt;/i&amp;gt; so that [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28487&amp;amp;p=106622#p106622 it can be overridden].&lt;br /&gt;
  &lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_give_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gives the specified amount of XP in the specified skill and subskill (or 0 for no subskill).&lt;br /&gt;
:Important: This function gives XP only. It doesn&#039;t deal with XP multipliers, leveling up, bonuses, or anything else.&lt;br /&gt;
:More useful to most designers will be the helper function &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:This function takes XP multipliers, leveling up, etc. into account.&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/xp.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets the character&#039;s amount of experience directly. Setting XP directly doesn&#039;t do anything with stats, leveling up or down, or anything of that sort, so it is of limited use unless you really know what you&#039;re doing.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets a temporary XP bonus. This, too, is handled by &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt; automatically.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bonus&amp;lt;/b&amp;gt;(char, skill, subskill, integer)&lt;br /&gt;
:Gets or sets a level bonus associated with a given skill or subskill (or 0 for no subskill), such as what may be given by a magic item held in hand or worn around the neck.&lt;br /&gt;
&lt;br /&gt;
==The Party==&lt;br /&gt;
Many of these commands include optional support for [[DSB/Multiple Parties|Multiple Parties]]. In a standard DM dungeon, you can ignore all of that.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt;(~[party]) = level, x, y, facing&lt;br /&gt;
:Returns the ~[specified] party&#039;s location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_at&amp;lt;/b&amp;gt;(level, x, y) = party&lt;br /&gt;
:Returns which party is at a specified location, or nil if no party is there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_place&amp;lt;/b&amp;gt;(level, x, y, facing, ~[party])&lt;br /&gt;
:Places the ~[specified] party at a specific location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pfacing&amp;lt;/b&amp;gt;(ppos) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_pfacing&amp;lt;/b&amp;gt;(ppos, direction)&lt;br /&gt;
:Get or set the direction a given party position is facing relative to the rest of the party. (This changes when the members are attacked from monsters to the sides or behind)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_idle&amp;lt;/b&amp;gt;(ppos) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_idle&amp;lt;/b&amp;gt;(ppos, integer)&lt;br /&gt;
:Gets or sets the amount of time the given party position must be idle (that is, the attack method icons are ghosted). Note that these take party positions, not character numbers.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_leader&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:Returns the party position of the party&#039;s leader.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_char&amp;lt;/b&amp;gt;(ppos, ~[party]) = char&lt;br /&gt;
:Returns the character at the given party position, or nil if there isn&#039;t one.&lt;br /&gt;
If a party is specified, that party will be searched. If there is no party specified, only the current party will be searched. To search all parties, specify VARIABLE as the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_char_ppos&amp;lt;/b&amp;gt;(char) = ppos&lt;br /&gt;
:Returns the party position a given character occupies, or nil if he/she isn&#039;t in the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_tile&amp;lt;/b&amp;gt;(ppos, ~[party]) = tile_dir&lt;br /&gt;
:Returns the tile location that the given party position occupies.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tile_ppos(tile_dir, ~[party])&amp;lt;/b&amp;gt; = ppos&lt;br /&gt;
:Returns the party position occupied by the given tile location, or nil if nobody is there.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sleepstate&amp;lt;/b&amp;gt;() = boolean&lt;br /&gt;
:Returns whether or not the party is asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wakeup&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Wakes up the party if they are asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_current_inventory&amp;gt;&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:If someone&#039;s inventory is being looked at, this returns the party position of the character that is being looked at. Otherwise, it returns nil.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lastmethod&amp;lt;/b&amp;gt;(ppos) = method, location, inst&lt;br /&gt;
:Returns the last attack method invoked by the given ppos.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_scanfor&amp;lt;/b&amp;gt;(arch) = id&lt;br /&gt;
:Scans the entire party&#039;s inventory for a given arch. Returns the id for the first instance of that arch if it is found, or nil if nothing is found.&lt;br /&gt;
&lt;br /&gt;
==Multiple Parties==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mpartyflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Multiple Parties|Multiple Parties]] flag.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_exviewinst&amp;lt;/b&amp;gt;(char, monster_id)&lt;br /&gt;
:This will associate a given monster inst with a character. The monster must be in LIMBO. From then on, whenever that character is seen from a 3rd person perspective, that monster will be drawn to represent that character. Don&#039;t kill this monster or bad things will happen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_apush&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_party_apop&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
:The game uses a &amp;quot;party stack&amp;quot; to keep track of which sub-party the various party-related commands affect. The currently viewed party is always at the bottom. When a party steps on a trigger, it is pushed onto the stack before the trigger is processed. This means things like &amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt; will generally affect the &amp;quot;right&amp;quot; party. You can directly manipulate the stack with these commands, but be careful. If you&#039;re not sure what to do with these commands, you probably don&#039;t need them.&lt;br /&gt;
&lt;br /&gt;
==Interacting with Insts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt;(object_arch, level, x, y, tile_location) = id&lt;br /&gt;
:Spawns a new instance at the specified coordinates and returns its id.&lt;br /&gt;
Note that if &amp;quot;level&amp;quot; is negative, various [[DSB/Special Values|Special Values]] can be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;(id, level, x, y, tile_location)&lt;br /&gt;
:Moves an instance to the specified location. The [[DSB/Special Values|Special Values]] can also be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_reposition&amp;lt;/b&amp;gt;(id, tile_location)&lt;br /&gt;
:Moves an instance to a new tile location on the same tile. Useful for rearranging monsters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Note: &amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt; etc. will not always immediately put the spawned/moved object into position. During the processing of a triggering event (wallitem or flooritem), all spawns and moves will be queued until the end of the processing in order to avoid changing the dungeon state while the triggering objects are still being iterated over. In most cases, the change will not be noticable, but you should be wary of this fact, especially if you are expecting to be able to manipulate the just-moved object in the same function.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move_moncol&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
Allow moving a monster and automatically handle flyer collisions.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_coords&amp;lt;/b&amp;gt;(id) = level, x, y, tile_location&lt;br /&gt;
:Returns the coordinates of an instance. This is either the location in the dungeon, or, using special coordinates, its location in a character or monster&#039;s inventory, in limbo, etc.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt;(level, x, y, tile_location) = id (or table of ids), ~[number]&lt;br /&gt;
:Checks a specified location and returns what&#039;s there. If this is a special coordinate, it is either nil or just an id number. If this is a dungeon location (that is, a level &amp;gt;= 0) or if the special specifier TABLE is used for tile_location, it will return a table of ids. -1 can also be used for the y coordinate when using a special coordinate to return a table of all matching ids, for example, IN_OBJ will give everything inside that object. In these cases, a number is also returned matching the number of instances fetched (but can be ignored if you choose)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_find_arch&amp;lt;/b&amp;gt;(id) = arch&lt;br /&gt;
:Determines the arch of the given instance id. This is often needed in order to access information about the object&#039;s general type.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_swap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Totally destroys the targeted instance and creates a new one at its location with its id number and the new archetype. Things like exvars are not preserved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_qswap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Quick-swaps an instance to a new archetype. That is, it changes only the arch, but no internal variables or exvars. This means that if the new arch is a radically different type, strange things will probably happen and the game might crash. It&#039;s quite handy for making push-buttons that change appearance and such, though.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delete&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Completely destroys an instance from the dungeon.&lt;br /&gt;
In most cases, it is better to send the instance an M_DESTROY message instead.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_facedir&amp;lt;/b&amp;gt;(id) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_facedir&amp;lt;/b&amp;gt;(id, direction)&lt;br /&gt;
:Gets or sets the direction a monster is facing or a flying instance is currently travelling.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_shoot&amp;lt;/b&amp;gt;(id, level, x, y, direction, tile_pos, power, damage, delta, ~[damage_delta])&lt;br /&gt;
:Sends the specified instance flying through the air. It originates at the given level, x, y, and tile_pos, flying in the given direction. Power and damage are variables used by the game to control how far the object flies and how hard it hits. Delta represents how much is subtracted from power each subtile of flight. Delta is also subtracted from damage, unless an optional damage delta is specified instead. When the instance runs out of power, it falls to the ground (or vanishes if &amp;lt;b&amp;gt;flying_only&amp;lt;/b&amp;gt; is set on its archetype)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_flystate&amp;lt;/b&amp;gt;(id) = power, direction, damage&lt;br /&gt;
:Returns the information on a flying instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_openshot&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:This is a minor hack used to specify that the instance has been shot in open space (by a champion or monster, instead of by a wall shooter, for example) and thus should not have collision detection immediately. If this is not set, the instance will instantly run into the character or monster that was supposed to have &amp;quot;launched&amp;quot; it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_collide&amp;lt;/b&amp;gt;(id, lev, x, y, tile, direction) = { {id, tile}, ~[...] }&lt;br /&gt;
:Performs collision detection on a flying object for the specified location. This is useful when directly moving monsters around (e.g., via &amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;) so that they will not apparently move &amp;quot;through&amp;quot; flying missiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_flyreps&amp;lt;/b&amp;gt;(???, ???, ...) = ???&lt;br /&gt;
:Allows you to set the number of update repetitions that a flying object performs per tick. For example, a value of 8 will cause the object to move 8 sub-tiles per tick, or 4 full tiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gfxflag&amp;lt;/b&amp;gt;(id, flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Graphics Flag|Graphics Flag]] for a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charge&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_charge&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets the charge of a given instance. This is normally used by limited-use items but it can have other applications. It is used to set the size of clouds and spells, too. It must be a number from 0 to 63.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_crop&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_crop&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets how much a door is cropped in its display. This is used when they open and close.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawnburst_begin&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_spawnburst_end&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Begins or ends a [[DSB/Spawnburst|Spawnburst]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_push_mouse&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:A shortcut command to push the specified instance into the mouse hand.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_pop_mouse&amp;lt;/b&amp;gt;() = id&lt;br /&gt;
:A shortcut command to pop anything in the mouse hand out, returning its id at the same time.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_valid_inst&amp;lt;/b&amp;gt;(id) = ternary value&lt;br /&gt;
:Returns true if the instance exists, false if it doesn&#039;t but the id is valid, and nil if it is not a valid instance id.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:Creates a new arch type.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Monsters==&lt;br /&gt;
Monsters are insts as well, and (almost?) all commands that affect insts will work just the same on monsters, but monsters have their own specialized functionality as well.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_hp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_hp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s HP. Please note that this function has nothing to do with how to get or set a character&#039;s HP. In addition, the scale used by monster HP is &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; scaled up by a factor of 10.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxhp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxhp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s max HP.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_tint&amp;lt;/b&amp;gt;(id, RGB, ~[intensity])&lt;br /&gt;
:Sets the &#039;tint&#039; of a monster, to give it a glowing effect. Monsters flash when they are hit by various spells.  There is finally an optional intensity level parameter, set at 127 by default with a range of 0 to 255.  0 Being completely black.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai&amp;lt;/b&amp;gt;(id, message, data) ~[= result]&lt;br /&gt;
:Sends an [[DSB/Monster AI|Monster AI]] message to the given monster.&lt;br /&gt;
If data is QUERY then the function will return information on the given value, rather than setting it. For example, dsb_ai(id, AI_FEAR, QUERY) will return the monster&#039;s current level of fear. [[DSB/Monster AI|Monster AI]] documentation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_boss&amp;lt;/b&amp;gt;(id) = boss_id&lt;br /&gt;
:Returns the given monster id&#039;s boss. The &amp;quot;boss&amp;quot; is the monster in each tile who controls when the entire group moves and attacks. This allows DSB monsters to all be distinct entities, but move in DM-style groups.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_promote&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Promotes the given monster id to be the boss of its tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_subordinates&amp;lt;/b&amp;gt;(boss_id) = { {id, tile}, [...] }&lt;br /&gt;
:Returns all monsters who are subordinate to the given boss.&lt;br /&gt;
&lt;br /&gt;
==Messaging==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg&amp;lt;/b&amp;gt;(delay, id, message, data, ~[sender])&lt;br /&gt;
:Sends the specified [[DSB/Messages|Messages]] to the specified instance after the specified delay. Messages are simply integers. The object responds to the message as specified by its msg_handler, defined in its archetype. See &amp;lt;i&amp;gt;base/msg_handlers.lua&amp;lt;/i&amp;gt; for many examples of what can be done with message handlers. Normally it doesn&#039;t matter where a message comes from. However, it is possible to assert the sender of the message, in the rare cases where it is needed. (See [[DSB/Messages]] for more information on how to use messages)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg_chain&amp;lt;/b&amp;gt;(id, target_id)&lt;br /&gt;
:This causes the first instance to relay any messages it receives to the second instance. This is useful for making ceiling pits close at the same time floor pits do, and other situations where an instance should pass messages along.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_msgs_to&amp;lt;/b&amp;gt;(id, delay)&lt;br /&gt;
:Delays all messages bound for a given instance by the specified delay.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_enable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Enables an instance. This will clear its INACTIVE flag as well as make sure any events, triggerings, etc. that should happen do happen. This function is easier and safer to use than setting the flag directly.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_disable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Disables an instance. This will set its INACTIVE flag and make sure that any objects on it stop triggering it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_toggle&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:See the previous two.&lt;br /&gt;
&lt;br /&gt;
==Light==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light&amp;lt;/b&amp;gt;(handle) = lightlevel&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_light&amp;lt;/b&amp;gt;(handle, lightlevel)&lt;br /&gt;
:Gets or sets the light level on the given light handle, which is an integer from 0 to 9. The light level displayed is the sum of the dungeon level&#039;s base light level plus the 10 light handles. Currently, light handle 0 is used for light spells, handle 1 is used for torches, and 2 is used by illumulets.&lt;br /&gt;
&lt;br /&gt;
==Conditions==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_condition&amp;lt;/b&amp;gt;(type, inventory_gfx, portrait_gfx, update_freq, function, ~[flags]) = condition_id&lt;br /&gt;
:Adds a condition (status variable) to the list of those available. The type is either PARTY (affects the whole party) or INDIVIDUAL (affects one person). For individual conditions, two graphics can be specified, one that affects the inventory screen, the other that affects the portrait area. If type is PARTY the third parameter portrait_gfx is now considered as overlay_gfx and will be seen in the dungeon view port.  We can apply an underwater effect for example, as the overlay includes support for alpha channels if you want transparent parts.  &lt;br /&gt;
:If update_freq is &amp;gt; 0, the specified function will be called at the specified number of ticks. The function takes the following form:&lt;br /&gt;
&lt;br /&gt;
   function update_func(char, condition_strength)&lt;br /&gt;
     return new_condition_strength&lt;br /&gt;
   end&lt;br /&gt;
:&lt;br /&gt;
:Flags can be specified to control other aspects of the condition&#039;s appearance on the inventory screen. These flags are COND_MOUTH_RED, COND_MOUTH_GREEN, COND_EYE_RED, and COND_EYE_GREEN. These flags only affect INDIVIDUAL conditions. There was formerly a condition type called BAD_INDIVIDUAL that was an INDIVIDUAL condition with COND_MOUTH_RED. It is now &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;deprecated&amp;lt;/font&amp;gt;. Please don&#039;t use it in new code.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_condition&amp;lt;/b&amp;gt;(condition_id, type, inventory_gfx, portrait_gfx, update_freq, function)&lt;br /&gt;
:Replaces the information for the condition with the given id with the new condition. Good for changing conditions on the fly, but keep in mind that the fact that you&#039;ve changed the condition won&#039;t be saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_condition&amp;lt;/b&amp;gt;(char, condition) = strength&lt;br /&gt;
:Returns the strength of the specified condition for the specified character (or, in the case of conditions for the whole party, pass PARTY as the character)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_condition&amp;lt;/b&amp;gt;(char, condition, strength)&lt;br /&gt;
:Sets the strength of the condition. See previous function.&lt;br /&gt;
&lt;br /&gt;
==Popups and Readouts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_damage_popup&amp;lt;/b&amp;gt;(ppos, damage_type, integer)&lt;br /&gt;
:Shows the amount of damage taken by a character in a little popup over the character&#039;s name or portrait. The type is either HEALTH, STAMINA, or MANA, and a different background icon is displayed for each. The amount of damage shown should be in units as the player perceives them, not internal (so, divided by ten from internal representations)-- the default functions in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt; take care of this for you.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_damage&amp;lt;/b&amp;gt;(integer)&lt;br /&gt;
:This causes a number in a little explosion to appear in the area occupied by the attack icons. This is used for showing the amount of damage inflicted upon a monster by a melee attack.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_text&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:This causes text to momentarily appear in the area occupied by the attack icons. This is used for things like &amp;quot;CAN&#039;T REACH&amp;quot; or &amp;quot;NEED AMMO.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Fullscreen==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;(bitmap_or_func, click_func, update_func, mouse, fade)&lt;br /&gt;
:This engages the full-screen renderer, and is used for cut scenes or other interludes. If the first parameter passed is a bitmap, that bitmap will be displayed. If the first parameter is instead a function, that function will be executed every frame. The draw function will be passed the bitmap to draw to, the mouse&#039;s x location, and the mouse&#039;s y location, in the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;draw_function&amp;lt;/b&amp;gt;(bitmap, mouse_x, mouse_y)&amp;lt;/code&amp;gt;&lt;br /&gt;
:The click_func, if provided, will be executed every time the mouse is clicked. It is of the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;click_func&amp;lt;/b&amp;gt;(mouse_x, mouse_y, mouse_buttons)&amp;lt;/code&amp;gt;&lt;br /&gt;
:Update_func, if provided, will be executed every game tick. It takes no parameters.&lt;br /&gt;
:If mouse is nil or false, no mouse pointer will be drawn. If it is true, the standard &amp;quot;yellow arrow&amp;quot; mouse pointer will be drawn. If it is a bitmap, that bitmap will be drawn as the mouse pointer.&lt;br /&gt;
:There is an optional 5th parameter that allows a fade in/fade out.&lt;br /&gt;
:The full-screen renderer will run until any of its associated functions returns something other than false or nil, and the game logic does not advance while in &amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Subrenderers and System Renderers==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_subrenderer_target&amp;lt;/b&amp;gt;() = bitmap&lt;br /&gt;
:Returns a bitmap to be drawn upon. Use only in a [[DSB/Subrenderers|Subrenderer]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_objzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y)&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer or system bitmap. This object zone can be used to access instances that are stored inside of the given instance. See the implementation of chests in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for more information and examples.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msgzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y, width, height, msg, ~[data1, data2])&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer or system bitmap, with the given width and height. When it is clicked, the specified message will be sent to the instance. This can allow fairly complicated user interfaces in subrenderers.&lt;br /&gt;
:The third parameter, number, allows you to override/replace zones by specifying an existing handle. It also allows msgzones to have more information about where you clicked, because the zone number you clicked is passed as the msg&#039;s data parameter. If you don&#039;t care about any of this, just keep incrementing the number for every new zone. (See [[DSB/Messages]] for more information on how to use messages)&lt;br /&gt;
&lt;br /&gt;
==Global Data, Utility Functions, and Misc.==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gameflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Global Flags|Global Flag]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_hide_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_show_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Functions to make the mouse pointer appear or disappear.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_unlock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
:Functions to lock or unlock the game. Complete locking prevents most timers from running (though animations and delayed functions still will), processing any player input, or triggering anything. If you lock the game and forget to unlock it, it will be left in an unplayable state, so be very careful how you use this! Note that this takes effect immediately (that is, even before any queued moves), which may not always be what you want. You can also lock only certain parts of the game, using the [[DSB/Locking Flags|locking flags]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rand&amp;lt;/b&amp;gt;(min, max) = integer&lt;br /&gt;
:Generates a random integer between min and max, inclusive.&lt;br /&gt;
You should &amp;lt;b&amp;gt;always&amp;lt;/b&amp;gt; use this function for random number generation, not anything built into Lua.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_linesplit&amp;lt;/b&amp;gt;(string, split) = lines, number_of_lines&lt;br /&gt;
:A utility function that splits up a string into individual lines (placing the number of lines returned in number_of_lines) demarcated by the split character. &amp;quot;/&amp;quot; (slash) is a common choice for a a split character. See the implementation of scrolls in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for an example.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_forward&amp;lt;/b&amp;gt;(direction) = x, y&lt;br /&gt;
:A utility function that, given a direction, returns the x and y offsets of which way is &amp;quot;forward.&amp;quot; One will always be 1 or -1, the other will always be 0.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileshift&amp;lt;/b&amp;gt;(location, direction) = location&lt;br /&gt;
:A utility function that shifts the specified location in the specified direction. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lookup_global&amp;lt;/b&amp;gt;(string) = variable&lt;br /&gt;
:Returns the variable named by the specified string. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_func&amp;lt;/b&amp;gt;(delay, function)&lt;br /&gt;
:Executes the given function after the given delay in ticks. References to Lua functions cannot be saved, so queued functions will &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; be saved. This should be something nonvital if the game is not locked, and should happen quickly. In most cases, using a message on a delay, which is saved, would work better.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_inventory_info&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the inventory_info has been changed, this lets the engine know. Note that this state is not saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_system&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the system strings or player colors have been changed, this lets the engine know. This may or may not be useful. With the moving of most inventory rendering into Lua-controlled subrenderers, this function has limited use.&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_export&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:Normally, Lua global variables aren&#039;t saved in savegames, however, a few usually need to be. If you need to store a global variable, add it to the export list with this function. Note that dsb_export requires a string giving the name of the variable. Don&#039;t pass the variable itself! You should also note that if you have a very long export list, you&#039;re probably doing something that could be done more easily with specialized code or more careful use of instances with exvars. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport&amp;lt;/b&amp;gt;(x, y)&lt;br /&gt;
:Sets the viewport. Odds are you should leave this one alone.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_enable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_disable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Enables or disables the specified magical rune for use in spells. All runes are enabled by default, just like in original DM. The rune is specified as an integer, where 1 = LO, 2 = UM, 7 = YA, and so on.&lt;br /&gt;
&lt;br /&gt;
These functions are now deprecated. You should manipulate the &amp;lt;b&amp;gt;g_disabled_runes&amp;lt;/b&amp;gt; table directly. For example, disabling the VI rune (rune 8) is as simple as &amp;lt;code&amp;gt;g_disabled_runes~[8] = false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_game_end&amp;lt;/b&amp;gt;(~[bool])&lt;br /&gt;
:Shows a game ending screen. Normally it&#039;s a bit more fun than the screen you get when the party dies, but if you pass it a boolean &#039;true&#039;, it will just show the standard blue &amp;quot;The End&amp;quot; screen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:This function creates a new arch type, from the original passed in as a parameter.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Pending Documentation==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_msgtype&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_include_file&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_screen_bitmap&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_cache_invalidate&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileptr_exch&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_contains&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_viewing&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_affecting&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_checksound&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gamelocks&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light_total&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_light_totalmax&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_exviewinst&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_import_arch&amp;lt;/b&amp;gt;(???) = [http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=27277&amp;amp;p=83877&amp;amp;hilit=dsb_import_arch#p83877 ?][http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=29188&amp;amp;p=128330&amp;amp;hilit=dsb_import_arch#p128330 ?][http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28859&amp;amp;sid=c8dec8095c76d7ce5937980e94499ceb&amp;amp;p=130029#p130029 ?]&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Exposed functions]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=2971</id>
		<title>DSB/Exposed functions</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=2971"/>
		<updated>2012-11-13T23:07:34Z</updated>

		<summary type="html">&lt;p&gt;Sophia: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Functions are given in the form:&lt;br /&gt;
;&amp;lt;b&amp;gt;function&amp;lt;/b&amp;gt;(arguments, ~[optional arguments]) = return value&lt;br /&gt;
:If the terminology doesn&#039;t make sense, check [[DSB/Basic DSB Terminology]].&lt;br /&gt;
Functions without a dsb_ prefix are part of [[DSB/Base Code|base/]], not the core engine.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_insts&amp;lt;/b&amp;gt;()&lt;br /&gt;
:This is an iterator used in Lua&#039;s for loops. To iterate over all instances of objects in a DSB dungeon, use something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for i in dsb_insts()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_in_obj&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Another iterator; see above for usage. This one is used to iterate all over all instances that are inside the given instance.&lt;br /&gt;
&lt;br /&gt;
==Bitmaps and Drawing==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name) = bitmap&lt;br /&gt;
:Searches the dungeon&#039;s directory for the bitmap, and then &amp;lt;i&amp;gt;graphics.dsb&amp;lt;/i&amp;gt;, and finally the default &amp;lt;i&amp;gt;graphics.dat&amp;lt;/i&amp;gt;. Returns a truecolor bitmap, but the bitmap can be 256 colors on disk to save space. Don&#039;t specify a file extension as DSB will figure it out.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name, relative_path) = bitmap&lt;br /&gt;
:Same as above but with subdirectories.  Example: &amp;quot;path/to/actual/file.ext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mask_bitmap(name)&amp;lt;/b&amp;gt; = bitmap&lt;br /&gt;
:This function loads a bitmap that requires two distinct regions of transparency that are used at different times, such as see-through door decorations or magic windows. The region that is transparent when the image is first blitted is represented by color 0, whereas the region that is &amp;quot;see through&amp;quot; is in the usual magenta color. This requires a 256 color bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_new_bitmap&amp;lt;/b&amp;gt;(xsize, ysize) = bitmap&lt;br /&gt;
:Creates a brand new bitmap and returns a reference to it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_destroy_bitmap&amp;lt;/b&amp;gt;(bitmap)&lt;br /&gt;
:Completely destroys a bitmap. Rarely needed, as Lua&#039;s garbage collector will automatically scoop up out-of-scope bitmaps. You should only invoke this by hand if you know for sure why you need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_clone_bitmap&amp;lt;/b&amp;gt;(bitmap) = bitmap&lt;br /&gt;
:Creates a &amp;quot;virtual bitmap&amp;quot; clone of the specified bitmap. It shares the same actual memory, but can have different offsets. This is useful if you, for example, have several wallitems for which you want to draw the same image on different parts of the wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_animate&amp;lt;/b&amp;gt;(bitmap, frames, frame_delay)&lt;br /&gt;
:Sets up a bitmap that is a series of frames for animation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_clear&amp;lt;/b&amp;gt;(bitmap, RGB)&lt;br /&gt;
:Clears a bitmap to the specified RGB value. An RGB is specified as a table of { R, G, B }.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_blit&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x_src, y_src, x_dest, y_dest, width, height)&lt;br /&gt;
:Blits one bitmap onto another.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_draw&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x, y, flip)&lt;br /&gt;
:Draws the entire source bitmap on to the destination, taking any animation or offsets into account. Pass true to flip to horizontally flip the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_width&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_bitmap_height&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
:Returns the dimension of the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_rect&amp;lt;/b&amp;gt;(bitmap, x_src, y_src, x_dest, y_dest, color, filled)&lt;br /&gt;
:Draws a rectangle. Pass true to filled for a filled rectangle.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;(bitmap, font, string, x, y, alignment, color) = integer&lt;br /&gt;
:Renders text onto a bitmap in the specified font and color, with the specified alignment: (LEFT, RIGHT, CENTER, or MULTILINE).  Returns the number of lines printed.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_dungeon_view&amp;lt;/b&amp;gt;(lev, x, y, dir, light) = bitmap&lt;br /&gt;
:Return a rendering of the viewport.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport_distort&amp;lt;/b&amp;gt;(effect)&lt;br /&gt;
:For viewport postprocessing&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pixel&amp;lt;/b&amp;gt;(bmp, x, y) and &amp;lt;b&amp;gt;dsb_set_pixel&amp;lt;/b&amp;gt;(bmp, x, y, rgb, [alpha])&lt;br /&gt;
:These are used for per-pixel bitmap manipulation&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Fonts and Text==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_font&amp;lt;/b&amp;gt;(name, relative_path) = font&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a font.  Example with a subdirectory: &lt;br /&gt;
:&amp;lt;code&amp;gt;gfx[&amp;quot;GAUDYMEDIEVALFONT&amp;quot;] = dsb_get_font(&amp;quot;GAUDYMEDIEVAL&amp;quot;, &amp;quot;fonts/gaudymedieval.pcx&amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_textformat&amp;lt;/b&amp;gt;(chars_per_line, y_offset_per_line, max_lines)&lt;br /&gt;
:This controls the format of MULTILINE text output by &amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;. The Y offsets are also used by the console (the text below the game view). By setting chars_per_line to something unreasonable, you can effectively disable word wrapping.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_write&amp;lt;/b&amp;gt;(RGB, string)&lt;br /&gt;
:Outputs the given text string in the given color to the console. (that is, a table of { R, G, B })&lt;br /&gt;
&lt;br /&gt;
==Sound and Music==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sound&amp;lt;/b&amp;gt;(name) = sound&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_sound&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound. An optional boolean parameter allows you to specify if the sound should loop. Be careful, the only way to stop a looping sound is via &amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;, so don&#039;t lose the channel handle!&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays a sound file directly from disk instead of loading into memory first. This function only works with direct filenames, you can&#039;t send it a full path -- so your music file must be in the root of your dungeon directoy.  If you use &amp;lt;i&amp;gt;dsb_music&amp;lt;/i&amp;gt;, it will at least load it on demand and destroy it when it&#039;s finished, so your memory usage will be lower than if you loaded it directly as a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_3dsound&amp;lt;/b&amp;gt;(sound, lev, x, y, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound as though it originated from the given location in the dungeon. An optional boolean parameter allows you to specify if the sound should loop. Note that &amp;lt;i&amp;gt;base/util.lua&amp;lt;/i&amp;gt; also includes a useful function, explained next:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;local_sound&amp;lt;/b&amp;gt;(id, sound) = chan_handle&lt;br /&gt;
:Plays a sound that appears to originate from the location of a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music_to_background&amp;lt;/b&amp;gt;(?) = ?&lt;br /&gt;
:Allows multiple music streams.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Stops the sound playing on a channel handle previously returned by a call to a sound playing function.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_soundvol&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Obtains the current volume of the sound, ranging from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_soundvol&amp;lt;/b&amp;gt;(chan_handle, volume) &lt;br /&gt;
:Adjusts the volume of the sound, with the volume range from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
==Levels and Wallsets==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_getinfo&amp;lt;/b&amp;gt;(level) = x_size, y_size, light, xp_multiplier, wallset_name&lt;br /&gt;
:Returns the basic info about a level.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_tint&amp;lt;/b&amp;gt;(level, RGB, ~[level])&lt;br /&gt;
:Tells DSB to tint the dynamically scaled and shaded objects in a level a certain way. By default, this is {0, 0, 0}, causing the dungeon to fade to black, just like DM, but if the ambient light color is different, or you are outdoors and fade to a misty grey instead of black, you will probably want to change this. The third parameter is to control the level of tint applied. The default is 64 but a value of over 200 or so will make everything so dark you can&#039;t see anything.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. Wallsets in DM 2.x ([CSBwin]) are easiest to use with this command, as they have a single very long wall, as opposed to assembling the front view out of &amp;quot;left&amp;quot; and &amp;quot;front&amp;quot; bitmaps. (see the next command)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, left1, left1alt, left2, left2alt, left3, left3alt, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. This command takes 6 more arguments: 6 &amp;quot;left side&amp;quot; bitmaps. If you&#039;re using a converted DM2, [[DSB/DSB for RTC users|DSB for RTC users]], or WHACK wallset, you&#039;ll find this command useful.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_wallset&amp;lt;/b&amp;gt;(level, wallset)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_use_wallset&amp;lt;/b&amp;gt;(level, wallset) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Tells DSB to use the specified wallset on the specified level.&lt;br /&gt;
Note: this function was formerly known as &amp;quot;dsb_use_wallset,&amp;quot; and that is still a synonym for it, for now. In new dungeons, please use the new name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_alt_wallset&amp;lt;/b&amp;gt;(wallset, level, x, y, dir)&lt;br /&gt;
:Tells DSB to use the specified wallset only on the given direction of the given tile. If CENTER is specified, it will use that wallset on all directions of the given tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the roof every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the floor with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a second bitmap name to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the roof with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the roof every other step, like standard roofs, or pass a second bitmap name to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_text2map&amp;lt;/b&amp;gt;(level, x_size, y_size, light, xp_multiplier, maptable)&lt;br /&gt;
:Converts a table with a text-based map into a level. Each row of the table should represent a row of the dungeon, and contain a string with 0&#039;s or 1&#039;s representing walls and floors in that row. In this way, it is very similar to how dungeons are declared in an [[DSB/DSB for RTC users|DSB for RTC users]] text file.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_image2map&amp;lt;/b&amp;gt;(level, filename, light, xp_multiplier) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Converts a bitmap image into a level. One pixel = one square. It must be a 256 color image, where color 0 represents walls, color 1 represents open space, and further colors can be used to represent various objects in the dungeon by means of a conversion table. This function is now mostly deprecated because everyone is using ESB anyway.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_cell&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns a boolean specifying whether or not the given cell in the dungeon is a wall. Use &amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt; to find out anything else about what&#039;s there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_cell&amp;lt;/b&amp;gt;(level, x, y, value)&lt;br /&gt;
:Sets whether the given cell in the dungeon is a wall or open space. A value of nil, false, or 0 represents open space. A value of true or any other integer represents a wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_visited&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns whether the party has visited the given dungeon cell. A wall will never be visited, unless it wasn&#039;t a wall at some point in the past.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp_multiplier&amp;lt;/b&amp;gt;(level) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp_multiplier&amp;lt;/b&amp;gt;(level, integer)&lt;br /&gt;
:Gets or sets the XP multiplier for a given level of the dungeon.&lt;br /&gt;
&lt;br /&gt;
==Characters==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_champion&amp;lt;/b&amp;gt;(portrait_gfxname, first_name, last_name, health, stamina, mana, strength, dexterity, wisdom, vitality, anti-magic, anti-fire, luck, fighter_level, ninja_level, priest_level, wizard_level) = char_id&lt;br /&gt;
:Adds a character to the roster and returns his/her id number, which can then be used for adjusting various stats or putting items in his/her pack. Note that the internal representations of the three bars and the 7 statistics are 10 times what is actually displayed. (That is, 100 health in-game is represented by 1000)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_offer_champion&amp;lt;/b&amp;gt;(char_id, mode, take_function)&lt;br /&gt;
:Offers the given char_id, with the options specified by &amp;quot;mode&amp;quot; available.&lt;br /&gt;
:~[1 = resurrect, 2 = reincarnate, 3 = both]. The take_function is a Lua function that is executed if the offered character is resurrected or reincarnated. It is typically used to clear out the champion&#039;s mirror, or do something else to denote that the character is no longer available.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_toparty&amp;lt;/b&amp;gt;(ppos, char)&lt;br /&gt;
:Adds the specified character at the specified party position. (Unlike dsb_offer_champion the player is given no choice, the character is just added) It will fail silently if that position is already occupied.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_fromparty&amp;lt;/b&amp;gt;(ppos)&lt;br /&gt;
:Removes anyone at the specified party position. It will fail silently if no one is there. If the party is reduced to nothing, the game will revert to &amp;quot;ghost mode.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charname&amp;lt;/b&amp;gt;(char) = string&lt;br /&gt;
:Returns the character&#039;s name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s three bars. (HEALTH, STAMINA or MANA)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_stat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_stat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s stats. (STAT_STR, STAT_DEX, STAT_WIS, STAT_VIT, STAT_AMA, STAT_AFI, STAT_LUC)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxbar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxbar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxstat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxstat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:As above, only pertaining to maximum values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;do_damage(ppos, char, type, amount)&amp;lt;/b&amp;gt;&lt;br /&gt;
:This function will damage the given character at the given ppos the given amount of the given type (HEALTH, STAMINA, or MANA). The units specified here are as the player perceives them (that is, divided by ten from internal representations and the same scale used by monsters)&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_load&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxload&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
:Returns the load or max load of a given character.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_food&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_food&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_water&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_water&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
:Get or set the character&#039;s food and water values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_injury&amp;lt;/b&amp;gt;(char, location) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_injury&amp;lt;/b&amp;gt;(char, location, integer)&lt;br /&gt;
:Gets or sets the amount of injury a given location on the given character has sustained. This number is 0 if the location is uninjured and can go up to 100, but anything nonzero will highlight it in red and use the &amp;quot;bandaged&amp;quot; bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_portrait&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:Replaces the portrait of a character with the given image. This can happen on-the-fly at any time. Note that the portrait must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;portrait&amp;quot;, not gfx.portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_portraitname&amp;lt;/b&amp;gt;(char) = portrait_name&lt;br /&gt;
:Retrieves the name of a character&#039;s portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_portraitname&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:An alias for dsb_replace_portrait (for symmetry).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_topimages&amp;lt;/b&amp;gt;(char, hands_image_name, portrait_background_image_name, death_image_name)&lt;br /&gt;
:Replaces the top &amp;quot;hands&amp;quot;, &amp;quot;portrait background&amp;quot; and &amp;quot;death&amp;quot; images.  Pass the image names nil to leave the image alone, or 0 to go back to the default.  Remember that we pass the image parameters as strings, and not a direct reference to the &#039;&#039;gfx&#039;&#039; table.  Example: &#039;&#039;dsb_replace_topimages(char, nil, nil, &amp;quot;frozen_face_halk&amp;quot;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_charhand&amp;lt;/b&amp;gt;(char, hand_name)&lt;br /&gt;
:Replaces the &amp;quot;hand&amp;quot; of a character with the given image. This can happen on-the-fly at any time. Note that the image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;hand_image&amp;quot;, not gfx.hand_image.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_inventory&amp;lt;/b&amp;gt;(char, inventory_image_name)&lt;br /&gt;
:Replaces the inventory background of a character with the given image. This can happen on-the-fly at any time. Note that the background image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;inventory&amp;quot;, not gfx.inventory.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_methods&amp;lt;/b&amp;gt;(char, methods_table_name)&lt;br /&gt;
:Replaces the default attack methods of a character with the given table of methods, or function returning a table. This can happen on-the-fly at any time. Note that the method table or function must be specified by name as a string, not as an actual table. It must a single global variable (not be contained in any other table).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_xp_level&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_xp_level_nobonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
:These functions return the character&#039;s level of mastery at a certain skill (a class such as &#039;ninja&#039;) and subskill (or 0 for no subskill). The &amp;quot;nobonus&amp;quot; form does not take temporary XP or level-boosting items into account.  All references to the &amp;lt;i&amp;gt;dsb_xp_level&amp;lt;/i&amp;gt; call are wrapped by function &amp;lt;i&amp;gt;determine_xp_level(char, class, subskill)&amp;lt;/i&amp;gt; so that [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28487&amp;amp;p=106622#p106622 it can be overridden].&lt;br /&gt;
  &lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_give_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gives the specified amount of XP in the specified skill and subskill (or 0 for no subskill).&lt;br /&gt;
:Important: This function gives XP only. It doesn&#039;t deal with XP multipliers, leveling up, bonuses, or anything else.&lt;br /&gt;
:More useful to most designers will be the helper function &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:This function takes XP multipliers, leveling up, etc. into account.&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/xp.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets the character&#039;s amount of experience directly. Setting XP directly doesn&#039;t do anything with stats, leveling up or down, or anything of that sort, so it is of limited use unless you really know what you&#039;re doing.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets a temporary XP bonus. This, too, is handled by &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt; automatically.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bonus&amp;lt;/b&amp;gt;(char, skill, subskill, integer)&lt;br /&gt;
:Gets or sets a level bonus associated with a given skill or subskill (or 0 for no subskill), such as what may be given by a magic item held in hand or worn around the neck.&lt;br /&gt;
&lt;br /&gt;
==The Party==&lt;br /&gt;
Many of these commands include optional support for [[DSB/Multiple Parties|Multiple Parties]]. In a standard DM dungeon, you can ignore all of that.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt;(~[party]) = level, x, y, facing&lt;br /&gt;
:Returns the ~[specified] party&#039;s location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_at&amp;lt;/b&amp;gt;(level, x, y) = party&lt;br /&gt;
:Returns which party is at a specified location, or nil if no party is there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_place&amp;lt;/b&amp;gt;(level, x, y, facing, ~[party])&lt;br /&gt;
:Places the ~[specified] party at a specific location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pfacing&amp;lt;/b&amp;gt;(ppos) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_pfacing&amp;lt;/b&amp;gt;(ppos, direction)&lt;br /&gt;
:Get or set the direction a given party position is facing relative to the rest of the party. (This changes when the members are attacked from monsters to the sides or behind)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_idle&amp;lt;/b&amp;gt;(ppos) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_idle&amp;lt;/b&amp;gt;(ppos, integer)&lt;br /&gt;
:Gets or sets the amount of time the given party position must be idle (that is, the attack method icons are ghosted). Note that these take party positions, not character numbers.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_leader&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:Returns the party position of the party&#039;s leader.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_char&amp;lt;/b&amp;gt;(ppos, ~[party]) = char&lt;br /&gt;
:Returns the character at the given party position, or nil if there isn&#039;t one.&lt;br /&gt;
If a party is specified, that party will be searched. If there is no party specified, only the current party will be searched. To search all parties, specify VARIABLE as the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_char_ppos&amp;lt;/b&amp;gt;(char) = ppos&lt;br /&gt;
:Returns the party position a given character occupies, or nil if he/she isn&#039;t in the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_tile&amp;lt;/b&amp;gt;(ppos, ~[party]) = tile_dir&lt;br /&gt;
:Returns the tile location that the given party position occupies.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tile_ppos(tile_dir, ~[party])&amp;lt;/b&amp;gt; = ppos&lt;br /&gt;
:Returns the party position occupied by the given tile location, or nil if nobody is there.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sleepstate&amp;lt;/b&amp;gt;() = boolean&lt;br /&gt;
:Returns whether or not the party is asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wakeup&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Wakes up the party if they are asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_current_inventory&amp;gt;&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:If someone&#039;s inventory is being looked at, this returns the party position of the character that is being looked at. Otherwise, it returns nil.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lastmethod&amp;lt;/b&amp;gt;(ppos) = method, location, inst&lt;br /&gt;
:Returns the last attack method invoked by the given ppos.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_scanfor&amp;lt;/b&amp;gt;(arch) = id&lt;br /&gt;
:Scans the entire party&#039;s inventory for a given arch. Returns the id for the first instance of that arch if it is found, or nil if nothing is found.&lt;br /&gt;
&lt;br /&gt;
==Multiple Parties==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mpartyflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Multiple Parties|Multiple Parties]] flag.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_exviewinst&amp;lt;/b&amp;gt;(char, monster_id)&lt;br /&gt;
:This will associate a given monster inst with a character. The monster must be in LIMBO. From then on, whenever that character is seen from a 3rd person perspective, that monster will be drawn to represent that character. Don&#039;t kill this monster or bad things will happen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_apush&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_party_apop&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
:The game uses a &amp;quot;party stack&amp;quot; to keep track of which sub-party the various party-related commands affect. The currently viewed party is always at the bottom. When a party steps on a trigger, it is pushed onto the stack before the trigger is processed. This means things like &amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt; will generally affect the &amp;quot;right&amp;quot; party. You can directly manipulate the stack with these commands, but be careful. If you&#039;re not sure what to do with these commands, you probably don&#039;t need them.&lt;br /&gt;
&lt;br /&gt;
==Interacting with Insts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt;(object_arch, level, x, y, tile_location) = id&lt;br /&gt;
:Spawns a new instance at the specified coordinates and returns its id.&lt;br /&gt;
Note that if &amp;quot;level&amp;quot; is negative, various [[DSB/Special Values|Special Values]] can be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;(id, level, x, y, tile_location)&lt;br /&gt;
:Moves an instance to the specified location. The [[DSB/Special Values|Special Values]] can also be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_reposition&amp;lt;/b&amp;gt;(id, tile_location)&lt;br /&gt;
:Moves an instance to a new tile location on the same tile. Useful for rearranging monsters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Note: &amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt; etc. will not always immediately put the spawned/moved object into position. During the processing of a triggering event (wallitem or flooritem), all spawns and moves will be queued until the end of the processing in order to avoid changing the dungeon state while the triggering objects are still being iterated over. In most cases, the change will not be noticable, but you should be wary of this fact, especially if you are expecting to be able to manipulate the just-moved object in the same function.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move_moncol&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
Allow moving a monster and automatically handle flyer collisions.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_coords&amp;lt;/b&amp;gt;(id) = level, x, y, tile_location&lt;br /&gt;
:Returns the coordinates of an instance. This is either the location in the dungeon, or, using special coordinates, its location in a character or monster&#039;s inventory, in limbo, etc.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt;(level, x, y, tile_location) = id (or table of ids), ~[number]&lt;br /&gt;
:Checks a specified location and returns what&#039;s there. If this is a special coordinate, it is either nil or just an id number. If this is a dungeon location (that is, a level &amp;gt;= 0) or if the special specifier TABLE is used for tile_location, it will return a table of ids. -1 can also be used for the y coordinate when using a special coordinate to return a table of all matching ids, for example, IN_OBJ will give everything inside that object. In these cases, a number is also returned matching the number of instances fetched (but can be ignored if you choose)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_find_arch&amp;lt;/b&amp;gt;(id) = arch&lt;br /&gt;
:Determines the arch of the given instance id. This is often needed in order to access information about the object&#039;s general type.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_swap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Totally destroys the targeted instance and creates a new one at its location with its id number and the new archetype. Things like exvars are not preserved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_qswap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Quick-swaps an instance to a new archetype. That is, it changes only the arch, but no internal variables or exvars. This means that if the new arch is a radically different type, strange things will probably happen and the game might crash. It&#039;s quite handy for making push-buttons that change appearance and such, though.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delete&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Completely destroys an instance from the dungeon.&lt;br /&gt;
In most cases, it is better to send the instance an M_DESTROY message instead.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_facedir&amp;lt;/b&amp;gt;(id) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_facedir&amp;lt;/b&amp;gt;(id, direction)&lt;br /&gt;
:Gets or sets the direction a monster is facing or a flying instance is currently travelling.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_shoot&amp;lt;/b&amp;gt;(id, level, x, y, direction, tile_pos, power, damage, delta, ~[damage_delta])&lt;br /&gt;
:Sends the specified instance flying through the air. It originates at the given level, x, y, and tile_pos, flying in the given direction. Power and damage are variables used by the game to control how far the object flies and how hard it hits. Delta represents how much is subtracted from power each subtile of flight. Delta is also subtracted from damage, unless an optional damage delta is specified instead. When the instance runs out of power, it falls to the ground (or vanishes if &amp;lt;b&amp;gt;flying_only&amp;lt;/b&amp;gt; is set on its archetype)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_flystate&amp;lt;/b&amp;gt;(id) = power, direction, damage&lt;br /&gt;
:Returns the information on a flying instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_openshot&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:This is a minor hack used to specify that the instance has been shot in open space (by a champion or monster, instead of by a wall shooter, for example) and thus should not have collision detection immediately. If this is not set, the instance will instantly run into the character or monster that was supposed to have &amp;quot;launched&amp;quot; it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_collide&amp;lt;/b&amp;gt;(id, lev, x, y, tile, direction) = { {id, tile}, ~[...] }&lt;br /&gt;
:Performs collision detection on a flying object for the specified location. This is useful when directly moving monsters around (e.g., via &amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;) so that they will not apparently move &amp;quot;through&amp;quot; flying missiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_flyreps&amp;lt;/b&amp;gt;(???, ???, ...) = ???&lt;br /&gt;
:Allows you to set the number of update repetitions that a flying object performs per tick. For example, a value of 8 will cause the object to move 8 sub-tiles per tick, or 4 full tiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gfxflag&amp;lt;/b&amp;gt;(id, flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Graphics Flag|Graphics Flag]] for a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charge&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_charge&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets the charge of a given instance. This is normally used by limited-use items but it can have other applications. It is used to set the size of clouds and spells, too. It must be a number from 0 to 63.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_crop&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_crop&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets how much a door is cropped in its display. This is used when they open and close.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawnburst_begin&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_spawnburst_end&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Begins or ends a [[DSB/Spawnburst|Spawnburst]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_push_mouse&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:A shortcut command to push the specified instance into the mouse hand.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_pop_mouse&amp;lt;/b&amp;gt;() = id&lt;br /&gt;
:A shortcut command to pop anything in the mouse hand out, returning its id at the same time.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_valid_inst&amp;lt;/b&amp;gt;(id) = ternary value&lt;br /&gt;
:Returns true if the instance exists, false if it doesn&#039;t but the id is valid, and nil if it is not a valid instance id.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:Creates a new arch type.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Monsters==&lt;br /&gt;
Monsters are insts as well, and (almost?) all commands that affect insts will work just the same on monsters, but monsters have their own specialized functionality as well.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_hp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_hp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s HP. Please note that this function has nothing to do with how to get or set a character&#039;s HP. In addition, the scale used by monster HP is &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; scaled up by a factor of 10.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxhp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxhp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s max HP.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_tint&amp;lt;/b&amp;gt;(id, RGB, ~[intensity])&lt;br /&gt;
:Sets the &#039;tint&#039; of a monster, to give it a glowing effect. Monsters flash when they are hit by various spells.  There is finally an optional intensity level parameter, set at 127 by default with a range of 0 to 255.  0 Being completely black.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai&amp;lt;/b&amp;gt;(id, message, data) ~[= result]&lt;br /&gt;
:Sends an [[DSB/Monster AI|Monster AI]] message to the given monster.&lt;br /&gt;
If data is QUERY then the function will return information on the given value, rather than setting it. For example, dsb_ai(id, AI_FEAR, QUERY) will return the monster&#039;s current level of fear. [[DSB/Monster AI|Monster AI]] documentation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_boss&amp;lt;/b&amp;gt;(id) = boss_id&lt;br /&gt;
:Returns the given monster id&#039;s boss. The &amp;quot;boss&amp;quot; is the monster in each tile who controls when the entire group moves and attacks. This allows DSB monsters to all be distinct entities, but move in DM-style groups.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_promote&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Promotes the given monster id to be the boss of its tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_subordinates&amp;lt;/b&amp;gt;(boss_id) = { {id, tile}, [...] }&lt;br /&gt;
:Returns all monsters who are subordinate to the given boss.&lt;br /&gt;
&lt;br /&gt;
==Messaging==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg&amp;lt;/b&amp;gt;(delay, id, message, data, ~[sender])&lt;br /&gt;
:Sends the specified [[DSB/Messages|Messages]] to the specified instance after the specified delay. Messages are simply integers. The object responds to the message as specified by its msg_handler, defined in its archetype. See &amp;lt;i&amp;gt;base/msg_handlers.lua&amp;lt;/i&amp;gt; for many examples of what can be done with message handlers. Normally it doesn&#039;t matter where a message comes from. However, it is possible to assert the sender of the message, in the rare cases where it is needed. (See [[DSB/Messages]] for more information on how to use messages)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg_chain&amp;lt;/b&amp;gt;(id, target_id)&lt;br /&gt;
:This causes the first instance to relay any messages it receives to the second instance. This is useful for making ceiling pits close at the same time floor pits do, and other situations where an instance should pass messages along.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_msgs_to&amp;lt;/b&amp;gt;(id, delay)&lt;br /&gt;
:Delays all messages bound for a given instance by the specified delay.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_enable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Enables an instance. This will clear its INACTIVE flag as well as make sure any events, triggerings, etc. that should happen do happen. This function is easier and safer to use than setting the flag directly.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_disable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Disables an instance. This will set its INACTIVE flag and make sure that any objects on it stop triggering it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_toggle&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:See the previous two.&lt;br /&gt;
&lt;br /&gt;
==Light==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light&amp;lt;/b&amp;gt;(handle) = lightlevel&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_light&amp;lt;/b&amp;gt;(handle, lightlevel)&lt;br /&gt;
:Gets or sets the light level on the given light handle, which is an integer from 0 to 9. The light level displayed is the sum of the dungeon level&#039;s base light level plus the 10 light handles. Currently, light handle 0 is used for light spells, handle 1 is used for torches, and 2 is used by illumulets.&lt;br /&gt;
&lt;br /&gt;
==Conditions==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_condition&amp;lt;/b&amp;gt;(type, inventory_gfx, portrait_gfx, update_freq, function, ~[flags]) = condition_id&lt;br /&gt;
:Adds a condition (status variable) to the list of those available. The type is either PARTY (affects the whole party) or INDIVIDUAL (affects one person). For individual conditions, two graphics can be specified, one that affects the inventory screen, the other that affects the portrait area. If type is PARTY the third parameter portrait_gfx is now considered as overlay_gfx and will be seen in the dungeon view port.  We can apply an underwater effect for example, as the overlay includes support for alpha channels if you want transparent parts.  &lt;br /&gt;
:If update_freq is &amp;gt; 0, the specified function will be called at the specified number of ticks. The function takes the following form:&lt;br /&gt;
&lt;br /&gt;
   function update_func(char, condition_strength)&lt;br /&gt;
     return new_condition_strength&lt;br /&gt;
   end&lt;br /&gt;
:&lt;br /&gt;
:Flags can be specified to control other aspects of the condition&#039;s appearance on the inventory screen. These flags are COND_MOUTH_RED, COND_MOUTH_GREEN, COND_EYE_RED, and COND_EYE_GREEN. These flags only affect INDIVIDUAL conditions. There was formerly a condition type called BAD_INDIVIDUAL that was an INDIVIDUAL condition with COND_MOUTH_RED. It is now &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;deprecated&amp;lt;/font&amp;gt;. Please don&#039;t use it in new code.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_condition&amp;lt;/b&amp;gt;(condition_id, type, inventory_gfx, portrait_gfx, update_freq, function)&lt;br /&gt;
:Replaces the information for the condition with the given id with the new condition. Good for changing conditions on the fly, but keep in mind that the fact that you&#039;ve changed the condition won&#039;t be saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_condition&amp;lt;/b&amp;gt;(char, condition) = strength&lt;br /&gt;
:Returns the strength of the specified condition for the specified character (or, in the case of conditions for the whole party, pass PARTY as the character)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_condition&amp;lt;/b&amp;gt;(char, condition, strength)&lt;br /&gt;
:Sets the strength of the condition. See previous function.&lt;br /&gt;
&lt;br /&gt;
==Popups and Readouts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_damage_popup&amp;lt;/b&amp;gt;(ppos, damage_type, integer)&lt;br /&gt;
:Shows the amount of damage taken by a character in a little popup over the character&#039;s name or portrait. The type is either HEALTH, STAMINA, or MANA, and a different background icon is displayed for each. The amount of damage shown should be in units as the player perceives them, not internal (so, divided by ten from internal representations)-- the default functions in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt; take care of this for you.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_damage&amp;lt;/b&amp;gt;(integer)&lt;br /&gt;
:This causes a number in a little explosion to appear in the area occupied by the attack icons. This is used for showing the amount of damage inflicted upon a monster by a melee attack.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_text&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:This causes text to momentarily appear in the area occupied by the attack icons. This is used for things like &amp;quot;CAN&#039;T REACH&amp;quot; or &amp;quot;NEED AMMO.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Fullscreen==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;(bitmap_or_func, click_func, update_func, mouse, fade)&lt;br /&gt;
:This engages the full-screen renderer, and is used for cut scenes or other interludes. If the first parameter passed is a bitmap, that bitmap will be displayed. If the first parameter is instead a function, that function will be executed every frame. The draw function will be passed the bitmap to draw to, the mouse&#039;s x location, and the mouse&#039;s y location, in the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;draw_function&amp;lt;/b&amp;gt;(bitmap, mouse_x, mouse_y)&amp;lt;/code&amp;gt;&lt;br /&gt;
:The click_func, if provided, will be executed every time the mouse is clicked. It is of the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;click_func&amp;lt;/b&amp;gt;(mouse_x, mouse_y, mouse_buttons)&amp;lt;/code&amp;gt;&lt;br /&gt;
:Update_func, if provided, will be executed every game tick. It takes no parameters.&lt;br /&gt;
:If mouse is nil or false, no mouse pointer will be drawn. If it is true, the standard &amp;quot;yellow arrow&amp;quot; mouse pointer will be drawn. If it is a bitmap, that bitmap will be drawn as the mouse pointer.&lt;br /&gt;
:There is an optional 5th parameter that allows a fade in/fade out.&lt;br /&gt;
:The full-screen renderer will run until any of its associated functions returns something other than false or nil, and the game logic does not advance while in &amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Subrenderers and System Renderers==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_subrenderer_target&amp;lt;/b&amp;gt;() = bitmap&lt;br /&gt;
:Returns a bitmap to be drawn upon. Use only in a [[DSB/Subrenderers|Subrenderer]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_objzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y)&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer or system bitmap. This object zone can be used to access instances that are stored inside of the given instance. See the implementation of chests in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for more information and examples.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msgzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y, width, height, msg, ~[data1, data2])&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer or system bitmap, with the given width and height. When it is clicked, the specified message will be sent to the instance. This can allow fairly complicated user interfaces in subrenderers.&lt;br /&gt;
:The third parameter, number, allows you to override/replace zones by specifying an existing handle. It also allows msgzones to have more information about where you clicked, because the zone number you clicked is passed as the msg&#039;s data parameter. If you don&#039;t care about any of this, just keep incrementing the number for every new zone. (See [[DSB/Messages]] for more information on how to use messages)&lt;br /&gt;
&lt;br /&gt;
==Global Data, Utility Functions, and Misc.==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gameflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Global Flags|Global Flag]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_hide_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_show_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Functions to make the mouse pointer appear or disappear.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_unlock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
:Functions to lock or unlock the game. Complete locking prevents most timers from running (though animations and delayed functions still will), processing any player input, or triggering anything. If you lock the game and forget to unlock it, it will be left in an unplayable state, so be very careful how you use this! Note that this takes effect immediately (that is, even before any queued moves), which may not always be what you want. You can also lock only certain parts of the game, using the [[DSB/Locking Flags|locking flags]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rand&amp;lt;/b&amp;gt;(min, max) = integer&lt;br /&gt;
:Generates a random integer between min and max, inclusive.&lt;br /&gt;
You should &amp;lt;b&amp;gt;always&amp;lt;/b&amp;gt; use this function for random number generation, not anything built into Lua.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_linesplit&amp;lt;/b&amp;gt;(string, split) = lines, number_of_lines&lt;br /&gt;
:A utility function that splits up a string into individual lines (placing the number of lines returned in number_of_lines) demarcated by the split character. &amp;quot;/&amp;quot; (slash) is a common choice for a a split character. See the implementation of scrolls in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for an example.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_forward&amp;lt;/b&amp;gt;(direction) = x, y&lt;br /&gt;
:A utility function that, given a direction, returns the x and y offsets of which way is &amp;quot;forward.&amp;quot; One will always be 1 or -1, the other will always be 0.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileshift&amp;lt;/b&amp;gt;(location, direction) = location&lt;br /&gt;
:A utility function that shifts the specified location in the specified direction. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lookup_global&amp;lt;/b&amp;gt;(string) = variable&lt;br /&gt;
:Returns the variable named by the specified string. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_func&amp;lt;/b&amp;gt;(delay, function)&lt;br /&gt;
:Executes the given function after the given delay in ticks. References to Lua functions cannot be saved, so queued functions will &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; be saved. This should be something nonvital if the game is not locked, and should happen quickly. In most cases, using a message on a delay, which is saved, would work better.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_inventory_info&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the inventory_info has been changed, this lets the engine know. Note that this state is not saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_system&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the system strings or player colors have been changed, this lets the engine know. This may or may not be useful. With the moving of most inventory rendering into Lua-controlled subrenderers, this function has limited use.&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_export&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:Normally, Lua global variables aren&#039;t saved in savegames, however, a few usually need to be. If you need to store a global variable, add it to the export list with this function. Note that dsb_export requires a string giving the name of the variable. Don&#039;t pass the variable itself! You should also note that if you have a very long export list, you&#039;re probably doing something that could be done more easily with specialized code or more careful use of instances with exvars. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport&amp;lt;/b&amp;gt;(x, y)&lt;br /&gt;
:Sets the viewport. Odds are you should leave this one alone.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_enable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_disable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Enables or disables the specified magical rune for use in spells. All runes are enabled by default, just like in original DM. The rune is specified as an integer, where 1 = LO, 2 = UM, 7 = YA, and so on.&lt;br /&gt;
&lt;br /&gt;
These functions are now deprecated. You should manipulate the &amp;lt;b&amp;gt;g_disabled_runes&amp;lt;/b&amp;gt; table directly. For example, disabling the VI rune (rune 8) is as simple as &amp;lt;code&amp;gt;g_disabled_runes~[8] = false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_game_end&amp;lt;/b&amp;gt;(~[bool])&lt;br /&gt;
:Shows a game ending screen. Normally it&#039;s a bit more fun than the screen you get when the party dies, but if you pass it a boolean &#039;true&#039;, it will just show the standard blue &amp;quot;The End&amp;quot; screen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:This function creates a new arch type, from the original passed in as a parameter.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Pending Documentation==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_msgtype&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_include_file&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_screen_bitmap&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_cache_invalidate&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileptr_exch&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_contains&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_viewing&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_affecting&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_checksound&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gamelocks&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light_total&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_light_totalmax&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_exviewinst&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_import_arch&amp;lt;/b&amp;gt;(???) = [http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=27277&amp;amp;p=83877&amp;amp;hilit=dsb_import_arch#p83877 ?][http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=29188&amp;amp;p=128330&amp;amp;hilit=dsb_import_arch#p128330 ?][http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28859&amp;amp;sid=c8dec8095c76d7ce5937980e94499ceb&amp;amp;p=130029#p130029 ?]&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Exposed functions]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=2970</id>
		<title>DSB/Exposed functions</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=2970"/>
		<updated>2012-11-13T23:05:47Z</updated>

		<summary type="html">&lt;p&gt;Sophia: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Functions are given in the form:&lt;br /&gt;
;&amp;lt;b&amp;gt;function&amp;lt;/b&amp;gt;(arguments, ~[optional arguments]) = return value&lt;br /&gt;
:If the terminology doesn&#039;t make sense, check [[DSB/Basic DSB Terminology]].&lt;br /&gt;
Functions without a dsb_ prefix are part of [[DSB/Base Code|base/]], not the core engine.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_insts&amp;lt;/b&amp;gt;()&lt;br /&gt;
:This is an iterator used in Lua&#039;s for loops. To iterate over all instances of objects in a DSB dungeon, use something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for i in dsb_insts()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_in_obj&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Another iterator; see above for usage. This one is used to iterate all over all instances that are inside the given instance.&lt;br /&gt;
&lt;br /&gt;
==Bitmaps and Drawing==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name) = bitmap&lt;br /&gt;
:Searches the dungeon&#039;s directory for the bitmap, and then &amp;lt;i&amp;gt;graphics.dsb&amp;lt;/i&amp;gt;, and finally the default &amp;lt;i&amp;gt;graphics.dat&amp;lt;/i&amp;gt;. Returns a truecolor bitmap, but the bitmap can be 256 colors on disk to save space. Don&#039;t specify a file extension as DSB will figure it out.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name, relative_path) = bitmap&lt;br /&gt;
:Same as above but with subdirectories.  Example: &amp;quot;path/to/actual/file.ext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mask_bitmap(name)&amp;lt;/b&amp;gt; = bitmap&lt;br /&gt;
:This function loads a bitmap that requires two distinct regions of transparency that are used at different times, such as see-through door decorations or magic windows. The region that is transparent when the image is first blitted is represented by color 0, whereas the region that is &amp;quot;see through&amp;quot; is in the usual magenta color. This requires a 256 color bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_new_bitmap&amp;lt;/b&amp;gt;(xsize, ysize) = bitmap&lt;br /&gt;
:Creates a brand new bitmap and returns a reference to it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_destroy_bitmap&amp;lt;/b&amp;gt;(bitmap)&lt;br /&gt;
:Completely destroys a bitmap. Rarely needed, as Lua&#039;s garbage collector will automatically scoop up out-of-scope bitmaps. You should only invoke this by hand if you know for sure why you need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_clone_bitmap&amp;lt;/b&amp;gt;(bitmap) = bitmap&lt;br /&gt;
:Creates a &amp;quot;virtual bitmap&amp;quot; clone of the specified bitmap. It shares the same actual memory, but can have different offsets. This is useful if you, for example, have several wallitems for which you want to draw the same image on different parts of the wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_animate&amp;lt;/b&amp;gt;(bitmap, frames, frame_delay)&lt;br /&gt;
:Sets up a bitmap that is a series of frames for animation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_clear&amp;lt;/b&amp;gt;(bitmap, RGB)&lt;br /&gt;
:Clears a bitmap to the specified RGB value. An RGB is specified as a table of { R, G, B }.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_blit&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x_src, y_src, x_dest, y_dest, width, height)&lt;br /&gt;
:Blits one bitmap onto another.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_draw&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x, y, flip)&lt;br /&gt;
:Draws the entire source bitmap on to the destination, taking any animation or offsets into account. Pass true to flip to horizontally flip the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_width&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_bitmap_height&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
:Returns the dimension of the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_rect&amp;lt;/b&amp;gt;(bitmap, x_src, y_src, x_dest, y_dest, color, filled)&lt;br /&gt;
:Draws a rectangle. Pass true to filled for a filled rectangle.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;(bitmap, font, string, x, y, alignment, color) = integer&lt;br /&gt;
:Renders text onto a bitmap in the specified font and color, with the specified alignment: (LEFT, RIGHT, CENTER, or MULTILINE).  Returns the number of lines printed.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_dungeon_view&amp;lt;/b&amp;gt;(lev, x, y, dir, light) = bitmap&lt;br /&gt;
:Return a rendering of the viewport.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport_distort&amp;lt;/b&amp;gt;(effect)&lt;br /&gt;
:For viewport postprocessing&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pixel&amp;lt;/b&amp;gt;(bmp, x, y) and &amp;lt;b&amp;gt;dsb_set_pixel&amp;lt;/b&amp;gt;(bmp, x, y, rgb, [alpha])&lt;br /&gt;
:These are used for per-pixel bitmap manipulation&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Fonts and Text==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_font&amp;lt;/b&amp;gt;(name, relative_path) = font&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a font.  Example with a subdirectory: &lt;br /&gt;
:&amp;lt;code&amp;gt;gfx[&amp;quot;GAUDYMEDIEVALFONT&amp;quot;] = dsb_get_font(&amp;quot;GAUDYMEDIEVAL&amp;quot;, &amp;quot;fonts/gaudymedieval.pcx&amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_textformat&amp;lt;/b&amp;gt;(chars_per_line, y_offset_per_line, max_lines)&lt;br /&gt;
:This controls the format of MULTILINE text output by &amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;. The Y offsets are also used by the console (the text below the game view). By setting chars_per_line to something unreasonable, you can effectively disable word wrapping.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_write&amp;lt;/b&amp;gt;(RGB, string)&lt;br /&gt;
:Outputs the given text string in the given color to the console. (that is, a table of { R, G, B })&lt;br /&gt;
&lt;br /&gt;
==Sound and Music==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sound&amp;lt;/b&amp;gt;(name) = sound&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_sound&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound. An optional boolean parameter allows you to specify if the sound should loop. Be careful, the only way to stop a looping sound is via &amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;, so don&#039;t lose the channel handle!&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays a sound file directly from disk instead of loading into memory first. This function only works with direct filenames, you can&#039;t send it a full path -- so your music file must be in the root of your dungeon directoy.  If you use &amp;lt;i&amp;gt;dsb_music&amp;lt;/i&amp;gt;, it will at least load it on demand and destroy it when it&#039;s finished, so your memory usage will be lower than if you loaded it directly as a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_3dsound&amp;lt;/b&amp;gt;(sound, lev, x, y, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound as though it originated from the given location in the dungeon. An optional boolean parameter allows you to specify if the sound should loop. Note that &amp;lt;i&amp;gt;base/util.lua&amp;lt;/i&amp;gt; also includes a useful function, explained next:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;local_sound&amp;lt;/b&amp;gt;(id, sound) = chan_handle&lt;br /&gt;
:Plays a sound that appears to originate from the location of a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music_to_background&amp;lt;/b&amp;gt;(?) = ?&lt;br /&gt;
:Allows multiple music streams.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Stops the sound playing on a channel handle previously returned by a call to a sound playing function.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_soundvol&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Obtains the current volume of the sound, ranging from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_soundvol&amp;lt;/b&amp;gt;(chan_handle, volume) &lt;br /&gt;
:Adjusts the volume of the sound, with the volume range from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
==Levels and Wallsets==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_getinfo&amp;lt;/b&amp;gt;(level) = x_size, y_size, light, xp_multiplier, wallset_name&lt;br /&gt;
:Returns the basic info about a level.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_tint&amp;lt;/b&amp;gt;(level, RGB, ~[level])&lt;br /&gt;
:Tells DSB to tint the dynamically scaled and shaded objects in a level a certain way. By default, this is {0, 0, 0}, causing the dungeon to fade to black, just like DM, but if the ambient light color is different, or you are outdoors and fade to a misty grey instead of black, you will probably want to change this. The third parameter is to control the level of tint applied. The default is 64 but a value of over 200 or so will make everything so dark you can&#039;t see anything.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. Wallsets in DM 2.x ([CSBwin]) are easiest to use with this command, as they have a single very long wall, as opposed to assembling the front view out of &amp;quot;left&amp;quot; and &amp;quot;front&amp;quot; bitmaps. (see the next command)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, left1, left1alt, left2, left2alt, left3, left3alt, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. This command takes 6 more arguments: 6 &amp;quot;left side&amp;quot; bitmaps. If you&#039;re using a converted DM2, [[DSB/DSB for RTC users|DSB for RTC users]], or WHACK wallset, you&#039;ll find this command useful.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_wallset&amp;lt;/b&amp;gt;(level, wallset)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_use_wallset&amp;lt;/b&amp;gt;(level, wallset) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Tells DSB to use the specified wallset on the specified level.&lt;br /&gt;
Note: this function was formerly known as &amp;quot;dsb_use_wallset,&amp;quot; and that is still a synonym for it, for now. In new dungeons, please use the new name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_alt_wallset&amp;lt;/b&amp;gt;(wallset, level, x, y, dir)&lt;br /&gt;
:Tells DSB to use the specified wallset only on the given direction of the given tile. If CENTER is specified, it will use that wallset on all directions of the given tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the roof every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the floor with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a second bitmap name to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the roof with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the roof every other step, like standard roofs, or pass a second bitmap name to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_text2map&amp;lt;/b&amp;gt;(level, x_size, y_size, light, xp_multiplier, maptable)&lt;br /&gt;
:Converts a table with a text-based map into a level. Each row of the table should represent a row of the dungeon, and contain a string with 0&#039;s or 1&#039;s representing walls and floors in that row. In this way, it is very similar to how dungeons are declared in an [[DSB/DSB for RTC users|DSB for RTC users]] text file.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_image2map&amp;lt;/b&amp;gt;(level, filename, light, xp_multiplier) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Converts a bitmap image into a level. One pixel = one square. It must be a 256 color image, where color 0 represents walls, color 1 represents open space, and further colors can be used to represent various objects in the dungeon by means of a conversion table. This function is now mostly deprecated because everyone is using ESB anyway.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_cell&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns a boolean specifying whether or not the given cell in the dungeon is a wall. Use &amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt; to find out anything else about what&#039;s there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_cell&amp;lt;/b&amp;gt;(level, x, y, value)&lt;br /&gt;
:Sets whether the given cell in the dungeon is a wall or open space. A value of nil, false, or 0 represents open space. A value of true or any other integer represents a wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_visited&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns whether the party has visited the given dungeon cell. A wall will never be visited, unless it wasn&#039;t a wall at some point in the past.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp_multiplier&amp;lt;/b&amp;gt;(level) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp_multiplier&amp;lt;/b&amp;gt;(level, integer)&lt;br /&gt;
:Gets or sets the XP multiplier for a given level of the dungeon.&lt;br /&gt;
&lt;br /&gt;
==Characters==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_champion&amp;lt;/b&amp;gt;(portrait_gfxname, first_name, last_name, health, stamina, mana, strength, dexterity, wisdom, vitality, anti-magic, anti-fire, luck, fighter_level, ninja_level, priest_level, wizard_level) = char_id&lt;br /&gt;
:Adds a character to the roster and returns his/her id number, which can then be used for adjusting various stats or putting items in his/her pack. Note that the internal representations of the three bars and the 7 statistics are 10 times what is actually displayed. (That is, 100 health in-game is represented by 1000)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_offer_champion&amp;lt;/b&amp;gt;(char_id, mode, take_function)&lt;br /&gt;
:Offers the given char_id, with the options specified by &amp;quot;mode&amp;quot; available.&lt;br /&gt;
:~[1 = resurrect, 2 = reincarnate, 3 = both]. The take_function is a Lua function that is executed if the offered character is resurrected or reincarnated. It is typically used to clear out the champion&#039;s mirror, or do something else to denote that the character is no longer available.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_toparty&amp;lt;/b&amp;gt;(ppos, char)&lt;br /&gt;
:Adds the specified character at the specified party position. (Unlike dsb_offer_champion the player is given no choice, the character is just added) It will fail silently if that position is already occupied.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_fromparty&amp;lt;/b&amp;gt;(ppos)&lt;br /&gt;
:Removes anyone at the specified party position. It will fail silently if no one is there. If the party is reduced to nothing, the game will revert to &amp;quot;ghost mode.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charname&amp;lt;/b&amp;gt;(char) = string&lt;br /&gt;
:Returns the character&#039;s name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s three bars. (HEALTH, STAMINA or MANA)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_stat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_stat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s stats. (STAT_STR, STAT_DEX, STAT_WIS, STAT_VIT, STAT_AMA, STAT_AFI, STAT_LUC)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxbar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxbar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxstat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxstat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:As above, only pertaining to maximum values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;do_damage(ppos, char, type, amount)&amp;lt;/b&amp;gt;&lt;br /&gt;
:This function will damage the given character at the given ppos the given amount of the given type (HEALTH, STAMINA, or MANA). The units specified here are as the player perceives them (that is, divided by ten from internal representations and the same scale used by monsters)&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_load&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxload&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
:Returns the load or max load of a given character.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_food&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_food&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_water&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_water&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
:Get or set the character&#039;s food and water values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_injury&amp;lt;/b&amp;gt;(char, location) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_injury&amp;lt;/b&amp;gt;(char, location, integer)&lt;br /&gt;
:Gets or sets the amount of injury a given location on the given character has sustained. This number is 0 if the location is uninjured and can go up to 100, but anything nonzero will highlight it in red and use the &amp;quot;bandaged&amp;quot; bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_portrait&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:Replaces the portrait of a character with the given image. This can happen on-the-fly at any time. Note that the portrait must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;portrait&amp;quot;, not gfx.portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_portraitname&amp;lt;/b&amp;gt;(char) = portrait_name&lt;br /&gt;
:Retrieves the name of a character&#039;s portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_portraitname&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:An alias for dsb_replace_portrait (for symmetry).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_topimages&amp;lt;/b&amp;gt;(char, hands_image_name, portrait_background_image_name, death_image_name)&lt;br /&gt;
:Replaces the top &amp;quot;hands&amp;quot;, &amp;quot;portrait background&amp;quot; and &amp;quot;death&amp;quot; images.  Pass the image names nil to leave the image alone, or 0 to go back to the default.  Remember that we pass the image parameters as strings, and not a direct reference to the &#039;&#039;gfx&#039;&#039; table.  Example: &#039;&#039;dsb_replace_topimages(char, nil, nil, &amp;quot;frozen_face_halk&amp;quot;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_charhand&amp;lt;/b&amp;gt;(char, hand_name)&lt;br /&gt;
:Replaces the &amp;quot;hand&amp;quot; of a character with the given image. This can happen on-the-fly at any time. Note that the image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;hand_image&amp;quot;, not gfx.hand_image.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_inventory&amp;lt;/b&amp;gt;(char, inventory_image_name)&lt;br /&gt;
:Replaces the inventory background of a character with the given image. This can happen on-the-fly at any time. Note that the background image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;inventory&amp;quot;, not gfx.inventory.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_methods&amp;lt;/b&amp;gt;(char, methods_table_name)&lt;br /&gt;
:Replaces the default attack methods of a character with the given table of methods, or function returning a table. This can happen on-the-fly at any time. Note that the method table or function must be specified by name as a string, not as an actual table. It must a single global variable (not be contained in any other table).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_xp_level&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_xp_level_nobonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
:These functions return the character&#039;s level of mastery at a certain skill (a class such as &#039;ninja&#039;) and subskill (or 0 for no subskill). The &amp;quot;nobonus&amp;quot; form does not take temporary XP or level-boosting items into account.  All references to the &amp;lt;i&amp;gt;dsb_xp_level&amp;lt;/i&amp;gt; call are wrapped by function &amp;lt;i&amp;gt;determine_xp_level(char, class, subskill)&amp;lt;/i&amp;gt; so that [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28487&amp;amp;p=106622#p106622 it can be overridden].&lt;br /&gt;
  &lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_give_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gives the specified amount of XP in the specified skill and subskill (or 0 for no subskill).&lt;br /&gt;
:Important: This function gives XP only. It doesn&#039;t deal with XP multipliers, leveling up, bonuses, or anything else.&lt;br /&gt;
:More useful to most designers will be the helper function &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:This function takes XP multipliers, leveling up, etc. into account.&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/xp.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets the character&#039;s amount of experience directly. Setting XP directly doesn&#039;t do anything with stats, leveling up or down, or anything of that sort, so it is of limited use unless you really know what you&#039;re doing.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets a temporary XP bonus. This, too, is handled by &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt; automatically.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bonus&amp;lt;/b&amp;gt;(char, skill, subskill, integer)&lt;br /&gt;
:Gets or sets a level bonus associated with a given skill or subskill (or 0 for no subskill), such as what may be given by a magic item held in hand or worn around the neck.&lt;br /&gt;
&lt;br /&gt;
==The Party==&lt;br /&gt;
Many of these commands include optional support for [[DSB/Multiple Parties|Multiple Parties]]. In a standard DM dungeon, you can ignore all of that.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt;(~[party]) = level, x, y, facing&lt;br /&gt;
:Returns the ~[specified] party&#039;s location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_at&amp;lt;/b&amp;gt;(level, x, y) = party&lt;br /&gt;
:Returns which party is at a specified location, or nil if no party is there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_place&amp;lt;/b&amp;gt;(level, x, y, facing, ~[party])&lt;br /&gt;
:Places the ~[specified] party at a specific location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pfacing&amp;lt;/b&amp;gt;(ppos) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_pfacing&amp;lt;/b&amp;gt;(ppos, direction)&lt;br /&gt;
:Get or set the direction a given party position is facing relative to the rest of the party. (This changes when the members are attacked from monsters to the sides or behind)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_idle&amp;lt;/b&amp;gt;(ppos) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_idle&amp;lt;/b&amp;gt;(ppos, integer)&lt;br /&gt;
:Gets or sets the amount of time the given party position must be idle (that is, the attack method icons are ghosted). Note that these take party positions, not character numbers.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_leader&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:Returns the party position of the party&#039;s leader.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_char&amp;lt;/b&amp;gt;(ppos, ~[party]) = char&lt;br /&gt;
:Returns the character at the given party position, or nil if there isn&#039;t one.&lt;br /&gt;
If a party is specified, that party will be searched. If there is no party specified, only the current party will be searched. To search all parties, specify VARIABLE as the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_char_ppos&amp;lt;/b&amp;gt;(char) = ppos&lt;br /&gt;
:Returns the party position a given character occupies, or nil if he/she isn&#039;t in the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_tile&amp;lt;/b&amp;gt;(ppos, ~[party]) = tile_dir&lt;br /&gt;
:Returns the tile location that the given party position occupies.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tile_ppos(tile_dir, ~[party])&amp;lt;/b&amp;gt; = ppos&lt;br /&gt;
:Returns the party position occupied by the given tile location, or nil if nobody is there.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sleepstate&amp;lt;/b&amp;gt;() = boolean&lt;br /&gt;
:Returns whether or not the party is asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wakeup&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Wakes up the party if they are asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_current_inventory&amp;gt;&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:If someone&#039;s inventory is being looked at, this returns the party position of the character that is being looked at. Otherwise, it returns nil.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lastmethod&amp;lt;/b&amp;gt;(ppos) = method, location, inst&lt;br /&gt;
:Returns the last attack method invoked by the given ppos.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_scanfor&amp;lt;/b&amp;gt;(arch) = id&lt;br /&gt;
:Scans the entire party&#039;s inventory for a given arch. Returns the id for the first instance of that arch if it is found, or nil if nothing is found.&lt;br /&gt;
&lt;br /&gt;
==Multiple Parties==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mpartyflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Multiple Parties|Multiple Parties]] flag.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_exviewinst&amp;lt;/b&amp;gt;(char, monster_id)&lt;br /&gt;
:This will associate a given monster inst with a character. The monster must be in LIMBO. From then on, whenever that character is seen from a 3rd person perspective, that monster will be drawn to represent that character. Don&#039;t kill this monster or bad things will happen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_apush&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_party_apop&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
:The game uses a &amp;quot;party stack&amp;quot; to keep track of which sub-party the various party-related commands affect. The currently viewed party is always at the bottom. When a party steps on a trigger, it is pushed onto the stack before the trigger is processed. This means things like &amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt; will generally affect the &amp;quot;right&amp;quot; party. You can directly manipulate the stack with these commands, but be careful. If you&#039;re not sure what to do with these commands, you probably don&#039;t need them.&lt;br /&gt;
&lt;br /&gt;
==Interacting with Insts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt;(object_arch, level, x, y, tile_location) = id&lt;br /&gt;
:Spawns a new instance at the specified coordinates and returns its id.&lt;br /&gt;
Note that if &amp;quot;level&amp;quot; is negative, various [[DSB/Special Values|Special Values]] can be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;(id, level, x, y, tile_location)&lt;br /&gt;
:Moves an instance to the specified location. The [[DSB/Special Values|Special Values]] can also be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_reposition&amp;lt;/b&amp;gt;(id, tile_location)&lt;br /&gt;
:Moves an instance to a new tile location on the same tile. Useful for rearranging monsters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Note: &amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt; etc. will not always immediately put the spawned/moved object into position. During the processing of a triggering event (wallitem or flooritem), all spawns and moves will be queued until the end of the processing in order to avoid changing the dungeon state while the triggering objects are still being iterated over. In most cases, the change will not be noticable, but you should be wary of this fact, especially if you are expecting to be able to manipulate the just-moved object in the same function.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move_moncol&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
Allow moving a monster and automatically handle flyer collisions.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_coords&amp;lt;/b&amp;gt;(id) = level, x, y, tile_location&lt;br /&gt;
:Returns the coordinates of an instance. This is either the location in the dungeon, or, using special coordinates, its location in a character or monster&#039;s inventory, in limbo, etc.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt;(level, x, y, tile_location) = id (or table of ids), ~[number]&lt;br /&gt;
:Checks a specified location and returns what&#039;s there. If this is a special coordinate, it is either nil or just an id number. If this is a dungeon location (that is, a level &amp;gt;= 0) or if the special specifier TABLE is used for tile_location, it will return a table of ids. -1 can also be used for the y coordinate when using a special coordinate to return a table of all matching ids, for example, IN_OBJ will give everything inside that object. In these cases, a number is also returned matching the number of instances fetched (but can be ignored if you choose)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_find_arch&amp;lt;/b&amp;gt;(id) = arch&lt;br /&gt;
:Determines the arch of the given instance id. This is often needed in order to access information about the object&#039;s general type.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_swap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Totally destroys the targeted instance and creates a new one at its location with its id number and the new archetype. Things like exvars are not preserved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_qswap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Quick-swaps an instance to a new archetype. That is, it changes only the arch, but no internal variables or exvars. This means that if the new arch is a radically different type, strange things will probably happen and the game might crash. It&#039;s quite handy for making push-buttons that change appearance and such, though.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delete&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Completely destroys an instance from the dungeon.&lt;br /&gt;
In most cases, it is better to send the instance an M_DESTROY message instead.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_facedir&amp;lt;/b&amp;gt;(id) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_facedir&amp;lt;/b&amp;gt;(id, direction)&lt;br /&gt;
:Gets or sets the direction a monster is facing or a flying instance is currently travelling.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_shoot&amp;lt;/b&amp;gt;(id, level, x, y, direction, tile_pos, power, damage, delta, ~[damage_delta])&lt;br /&gt;
:Sends the specified instance flying through the air. It originates at the given level, x, y, and tile_pos, flying in the given direction. Power and damage are variables used by the game to control how far the object flies and how hard it hits. Delta represents how much is subtracted from power each subtile of flight. Delta is also subtracted from damage, unless an optional damage delta is specified instead. When the instance runs out of power, it falls to the ground (or vanishes if &amp;lt;b&amp;gt;flying_only&amp;lt;/b&amp;gt; is set on its archetype)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_flystate&amp;lt;/b&amp;gt;(id) = power, direction, damage&lt;br /&gt;
:Returns the information on a flying instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_openshot&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:This is a minor hack used to specify that the instance has been shot in open space (by a champion or monster, instead of by a wall shooter, for example) and thus should not have collision detection immediately. If this is not set, the instance will instantly run into the character or monster that was supposed to have &amp;quot;launched&amp;quot; it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_collide&amp;lt;/b&amp;gt;(id, lev, x, y, tile, direction) = { {id, tile}, ~[...] }&lt;br /&gt;
:Performs collision detection on a flying object for the specified location. This is useful when directly moving monsters around (e.g., via &amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;) so that they will not apparently move &amp;quot;through&amp;quot; flying missiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_flyreps&amp;lt;/b&amp;gt;(???, ???, ...) = ???&lt;br /&gt;
:Allows you to set the number of update repetitions that a flying object performs per tick. For example, a value of 8 will cause the object to move 8 sub-tiles per tick, or 4 full tiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gfxflag&amp;lt;/b&amp;gt;(id, flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Graphics Flag|Graphics Flag]] for a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charge&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_charge&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets the charge of a given instance. This is normally used by limited-use items but it can have other applications. It is used to set the size of clouds and spells, too. It must be a number from 0 to 63.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_crop&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_crop&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets how much a door is cropped in its display. This is used when they open and close.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawnburst_begin&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_spawnburst_end&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Begins or ends a [[DSB/Spawnburst|Spawnburst]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_push_mouse&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:A shortcut command to push the specified instance into the mouse hand.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_pop_mouse&amp;lt;/b&amp;gt;() = id&lt;br /&gt;
:A shortcut command to pop anything in the mouse hand out, returning its id at the same time.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_valid_inst&amp;lt;/b&amp;gt;(id) = ternary value&lt;br /&gt;
:Returns true if the instance exists, false if it doesn&#039;t but the id is valid, and nil if it is not a valid instance id.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:Creates a new arch type.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Monsters==&lt;br /&gt;
Monsters are insts as well, and (almost?) all commands that affect insts will work just the same on monsters, but monsters have their own specialized functionality as well.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_hp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_hp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s HP. Please note that this function has nothing to do with how to get or set a character&#039;s HP. In addition, the scale used by monster HP is &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; scaled up by a factor of 10.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxhp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxhp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s max HP.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_tint&amp;lt;/b&amp;gt;(id, RGB, ~[intensity])&lt;br /&gt;
:Sets the &#039;tint&#039; of a monster, to give it a glowing effect. Monsters flash when they are hit by various spells.  There is finally an optional intensity level parameter, set at 127 by default with a range of 0 to 255.  0 Being completely black.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai&amp;lt;/b&amp;gt;(id, message, data) ~[= result]&lt;br /&gt;
:Sends an [[DSB/Monster AI|Monster AI]] message to the given monster.&lt;br /&gt;
If data is QUERY then the function will return information on the given value, rather than setting it. For example, dsb_ai(id, AI_FEAR, QUERY) will return the monster&#039;s current level of fear. [[DSB/Monster AI|Monster AI]] documentation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_boss&amp;lt;/b&amp;gt;(id) = boss_id&lt;br /&gt;
:Returns the given monster id&#039;s boss. The &amp;quot;boss&amp;quot; is the monster in each tile who controls when the entire group moves and attacks. This allows DSB monsters to all be distinct entities, but move in DM-style groups.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_promote&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Promotes the given monster id to be the boss of its tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_subordinates&amp;lt;/b&amp;gt;(boss_id) = { {id, tile}, [...] }&lt;br /&gt;
:Returns all monsters who are subordinate to the given boss.&lt;br /&gt;
&lt;br /&gt;
==Messaging==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg&amp;lt;/b&amp;gt;(delay, id, message, data, ~[sender])&lt;br /&gt;
:Sends the specified [[DSB/Messages|Messages]] to the specified instance after the specified delay. Messages are simply integers. The object responds to the message as specified by its msg_handler, defined in its archetype. See &amp;lt;i&amp;gt;base/msg_handlers.lua&amp;lt;/i&amp;gt; for many examples of what can be done with message handlers. Normally it doesn&#039;t matter where a message comes from. However, it is possible to assert the sender of the message, in the rare cases where it is needed. (See [[DSB/Messages]] for more information on how to use messages)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg_chain&amp;lt;/b&amp;gt;(id, target_id)&lt;br /&gt;
:This causes the first instance to relay any messages it receives to the second instance. This is useful for making ceiling pits close at the same time floor pits do, and other situations where an instance should pass messages along.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_msgs_to&amp;lt;/b&amp;gt;(id, delay)&lt;br /&gt;
:Delays all messages bound for a given instance by the specified delay.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_enable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Enables an instance. This will clear its INACTIVE flag as well as make sure any events, triggerings, etc. that should happen do happen. This function is easier and safer to use than setting the flag directly.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_disable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Disables an instance. This will set its INACTIVE flag and make sure that any objects on it stop triggering it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_toggle&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:See the previous two.&lt;br /&gt;
&lt;br /&gt;
==Light==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light&amp;lt;/b&amp;gt;(handle) = lightlevel&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_light&amp;lt;/b&amp;gt;(handle, lightlevel)&lt;br /&gt;
:Gets or sets the light level on the given light handle, which is an integer from 0 to 9. The light level displayed is the sum of the dungeon level&#039;s base light level plus the 10 light handles. Currently, light handle 0 is used for light spells, handle 1 is used for torches, and 2 is used by illumulets.&lt;br /&gt;
&lt;br /&gt;
==Conditions==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_condition&amp;lt;/b&amp;gt;(type, inventory_gfx, portrait_gfx, update_freq, function, ~[flags]) = condition_id&lt;br /&gt;
:Adds a condition (status variable) to the list of those available. The type is either PARTY (affects the whole party) or INDIVIDUAL (affects one person). For individual conditions, two graphics can be specified, one that affects the inventory screen, the other that affects the portrait area. If type is PARTY the third parameter portrait_gfx is now considered as overlay_gfx and will be seen in the dungeon view port.  We can apply an underwater effect for example, as the overlay includes support for alpha channels if you want transparent parts.  &lt;br /&gt;
:If update_freq is &amp;gt; 0, the specified function will be called at the specified number of ticks. The function takes the following form:&lt;br /&gt;
&lt;br /&gt;
   function update_func(char, condition_strength)&lt;br /&gt;
     return new_condition_strength&lt;br /&gt;
   end&lt;br /&gt;
:&lt;br /&gt;
:Flags can be specified to control other aspects of the condition&#039;s appearance on the inventory screen. These flags are COND_MOUTH_RED, COND_MOUTH_GREEN, COND_EYE_RED, and COND_EYE_GREEN. These flags only affect INDIVIDUAL conditions. There was formerly a condition type called BAD_INDIVIDUAL that was an INDIVIDUAL condition with COND_MOUTH_RED. It is now &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;deprecated&amp;lt;/font&amp;gt;. Please don&#039;t use it in new code.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_condition&amp;lt;/b&amp;gt;(condition_id, type, inventory_gfx, portrait_gfx, update_freq, function)&lt;br /&gt;
:Replaces the information for the condition with the given id with the new condition. Good for changing conditions on the fly, but keep in mind that the fact that you&#039;ve changed the condition won&#039;t be saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_condition&amp;lt;/b&amp;gt;(char, condition) = strength&lt;br /&gt;
:Returns the strength of the specified condition for the specified character (or, in the case of conditions for the whole party, pass PARTY as the character)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_condition&amp;lt;/b&amp;gt;(char, condition, strength)&lt;br /&gt;
:Sets the strength of the condition. See previous function.&lt;br /&gt;
&lt;br /&gt;
==Popups and Readouts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_damage_popup&amp;lt;/b&amp;gt;(ppos, damage_type, integer)&lt;br /&gt;
:Shows the amount of damage taken by a character in a little popup over the character&#039;s name or portrait. The type is either HEALTH, STAMINA, or MANA, and a different background icon is displayed for each. The amount of damage shown should be in units as the player perceives them, not internal (so, divided by ten from internal representations)-- the default functions in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt; take care of this for you.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_damage&amp;lt;/b&amp;gt;(integer)&lt;br /&gt;
:This causes a number in a little explosion to appear in the area occupied by the attack icons. This is used for showing the amount of damage inflicted upon a monster by a melee attack.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_text&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:This causes text to momentarily appear in the area occupied by the attack icons. This is used for things like &amp;quot;CAN&#039;T REACH&amp;quot; or &amp;quot;NEED AMMO.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Fullscreen==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;(bitmap_or_func, click_func, update_func, mouse, fade)&lt;br /&gt;
:This engages the full-screen renderer, and is used for cut scenes or other interludes. If the first parameter passed is a bitmap, that bitmap will be displayed. If the first parameter is instead a function, that function will be executed every frame. The draw function will be passed the bitmap to draw to, the mouse&#039;s x location, and the mouse&#039;s y location, in the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;draw_function&amp;lt;/b&amp;gt;(bitmap, mouse_x, mouse_y)&amp;lt;/code&amp;gt;&lt;br /&gt;
:The click_func, if provided, will be executed every time the mouse is clicked. It is of the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;click_func&amp;lt;/b&amp;gt;(mouse_x, mouse_y, mouse_buttons)&amp;lt;/code&amp;gt;&lt;br /&gt;
:Update_func, if provided, will be executed every game tick. It takes no parameters.&lt;br /&gt;
:If mouse is nil or false, no mouse pointer will be drawn. If it is true, the standard &amp;quot;yellow arrow&amp;quot; mouse pointer will be drawn. If it is a bitmap, that bitmap will be drawn as the mouse pointer.&lt;br /&gt;
:There is an optional 5th parameter that allows a fade in/fade out.&lt;br /&gt;
:The full-screen renderer will run until any of its associated functions returns something other than false or nil, and the game logic does not advance while in &amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Subrenderers==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_subrenderer_target&amp;lt;/b&amp;gt;() = bitmap&lt;br /&gt;
:Returns a bitmap to be drawn upon. Use only in a [[DSB/Subrenderers|Subrenderer]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_objzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y)&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer bitmap. This object zone can be used to access instances that are stored inside of the given instance. See the implementation of chests in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for more information and examples.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msgzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y, width, height, msg, ~[data1, data2])&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer bitmap, with the given width and height. When it is clicked, the specified message will be sent to the instance. This can allow fairly complicated user interfaces in subrenderers.&lt;br /&gt;
:The third parameter, number, allows you to override/replace zones by specifying an existing handle. It also allows msgzones to have more information about where you clicked, because the zone number you clicked is passed as the msg&#039;s data parameter. If you don&#039;t care about any of this, just keep incrementing the number for every new zone. (See [[DSB/Messages]] for more information on how to use messages)&lt;br /&gt;
&lt;br /&gt;
==Global Data, Utility Functions, and Misc.==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gameflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Global Flags|Global Flag]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_hide_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_show_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Functions to make the mouse pointer appear or disappear.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_unlock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
:Functions to lock or unlock the game. Complete locking prevents most timers from running (though animations and delayed functions still will), processing any player input, or triggering anything. If you lock the game and forget to unlock it, it will be left in an unplayable state, so be very careful how you use this! Note that this takes effect immediately (that is, even before any queued moves), which may not always be what you want. You can also lock only certain parts of the game, using the [[DSB/Locking Flags|locking flags]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rand&amp;lt;/b&amp;gt;(min, max) = integer&lt;br /&gt;
:Generates a random integer between min and max, inclusive.&lt;br /&gt;
You should &amp;lt;b&amp;gt;always&amp;lt;/b&amp;gt; use this function for random number generation, not anything built into Lua.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_linesplit&amp;lt;/b&amp;gt;(string, split) = lines, number_of_lines&lt;br /&gt;
:A utility function that splits up a string into individual lines (placing the number of lines returned in number_of_lines) demarcated by the split character. &amp;quot;/&amp;quot; (slash) is a common choice for a a split character. See the implementation of scrolls in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for an example.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_forward&amp;lt;/b&amp;gt;(direction) = x, y&lt;br /&gt;
:A utility function that, given a direction, returns the x and y offsets of which way is &amp;quot;forward.&amp;quot; One will always be 1 or -1, the other will always be 0.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileshift&amp;lt;/b&amp;gt;(location, direction) = location&lt;br /&gt;
:A utility function that shifts the specified location in the specified direction. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lookup_global&amp;lt;/b&amp;gt;(string) = variable&lt;br /&gt;
:Returns the variable named by the specified string. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_func&amp;lt;/b&amp;gt;(delay, function)&lt;br /&gt;
:Executes the given function after the given delay in ticks. References to Lua functions cannot be saved, so queued functions will &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; be saved. This should be something nonvital if the game is not locked, and should happen quickly. In most cases, using a message on a delay, which is saved, would work better.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_inventory_info&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the inventory_info has been changed, this lets the engine know. Note that this state is not saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_system&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the system strings or player colors have been changed, this lets the engine know. This may or may not be useful. With the moving of most inventory rendering into Lua-controlled subrenderers, this function has limited use.&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_export&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:Normally, Lua global variables aren&#039;t saved in savegames, however, a few usually need to be. If you need to store a global variable, add it to the export list with this function. Note that dsb_export requires a string giving the name of the variable. Don&#039;t pass the variable itself! You should also note that if you have a very long export list, you&#039;re probably doing something that could be done more easily with specialized code or more careful use of instances with exvars. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport&amp;lt;/b&amp;gt;(x, y)&lt;br /&gt;
:Sets the viewport. Odds are you should leave this one alone.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_enable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_disable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Enables or disables the specified magical rune for use in spells. All runes are enabled by default, just like in original DM. The rune is specified as an integer, where 1 = LO, 2 = UM, 7 = YA, and so on.&lt;br /&gt;
&lt;br /&gt;
These functions are now deprecated. You should manipulate the &amp;lt;b&amp;gt;g_disabled_runes&amp;lt;/b&amp;gt; table directly. For example, disabling the VI rune (rune 8) is as simple as &amp;lt;code&amp;gt;g_disabled_runes~[8] = false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_game_end&amp;lt;/b&amp;gt;(~[bool])&lt;br /&gt;
:Shows a game ending screen. Normally it&#039;s a bit more fun than the screen you get when the party dies, but if you pass it a boolean &#039;true&#039;, it will just show the standard blue &amp;quot;The End&amp;quot; screen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:This function creates a new arch type, from the original passed in as a parameter.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Pending Documentation==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_msgtype&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_include_file&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_screen_bitmap&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_cache_invalidate&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileptr_exch&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_contains&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_viewing&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_affecting&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_checksound&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gamelocks&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light_total&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_light_totalmax&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_exviewinst&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_import_arch&amp;lt;/b&amp;gt;(???) = [http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=27277&amp;amp;p=83877&amp;amp;hilit=dsb_import_arch#p83877 ?][http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=29188&amp;amp;p=128330&amp;amp;hilit=dsb_import_arch#p128330 ?][http://dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28859&amp;amp;sid=c8dec8095c76d7ce5937980e94499ceb&amp;amp;p=130029#p130029 ?]&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Exposed functions]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Messages&amp;diff=2969</id>
		<title>DSB/Messages</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Messages&amp;diff=2969"/>
		<updated>2012-11-13T23:05:25Z</updated>

		<summary type="html">&lt;p&gt;Sophia: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Base messages as defined by DSB and used in ESB are the following:&lt;br /&gt;
* Activate (M_ACTIVATE) - Enables instances, opens pits, closes doors, triggers generators, etc.&lt;br /&gt;
* Deactivate (M_DEACTIVATE) - Disables instances, closes pits, opens doors, etc.&lt;br /&gt;
* Toggle (M_TOGGLE) - Enables a disabled instance and disables an enabled one.&lt;br /&gt;
* Next Tick (M_NEXTTICK) - Tells instances to proceed. Makes doors continue to open and close, monster generators re-enable, etc.&lt;br /&gt;
* Expire (M_EXPIRE) - Triggers an &amp;lt;b&amp;gt;on_expire&amp;lt;/b&amp;gt; event, or simply destroys the instance if there is no such event.&lt;br /&gt;
* Clean Up (M_CLEANUP) - Deletes the targeted instance from the target list of all instances in the dungeon.&lt;br /&gt;
* Reset Counter (M_RESET) - Sets a counter back to its default value.&lt;br /&gt;
* Destroy (M_DESTROY) - Removes the instance from the dungeon. This can cause Lua errors if triggers etc. target it and it isn&#039;t sent a Clean Up first.&lt;br /&gt;
Define new messages with &amp;lt;b&amp;gt;dsb_add_msgtype&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
There is also a special set of messages that can be sent to the special target SYSTEM, either from &amp;lt;b&amp;gt;dsb_msg&amp;lt;/b&amp;gt; or from a msgzone.&lt;br /&gt;
&lt;br /&gt;
They take some extra parameters, which can be either sent as data with the msg, or added as parameters to the call to &amp;lt;b&amp;gt;dsb_msgzone&amp;lt;/b&amp;gt;.&lt;br /&gt;
(i.e., this special case of &amp;lt;b&amp;gt;dsb_msgzone&amp;lt;/b&amp;gt; takes 10 parameters instead of the usual 8)&lt;br /&gt;
The extra parameters are noted after the name of the system message. If a 0 is listed, just pass 0.&lt;br /&gt;
&lt;br /&gt;
* SYS_MAGIC_PPOS (ppos, 0) = Sets the currently displayed spellcaster to the specified ppos.&lt;br /&gt;
* SYS_MAGIC_RUNE (ppos, rune_number) = Stores the specified rune into the specified ppos&#039;s pending spell.&lt;br /&gt;
* SYS_MAGIC_BACK (ppos, 0) = Deletes the last rune from the specified ppos&#039;s pending spell.&lt;br /&gt;
* SYS_MAGIC_CAST (ppos, 0) = Casts the current spell for the specified ppos. Does a bit of internal processing and then calls &amp;lt;b&amp;gt;sys_spell_cast&amp;lt;/b&amp;gt;.&lt;br /&gt;
* SYS_METHOD_OBJ (ppos, location) = Shows the attack method dialogue for a given ppos from a given location&lt;br /&gt;
* SYS_METHOD_SEL (inst, method) = Selects the given attack method for the given instance. (Note: Currently, if the method was not first popped up via * SYS_METHOD_OBJ, this will do nothing.)&lt;br /&gt;
* SYS_METHOD_CLEAR (ppos, 0) = Clears the attack method for the given ppos.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Messages]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Messages&amp;diff=2968</id>
		<title>DSB/Messages</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Messages&amp;diff=2968"/>
		<updated>2012-11-13T22:52:06Z</updated>

		<summary type="html">&lt;p&gt;Sophia: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Base messages as defined by DSB and used in ESB are the following:&lt;br /&gt;
* Activate (M_ACTIVATE) - Enables instances, opens pits, closes doors, triggers generators, etc.&lt;br /&gt;
* Deactivate (M_DEACTIVATE) - Disables instances, closes pits, opens doors, etc.&lt;br /&gt;
* Toggle (M_TOGGLE) - Enables a disabled instance and disables an enabled one.&lt;br /&gt;
* Next Tick (M_NEXTTICK) - Tells instances to proceed. Makes doors continue to open and close, monster generators re-enable, etc.&lt;br /&gt;
* Expire (M_EXPIRE) - Triggers an &amp;lt;b&amp;gt;on_expire&amp;lt;/b&amp;gt; event, or simply destroys the instance if there is no such event.&lt;br /&gt;
* Clean Up (M_CLEANUP) - Deletes the targeted instance from the target list of all instances in the dungeon.&lt;br /&gt;
* Reset Counter (M_RESET) - Sets a counter back to its default value.&lt;br /&gt;
* Destroy (M_DESTROY) - Removes the instance from the dungeon. This can cause Lua errors if triggers etc. target it and it isn&#039;t sent a Clean Up first.&lt;br /&gt;
&lt;br /&gt;
Define new messages with &amp;lt;b&amp;gt;dsb_add_msgtype&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Messages]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Events_and_System_Functions&amp;diff=2298</id>
		<title>DSB/Events and System Functions</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Events_and_System_Functions&amp;diff=2298"/>
		<updated>2012-08-07T18:12:38Z</updated>

		<summary type="html">&lt;p&gt;Sophia: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== System Functions ==&lt;br /&gt;
When certain things happen globally, or values are needed, the game engine will call &amp;lt;b&amp;gt;sys_&amp;lt;/b&amp;gt; functions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
All of them are contained in &amp;lt;i&amp;gt;base/system.lua&amp;lt;/i&amp;gt; (except for the rendering-related ones, in &amp;lt;i&amp;gt;base/render.lua&amp;lt;/i&amp;gt;), so look there for now. If anyone wants to wiki-ize the list, feel free. I&#039;ll be working mostly on things that I haven&#039;t documented somewhere else. -- Sophia&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
When certain things happen to a specific object, the game engine (or, sometimes, the [[DSB/Base Code|Base Code]]) will call various events associated with an object arch.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_throw&amp;lt;/b&amp;gt;(self, id, location)&lt;br /&gt;
:The &#039;&#039;&#039;location&#039;&#039;&#039; is where the object is thrown &amp;quot;from,&amp;quot; via an attack method. It is &#039;&#039;&#039;nil&#039;&#039;&#039; if the object is thrown from the mouse hand. In that case, if you need to assume the throw came from some inventory zone, you can use the global variable &amp;lt;b&amp;gt;mouse_throwing_hand&amp;lt;/b&amp;gt;.&lt;br /&gt;
:See also &amp;lt;i&amp;gt;base/methods.lua&amp;lt;/i&amp;gt;: &amp;lt;b&amp;gt;method_throw_obj&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_impact&amp;lt;/b&amp;gt;(self, id, hit_what, hit_ppos)&lt;br /&gt;
:This function is called when an inst hits something. If it hits a monster or object, &amp;lt;b&amp;gt;hit_what&amp;lt;/b&amp;gt; will be set to an inst id. If it hits a party member, &amp;lt;b&amp;gt;hit_what&amp;lt;/b&amp;gt; will be &amp;lt;b&amp;gt;nil&amp;lt;/b&amp;gt;, &amp;lt;b&amp;gt;hit_ppos&amp;lt;/b&amp;gt; will be the party position that it hit.&lt;br /&gt;
:See also &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt;: &#039;&#039;&#039;explode_thing&#039;&#039;&#039;, &#039;&#039;&#039;poisonbomb_thing&#039;&#039;&#039;, etc.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_deplete&amp;lt;/b&amp;gt;(self, id)&lt;br /&gt;
:When an inst with charges consumes its last charge, this event is called. If this event doesn&#039;t exist, but the arch has a &#039;&#039;&#039;convert_deplete&#039;&#039;&#039; property, a &#039;&#039;&#039;dsb_swap&#039;&#039;&#039; is executed. Otherwise, the object is deleted.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_click&amp;lt;/b&amp;gt;(self, id, clicked_with, cx, cy)&lt;br /&gt;
:Used on a mirror, or a compass. The cx and cy values are the exact coordinates (relative to the upper left corner of the object&#039;s bitmap) that you clicked on, making it possible to define custom &amp;quot;click zones&amp;quot; with a bit of hacking.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_look&amp;lt;/b&amp;gt;(self, id, whose_eye) = new_id&lt;br /&gt;
:This is called when you click on someone&#039;s eye with an inst. If it returns an id, that id is shown, instead of the one actually held to the eye.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_drop&amp;lt;/b&amp;gt;(self, id)&lt;br /&gt;
:Called when an inst is dropped. If it returns true, the inst can&#039;t be dropped.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_zone_drop&amp;lt;/b&amp;gt;(self, drop_zone_id, dropped_obj_id)&lt;br /&gt;
:Called when an inst is dropped into a drop zone (i.e., an alcove). If it returns true, the alcove won&#039;t accept the inst.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_trigger&amp;lt;/b&amp;gt;(self, id, trigger_id)&lt;br /&gt;
:Called when something is put on a flooritem. (If trigger_id is nil, it&#039;s the party)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;off_trigger&amp;lt;/b&amp;gt;(self, id, trigger_id)&lt;br /&gt;
:Called when something comes off a flooritem. (If trigger_id is nil, it&#039;s the party)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_turn&amp;lt;/b&amp;gt;(self, id, dir)&lt;br /&gt;
:Useful for the compass, for example.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_fly&amp;lt;/b&amp;gt;(id, x, y, tile, face, flytimer)&lt;br /&gt;
:Used in the &#039;&#039;&#039;test_dungeon&#039;&#039;&#039;, see crazy axe.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_consume&amp;lt;/b&amp;gt;&lt;br /&gt;
:See &#039;&#039;function eatdrink&#039;&#039;, where you need to set a foodval or waterval property for the arch type.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_spawn&amp;lt;/b&amp;gt;&lt;br /&gt;
:Fired when created, such as a monster death cloud of dust.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_melee_damage_monster&amp;lt;/b&amp;gt;&lt;br /&gt;
:An event for hooking attack methods of specific weapons&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_monster_move_into&amp;lt;/b&amp;gt;&lt;br /&gt;
;Event for objects that handle monster movement in special ways&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;on_teleport&amp;lt;/b&amp;gt;&lt;br /&gt;
:Called when teleporting the object.&lt;br /&gt;
&lt;br /&gt;
Also for the inventory there are events such as &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;to_feet&amp;lt;/b&amp;gt;(id, who)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;from_feet&amp;lt;/b&amp;gt;(id, who)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;to_neck&amp;lt;/b&amp;gt;(id, who)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;from_neck&amp;lt;/b&amp;gt;(id, who)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;to_r_hand&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;from_r_hand&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;to_l_hand&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;from_l_hand&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; and I just found &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;after_from_r_hand&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;after_from_l_hand&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; which pleases me greatly... Where I&#039;ve finally found a &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;to_anywhere&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;from_anywhere&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; event.&lt;br /&gt;
&lt;br /&gt;
Not an &#039;event&#039; as such but we also have &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;flying_away&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;flying_toward&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;flying_side&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; properties to assign if necessary for a bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;potion_effect&amp;lt;/b&amp;gt;(id, who, base_power)&lt;br /&gt;
:Create your own potions and effects.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;hit_sound&amp;lt;/b&amp;gt;&lt;br /&gt;
:Used for weapons, assigning a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;namechanger&amp;lt;/b&amp;gt;(id, who_look)&lt;br /&gt;
:Used with the bones object or a Ven Bomb for example.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;subrenderer&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Yeah, this is a good one... See the objects.lua&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;objzone_check&amp;lt;/b&amp;gt;(id, putting_in, zone)&lt;br /&gt;
:See the objects.lua&lt;br /&gt;
&lt;br /&gt;
Things such as stairs are objects of course and have events such as &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;on_trigger&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;off_trigger&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;on_turn&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;on_try_move&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt;, ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Events and System Functions]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Locking_Flags&amp;diff=1908</id>
		<title>DSB/Locking Flags</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Locking_Flags&amp;diff=1908"/>
		<updated>2011-04-20T22:28:59Z</updated>

		<summary type="html">&lt;p&gt;Sophia: Created page with &amp;quot;; LOCK_ACTUATORS : Triggers will not work ; LOCK_MOVEMENT : Party cannot move ; LOCK_MOUSE : Mouse clicks will not work at all ; LOCK_MAGIC : Cannot enter runes or cast spells ; ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;; LOCK_ACTUATORS : Triggers will not work&lt;br /&gt;
; LOCK_MOVEMENT : Party cannot move&lt;br /&gt;
; LOCK_MOUSE : Mouse clicks will not work at all&lt;br /&gt;
; LOCK_MAGIC : Cannot enter runes or cast spells&lt;br /&gt;
; LOCK_INVENTORY : Cannot view inventories&lt;br /&gt;
; LOCK_ATTACK : Cannot trigger attack methods&lt;br /&gt;
; LOCK_FLYERS : Flying objects will not update&lt;br /&gt;
; LOCK_CONDITIONS : Timed conditions will not update&lt;br /&gt;
; LOCK_MESSAGES : Message timers will not run&lt;br /&gt;
; LOCK_ALL_TIMERS : No game timers will run at all&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/DSB_for_RTC_users&amp;diff=1839</id>
		<title>DSB/DSB for RTC users</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/DSB_for_RTC_users&amp;diff=1839"/>
		<updated>2011-04-16T18:41:55Z</updated>

		<summary type="html">&lt;p&gt;Sophia: /* Floor Triggers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here are some tips and tricks for using DSB if you&#039;re used to using RTC.&lt;br /&gt;
&lt;br /&gt;
==Floor Triggers==&lt;br /&gt;
Unlike in RTC, DSB floor triggers need not be on the CENTER of the tile. By placing them on one of the other directions, you can respond only to objects that are in that position.&lt;br /&gt;
&lt;br /&gt;
It may also be important to note that unlike in RTC (I think?), no guarantee is made as to the order that multiple triggers on one tile will execute. If you need to do a complex set of tasks in a specific order, write some custom Lua code. You can also use one trigger linked to multiple targets, but you should also be aware that there is no guarantee of the order that two messages arriving in the same tick will be processed.&lt;br /&gt;
&lt;br /&gt;
As of DSB 0.45 or so, the DSB message queue has been changed so that messages arriving from the same originator will arrive in order. This means that to rapidly enable and then disable something, you can continue using the RTC idiom of sending it two Toggle messages (necessary in RTC to avoid using a relay) but you can also send it an Activate and then a Deactivate and it will work properly.&lt;br /&gt;
&lt;br /&gt;
To summarize:&lt;br /&gt;
* &amp;lt;b&amp;gt;Multiple messages from the same originator to the same target&amp;lt;/b&amp;gt; - Will arrive in the order sent&lt;br /&gt;
* &amp;lt;b&amp;gt;Multiple messages from the same originator to different targets&amp;lt;/b&amp;gt; - Will arrive in the order sent&lt;br /&gt;
* &amp;lt;b&amp;gt;Multiple messages from different originators to the same target&amp;lt;/b&amp;gt; - No guarantees are made as to order&lt;br /&gt;
&lt;br /&gt;
==Alcoves==&lt;br /&gt;
DSB alcoves are, in general, much simpler than RTC alcoves. To do complicated things in response to objects put into an alcove, put a floor trigger on the same square as the alcove and use that instead. In particular, DSB alcoves have no concept of constant weight; you will need to use a floor trigger. A CENTER&#039;d floor trigger will respond to anything put in any alcove on that tile. To respond only to a single alcove on a tile with multiple alcoves, put the trigger on the same direction as the alcove. (That is, to respond only to the alcove on the NORTH side of the tile, put the floor trigger in the NORTH tile position, not in the CENTER)&lt;br /&gt;
&lt;br /&gt;
==WALLITEM_RELAY==&lt;br /&gt;
The &amp;quot;x_relay&amp;quot; arch is designed to be an accurate emulation of RTC&#039;s WALLITEM_RELAY, but for new dungeons, DSB&#039;s own native &amp;quot;msg_sender&amp;quot; arch includes more functionality, including the ability to specify a repeat rate. For really complex relays, you&#039;re best off just converting their functionality to Lua code.&lt;br /&gt;
&lt;br /&gt;
However, one of the most common applications of relays, increasing the number of targets and/or changing the message type, is not even needed in DSB: while RTC has a maximum of eight targets per trigger and they must all be sent the same message, DSB allows an effectively unlimited number, and in addition, each target can have a different message. For example : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
exvar[trigger_id] = { target = {id1, id2, id3}, msg = {M_ACTIVATE, M_TOGGLE, M_DEACTIVATE} }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will cause &amp;lt;code&amp;gt;trigger_id&amp;lt;/code&amp;gt; to send M_ACTIVATE to id1, M_TOGGLE to id2, and M_DEACTIVATE to id3.&lt;br /&gt;
&lt;br /&gt;
ESB&#039;s target editor takes care of all of this automatically.&lt;br /&gt;
&lt;br /&gt;
==Door Buttons==&lt;br /&gt;
DSB door buttons are treated the same as any other button. Unlike RTC door buttons, they must be explicitly given a message and a target if you create them by hand. ESB will take care of automatically linking door buttons with their doors. Of course, the upside to this slightly greater complexity is that door buttons in DSB can do anything that any other button can do, not just open a door on the same tile.&lt;br /&gt;
&lt;br /&gt;
==Wallsets==&lt;br /&gt;
RTC wallsets should work, unmodified, in DSB as &amp;quot;ext wallsets,&amp;quot; using &amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==PNG and Alpha Channels==&lt;br /&gt;
DSB supports PNG images now, so they also should work unmodified.&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|DSB for RTC users]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/DSB_for_RTC_users&amp;diff=1838</id>
		<title>DSB/DSB for RTC users</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/DSB_for_RTC_users&amp;diff=1838"/>
		<updated>2011-04-16T18:38:45Z</updated>

		<summary type="html">&lt;p&gt;Sophia: /* Floor Triggers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here are some tips and tricks for using DSB if you&#039;re used to using RTC.&lt;br /&gt;
&lt;br /&gt;
==Floor Triggers==&lt;br /&gt;
Unlike in RTC, DSB floor triggers need not be on the CENTER of the tile. By placing them on one of the other directions, you can respond only to objects that are in that position.&lt;br /&gt;
&lt;br /&gt;
It may also be important to note that unlike in RTC (I think?), no guarantee is made as to the order that multiple triggers on one tile will execute. If you need to do a complex set of tasks in a specific order, write some custom Lua code. You can also use one trigger linked to multiple targets, but you should also be aware that there is no guarantee of the order that two messages arriving in the same tick will be processed.&lt;br /&gt;
&lt;br /&gt;
As of DSB 0.45 or so, the DSB message queue has been changed so that messages arriving at the same target from the same originator will arrive in order. This means that to rapidly enable and then disable something, you can continue using the RTC idiom of sending it two Toggle messages (necessary in RTC to avoid using a relay) but you can also send it an Activate and then a Deactivate and it will work properly.&lt;br /&gt;
&lt;br /&gt;
==Alcoves==&lt;br /&gt;
DSB alcoves are, in general, much simpler than RTC alcoves. To do complicated things in response to objects put into an alcove, put a floor trigger on the same square as the alcove and use that instead. In particular, DSB alcoves have no concept of constant weight; you will need to use a floor trigger. A CENTER&#039;d floor trigger will respond to anything put in any alcove on that tile. To respond only to a single alcove on a tile with multiple alcoves, put the trigger on the same direction as the alcove. (That is, to respond only to the alcove on the NORTH side of the tile, put the floor trigger in the NORTH tile position, not in the CENTER)&lt;br /&gt;
&lt;br /&gt;
==WALLITEM_RELAY==&lt;br /&gt;
The &amp;quot;x_relay&amp;quot; arch is designed to be an accurate emulation of RTC&#039;s WALLITEM_RELAY, but for new dungeons, DSB&#039;s own native &amp;quot;msg_sender&amp;quot; arch includes more functionality, including the ability to specify a repeat rate. For really complex relays, you&#039;re best off just converting their functionality to Lua code.&lt;br /&gt;
&lt;br /&gt;
However, one of the most common applications of relays, increasing the number of targets and/or changing the message type, is not even needed in DSB: while RTC has a maximum of eight targets per trigger and they must all be sent the same message, DSB allows an effectively unlimited number, and in addition, each target can have a different message. For example : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
exvar[trigger_id] = { target = {id1, id2, id3}, msg = {M_ACTIVATE, M_TOGGLE, M_DEACTIVATE} }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will cause &amp;lt;code&amp;gt;trigger_id&amp;lt;/code&amp;gt; to send M_ACTIVATE to id1, M_TOGGLE to id2, and M_DEACTIVATE to id3.&lt;br /&gt;
&lt;br /&gt;
ESB&#039;s target editor takes care of all of this automatically.&lt;br /&gt;
&lt;br /&gt;
==Door Buttons==&lt;br /&gt;
DSB door buttons are treated the same as any other button. Unlike RTC door buttons, they must be explicitly given a message and a target if you create them by hand. ESB will take care of automatically linking door buttons with their doors. Of course, the upside to this slightly greater complexity is that door buttons in DSB can do anything that any other button can do, not just open a door on the same tile.&lt;br /&gt;
&lt;br /&gt;
==Wallsets==&lt;br /&gt;
RTC wallsets should work, unmodified, in DSB as &amp;quot;ext wallsets,&amp;quot; using &amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==PNG and Alpha Channels==&lt;br /&gt;
DSB supports PNG images now, so they also should work unmodified.&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|DSB for RTC users]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/DSB_for_RTC_users&amp;diff=1837</id>
		<title>DSB/DSB for RTC users</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/DSB_for_RTC_users&amp;diff=1837"/>
		<updated>2011-04-16T18:34:03Z</updated>

		<summary type="html">&lt;p&gt;Sophia: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here are some tips and tricks for using DSB if you&#039;re used to using RTC.&lt;br /&gt;
&lt;br /&gt;
==Floor Triggers==&lt;br /&gt;
Unlike in RTC, DSB floor triggers need not be on the CENTER of the tile. By placing them on one of the other directions, you can respond only to objects that are in that position.&lt;br /&gt;
&lt;br /&gt;
It may also be important to note that unlike in RTC (I think?), no guarantee is made as to the order that multiple triggers on one tile will execute. If you need to do a complex set of tasks in a specific order, write some custom Lua code. You can also use one trigger linked to multiple targets, but you should also be aware that there is no guarantee of the order that two messages arriving in the same tick will be processed.&lt;br /&gt;
&lt;br /&gt;
If you want to rapidly enable and disable something, the best way is to continue using the RTC idiom of sending it two toggle messages. In RTC, this was necessary to avoid using a relay; in DSB, this is not the case (see WALLITEM_RELAY below) but sending an activate and a deactivate that arrive in the same tick may arrive in the wrong order, leading to undesired results.&lt;br /&gt;
&lt;br /&gt;
==Alcoves==&lt;br /&gt;
DSB alcoves are, in general, much simpler than RTC alcoves. To do complicated things in response to objects put into an alcove, put a floor trigger on the same square as the alcove and use that instead. In particular, DSB alcoves have no concept of constant weight; you will need to use a floor trigger. A CENTER&#039;d floor trigger will respond to anything put in any alcove on that tile. To respond only to a single alcove on a tile with multiple alcoves, put the trigger on the same direction as the alcove. (That is, to respond only to the alcove on the NORTH side of the tile, put the floor trigger in the NORTH tile position, not in the CENTER)&lt;br /&gt;
&lt;br /&gt;
==WALLITEM_RELAY==&lt;br /&gt;
The &amp;quot;x_relay&amp;quot; arch is designed to be an accurate emulation of RTC&#039;s WALLITEM_RELAY, but for new dungeons, DSB&#039;s own native &amp;quot;msg_sender&amp;quot; arch includes more functionality, including the ability to specify a repeat rate. For really complex relays, you&#039;re best off just converting their functionality to Lua code.&lt;br /&gt;
&lt;br /&gt;
However, one of the most common applications of relays, increasing the number of targets and/or changing the message type, is not even needed in DSB: while RTC has a maximum of eight targets per trigger and they must all be sent the same message, DSB allows an effectively unlimited number, and in addition, each target can have a different message. For example : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
exvar[trigger_id] = { target = {id1, id2, id3}, msg = {M_ACTIVATE, M_TOGGLE, M_DEACTIVATE} }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will cause &amp;lt;code&amp;gt;trigger_id&amp;lt;/code&amp;gt; to send M_ACTIVATE to id1, M_TOGGLE to id2, and M_DEACTIVATE to id3.&lt;br /&gt;
&lt;br /&gt;
ESB&#039;s target editor takes care of all of this automatically.&lt;br /&gt;
&lt;br /&gt;
==Door Buttons==&lt;br /&gt;
DSB door buttons are treated the same as any other button. Unlike RTC door buttons, they must be explicitly given a message and a target if you create them by hand. ESB will take care of automatically linking door buttons with their doors. Of course, the upside to this slightly greater complexity is that door buttons in DSB can do anything that any other button can do, not just open a door on the same tile.&lt;br /&gt;
&lt;br /&gt;
==Wallsets==&lt;br /&gt;
RTC wallsets should work, unmodified, in DSB as &amp;quot;ext wallsets,&amp;quot; using &amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==PNG and Alpha Channels==&lt;br /&gt;
DSB supports PNG images now, so they also should work unmodified.&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|DSB for RTC users]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=1577</id>
		<title>DSB/Exposed functions</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=1577"/>
		<updated>2010-12-19T22:05:53Z</updated>

		<summary type="html">&lt;p&gt;Sophia: /* Levels and Wallsets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Functions are given in the form:&lt;br /&gt;
;&amp;lt;b&amp;gt;function&amp;lt;/b&amp;gt;(arguments, ~[optional arguments]) = return value&lt;br /&gt;
:If the terminology doesn&#039;t make sense, check [DSBTerms].&lt;br /&gt;
Functions without a dsb_ prefix are part of [[DSB/Base Code|base/]], not the core engine.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_insts&amp;lt;/b&amp;gt;()&lt;br /&gt;
:This is an iterator used in Lua&#039;s for loops. To iterate over all instances of objects in a DSB dungeon, use something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for i in dsb_insts()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_in_obj&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Another iterator; see above for usage. This one is used to iterate all over all instances that are inside the given instance.&lt;br /&gt;
&lt;br /&gt;
==Bitmaps and Drawing==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name) = bitmap&lt;br /&gt;
:Searches the dungeon&#039;s directory for the bitmap, and then &amp;lt;i&amp;gt;graphics.dsb&amp;lt;/i&amp;gt;, and finally the default &amp;lt;i&amp;gt;graphics.dat&amp;lt;/i&amp;gt;. Returns a truecolor bitmap, but the bitmap can be 256 colors on disk to save space. Don&#039;t specify a file extension as DSB will figure it out.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name, relative_path) = bitmap&lt;br /&gt;
:Same as above but with subdirectories.  Example: &amp;quot;path/to/actual/file.ext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mask_bitmap(name)&amp;lt;/b&amp;gt; = bitmap&lt;br /&gt;
:This function loads a bitmap that requires two distinct regions of transparency that are used at different times, such as see-through door decorations or magic windows. The region that is transparent when the image is first blitted is represented by color 0, whereas the region that is &amp;quot;see through&amp;quot; is in the usual magenta color. This requires a 256 color bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_new_bitmap&amp;lt;/b&amp;gt;(xsize, ysize) = bitmap&lt;br /&gt;
:Creates a brand new bitmap and returns a reference to it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_destroy_bitmap&amp;lt;/b&amp;gt;(bitmap)&lt;br /&gt;
:Completely destroys a bitmap. Rarely needed, as Lua&#039;s garbage collector will automatically scoop up out-of-scope bitmaps. You should only invoke this by hand if you know for sure why you need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_clone_bitmap&amp;lt;/b&amp;gt;(bitmap) = bitmap&lt;br /&gt;
:Creates a &amp;quot;virtual bitmap&amp;quot; clone of the specified bitmap. It shares the same actual memory, but can have different offsets. This is useful if you, for example, have several wallitems for which you want to draw the same image on different parts of the wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_animate&amp;lt;/b&amp;gt;(bitmap, frames, frame_delay)&lt;br /&gt;
:Sets up a bitmap that is a series of frames for animation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_clear&amp;lt;/b&amp;gt;(bitmap, RGB)&lt;br /&gt;
:Clears a bitmap to the specified RGB value. An RGB is specified as a table of { R, G, B }.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_blit&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x_src, y_src, x_dest, y_dest, width, height)&lt;br /&gt;
:Blits one bitmap onto another.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_draw&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x, y, flip)&lt;br /&gt;
:Draws the entire source bitmap on to the destination, taking any animation or offsets into account. Pass true to flip to horizontally flip the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_width&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_bitmap_height&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
:Returns the dimension of the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_rect&amp;lt;/b&amp;gt;(bitmap, x_src, y_src, x_dest, y_dest, color, filled)&lt;br /&gt;
:Draws a rectangle. Pass true to filled for a filled rectangle.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;(bitmap, font, string, x, y, alignment, color) = integer&lt;br /&gt;
:Renders text onto a bitmap in the specified font and color, with the specified alignment: (LEFT, RIGHT, CENTER, or MULTILINE).  Returns the number of lines printed.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_dungeon_view&amp;lt;/b&amp;gt;(lev, x, y, dir, light) = bitmap&lt;br /&gt;
:Return a rendering of the viewport.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Fonts and Text==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_font&amp;lt;/b&amp;gt;(name, relative_path) = font&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a font.  Example with a subdirectory: &lt;br /&gt;
:&amp;lt;code&amp;gt;gfx[&amp;quot;GAUDYMEDIEVALFONT&amp;quot;] = dsb_get_font(&amp;quot;GAUDYMEDIEVAL&amp;quot;, &amp;quot;fonts/gaudymedieval.pcx&amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_textformat&amp;lt;/b&amp;gt;(chars_per_line, y_offset_per_line, max_lines)&lt;br /&gt;
:This controls the format of MULTILINE text output by &amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;. The Y offsets are also used by the console (the text below the game view). By setting chars_per_line to something unreasonable, you can effectively disable word wrapping.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_write&amp;lt;/b&amp;gt;(RGB, string)&lt;br /&gt;
:Outputs the given text string in the given color to the console. (that is, a table of { R, G, B })&lt;br /&gt;
&lt;br /&gt;
==Sound and Music==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sound&amp;lt;/b&amp;gt;(name) = sound&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_sound&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound. An optional boolean parameter allows you to specify if the sound should loop. Be careful, the only way to stop a looping sound is via &amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;, so don&#039;t lose the channel handle!&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_3dsound&amp;lt;/b&amp;gt;(sound, lev, x, y, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound as though it originated from the given location in the dungeon. An optional boolean parameter allows you to specify if the sound should loop. Note that &amp;lt;i&amp;gt;base/util.lua&amp;lt;/i&amp;gt; also includes a useful function, explained next:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;local_sound&amp;lt;/b&amp;gt;(id, sound) = chan_handle&lt;br /&gt;
:Plays a sound that appears to originate from the location of a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Stops the sound playing on a channel handle previously returned by a call to a sound playing function.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_soundvol&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Obtains the current volume of the sound, ranging from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_soundvol&amp;lt;/b&amp;gt;(chan_handle, volume) &lt;br /&gt;
:Adjusts the volume of the sound, with the volume range from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
==Levels and Wallsets==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_getinfo&amp;lt;/b&amp;gt;(level) = x_size, y_size, light, xp_multiplier&lt;br /&gt;
:Returns the basic info about a level.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_tint&amp;lt;/b&amp;gt;(level, RGB)&lt;br /&gt;
:Tells DSB to tint the dynamically scaled and shaded objects in a level a certain way. By default, this is {0, 0, 0}, causing the dungeon to fade to black, just like DM, but if the ambient light color is different, or you are outdoors and fade to a misty grey instead of black, you will probably want to change this.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. Wallsets in DM 2.x ([CSBwin]) are easiest to use with this command, as they have a single very long wall, as opposed to assembling the front view out of &amp;quot;left&amp;quot; and &amp;quot;front&amp;quot; bitmaps. (see the next command)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, left1, left1alt, left2, left2alt, left3, left3alt, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. This command takes 6 more arguments: 6 &amp;quot;left side&amp;quot; bitmaps. If you&#039;re using a converted DM2, [[DSB/DSB for RTC users|DSB for RTC users]], or WHACK wallset, you&#039;ll find this command useful.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_wallset&amp;lt;/b&amp;gt;(level, wallset)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_use_wallset&amp;lt;/b&amp;gt;(level, wallset) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Tells DSB to use the specified wallset on the specified level.&lt;br /&gt;
Note: this function was formerly known as &amp;quot;dsb_use_wallset,&amp;quot; and that is still a synonym for it, for now. In new dungeons, please use the new name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_alt_wallset&amp;lt;/b&amp;gt;(wallset, level, x, y, dir)&lt;br /&gt;
:Tells DSB to use the specified wallset only on the given direction of the given tile. If CENTER is specified, it will use that wallset on all directions of the given tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(wallset, flip)&lt;br /&gt;
:Pass true to flip to automatically flip the roof every other step, like standard floors, or pass a bitmap to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the floor with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the floor every other step, like standard floors, or pass a second bitmap name to have a different bitmap show up when the floor is &amp;quot;flipped.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(bitmap_name, flip)&lt;br /&gt;
:Overrides the roof with the bitmap in the gfx table with the given name, regardless of what wallset is in use. Pass true to flip to automatically flip the roof every other step, like standard roofs, or pass a second bitmap name to have a different bitmap show up when the roof is &amp;quot;flipped.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_text2map&amp;lt;/b&amp;gt;(level, x_size, y_size, light, xp_multiplier, maptable)&lt;br /&gt;
:Converts a table with a text-based map into a level. Each row of the table should represent a row of the dungeon, and contain a string with 0&#039;s or 1&#039;s representing walls and floors in that row. In this way, it is very similar to how dungeons are declared in an [[DSB/DSB for RTC users|DSB for RTC users]] text file.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_image2map&amp;lt;/b&amp;gt;(level, filename, light, xp_multiplier) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Converts a bitmap image into a level. One pixel = one square. It must be a 256 color image, where color 0 represents walls, color 1 represents open space, and further colors can be used to represent various objects in the dungeon by means of a conversion table. This function is now mostly deprecated because everyone is using ESB anyway.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_cell&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns a boolean specifying whether or not the given cell in the dungeon is a wall. Use &amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt; to find out anything else about what&#039;s there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_cell&amp;lt;/b&amp;gt;(level, x, y, value)&lt;br /&gt;
:Sets whether the given cell in the dungeon is a wall or open space. A value of nil, false, or 0 represents open space. A value of true or any other integer represents a wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_visited&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns whether the party has visited the given dungeon cell. A wall will never be visited, unless it wasn&#039;t a wall at some point in the past.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp_multiplier&amp;lt;/b&amp;gt;(level) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp_multiplier&amp;lt;/b&amp;gt;(level, integer)&lt;br /&gt;
:Gets or sets the XP multiplier for a given level of the dungeon.&lt;br /&gt;
&lt;br /&gt;
==Characters==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_champion&amp;lt;/b&amp;gt;(portrait_gfxname, first_name, last_name, health, stamina, mana, strength, dexterity, wisdom, vitality, anti-magic, anti-fire, luck, fighter_level, ninja_level, priest_level, wizard_level) = char_id&lt;br /&gt;
:Adds a character to the roster and returns his/her id number, which can then be used for adjusting various stats or putting items in his/her pack. Note that the internal representations of the three bars and the 7 statistics are 10 times what is actually displayed. (That is, 100 health in-game is represented by 1000)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_offer_champion&amp;lt;/b&amp;gt;(char_id, mode, take_function)&lt;br /&gt;
:Offers the given char_id, with the options specified by &amp;quot;mode&amp;quot; available.&lt;br /&gt;
:~[1 = resurrect, 2 = reincarnate, 3 = both]. The take_function is a Lua function that is executed if the offered character is resurrected or reincarnated. It is typically used to clear out the champion&#039;s mirror, or do something else to denote that the character is no longer available.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_toparty&amp;lt;/b&amp;gt;(ppos, char)&lt;br /&gt;
:Adds the specified character at the specified party position. (Unlike dsb_offer_champion the player is given no choice, the character is just added) It will fail silently if that position is already occupied.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_fromparty&amp;lt;/b&amp;gt;(ppos)&lt;br /&gt;
:Removes anyone at the specified party position. It will fail silently if no one is there. If the party is reduced to nothing, the game will revert to &amp;quot;ghost mode.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charname&amp;lt;/b&amp;gt;(char) = string&lt;br /&gt;
:Returns the character&#039;s name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s three bars. (HEALTH, STAMINA or MANA)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_stat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_stat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s stats. (STAT_STR, STAT_DEX, STAT_WIS, STAT_VIT, STAT_AMA, STAT_AFI, STAT_LUC)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxbar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxbar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxstat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxstat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:As above, only pertaining to maximum values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;do_damage(ppos, char, type, amount)&amp;lt;/b&amp;gt;&lt;br /&gt;
:This function will damage the given character at the given ppos the given amount of the given type (HEALTH, STAMINA, or MANA). The units specified here are as the player perceives them (that is, divided by ten from internal representations and the same scale used by monsters)&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_load&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxload&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
:Returns the load or max load of a given character.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_food&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_food&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_water&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_water&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
:Get or set the character&#039;s food and water values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_injury&amp;lt;/b&amp;gt;(char, location) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_injury&amp;lt;/b&amp;gt;(char, location, integer)&lt;br /&gt;
:Gets or sets the amount of injury a given location on the given character has sustained. This number is 0 if the location is uninjured and can go up to 100, but anything nonzero will highlight it in red and use the &amp;quot;bandaged&amp;quot; bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_portrait&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:Replaces the portrait of a character with the given image. This can happen on-the-fly at any time. Note that the portrait must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;portrait&amp;quot;, not gfx.portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_topimages&amp;lt;/b&amp;gt;(char, hands_image_name, portrait_background_image_name, death_image_name)&lt;br /&gt;
:Replaces the top &amp;quot;hands&amp;quot;, &amp;quot;portrait background&amp;quot; and &amp;quot;death&amp;quot; images.  Pass the image names nil to leave the image alone, or 0 to go back to the default.  Remember that we pass the image parameters as strings, and not a direct reference to the &#039;&#039;gfx&#039;&#039; table.  Example: &#039;&#039;dsb_replace_topimages(char, nil, nil, &amp;quot;frozen_face_halk&amp;quot;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_charhand&amp;lt;/b&amp;gt;(char, hand_name)&lt;br /&gt;
:Replaces the &amp;quot;hand&amp;quot; of a character with the given image. This can happen on-the-fly at any time. Note that the image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;hand_image&amp;quot;, not gfx.hand_image.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_inventory&amp;lt;/b&amp;gt;(char, inventory_image_name)&lt;br /&gt;
:Replaces the inventory background of a character with the given image. This can happen on-the-fly at any time. Note that the background image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;inventory&amp;quot;, not gfx.inventory.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_methods&amp;lt;/b&amp;gt;(char, methods_table_name)&lt;br /&gt;
:Replaces the default attack methods of a character with the given table of methods, or function returning a table. This can happen on-the-fly at any time. Note that the method table or function must be specified by name as a string, not as an actual table. It must a single global variable (not be contained in any other table).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_xp_level&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_xp_level_nobonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
:These functions return the character&#039;s level of mastery at a certain skill (a class such as &#039;ninja&#039;) and subskill (or 0 for no subskill). The &amp;quot;nobonus&amp;quot; form does not take temporary XP or level-boosting items into account.  All references to the &amp;lt;i&amp;gt;dsb_xp_level&amp;lt;/i&amp;gt; call are wrapped by function &amp;lt;i&amp;gt;determine_xp_level(char, class, subskill)&amp;lt;/i&amp;gt; so that [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28487&amp;amp;p=106622#p106622 it can be overridden].&lt;br /&gt;
  &lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_give_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gives the specified amount of XP in the specified skill and subskill (or 0 for no subskill).&lt;br /&gt;
:Important: This function gives XP only. It doesn&#039;t deal with XP multipliers, leveling up, bonuses, or anything else.&lt;br /&gt;
:More useful to most designers will be the helper function &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:This function takes XP multipliers, leveling up, etc. into account.&lt;br /&gt;
:Defined in &amp;lt;i&amp;gt;base/xp.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets the character&#039;s amount of experience directly. Setting XP directly doesn&#039;t do anything with stats, leveling up or down, or anything of that sort, so it is of limited use unless you really know what you&#039;re doing.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets a temporary XP bonus. This, too, is handled by &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt; automatically.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bonus&amp;lt;/b&amp;gt;(char, skill, subskill, integer)&lt;br /&gt;
:Gets or sets a level bonus associated with a given skill or subskill (or 0 for no subskill), such as what may be given by a magic item held in hand or worn around the neck.&lt;br /&gt;
&lt;br /&gt;
==The Party==&lt;br /&gt;
Many of these commands include optional support for [[DSB/Multiple Parties|Multiple Parties]]. In a standard DM dungeon, you can ignore all of that.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt;(~[party]) = level, x, y, facing&lt;br /&gt;
:Returns the ~[specified] party&#039;s location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_at&amp;lt;/b&amp;gt;(level, x, y) = party&lt;br /&gt;
:Returns which party is at a specified location, or nil if no party is there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_place&amp;lt;/b&amp;gt;(level, x, y, facing, ~[party])&lt;br /&gt;
:Places the ~[specified] party at a specific location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pfacing&amp;lt;/b&amp;gt;(ppos) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_pfacing&amp;lt;/b&amp;gt;(ppos, direction)&lt;br /&gt;
:Get or set the direction a given party position is facing relative to the rest of the party. (This changes when the members are attacked from monsters to the sides or behind)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_idle&amp;lt;/b&amp;gt;(ppos) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_idle&amp;lt;/b&amp;gt;(ppos, integer)&lt;br /&gt;
:Gets or sets the amount of time the given party position must be idle (that is, the attack method icons are ghosted). Note that these take party positions, not character numbers.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_leader&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:Returns the party position of the party&#039;s leader.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_char&amp;lt;/b&amp;gt;(ppos, ~[party]) = char&lt;br /&gt;
:Returns the character at the given party position, or nil if there isn&#039;t one.&lt;br /&gt;
If a party is specified, that party will be searched. If there is no party specified, only the current party will be searched. To search all parties, specify VARIABLE as the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_char_ppos&amp;lt;/b&amp;gt;(char) = ppos&lt;br /&gt;
:Returns the party position a given character occupies, or nil if he/she isn&#039;t in the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_tile&amp;lt;/b&amp;gt;(ppos, ~[party]) = tile_dir&lt;br /&gt;
:Returns the tile location that the given party position occupies.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tile_ppos(tile_dir, ~[party])&amp;lt;/b&amp;gt; = ppos&lt;br /&gt;
:Returns the party position occupied by the given tile location, or nil if nobody is there.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sleepstate&amp;lt;/b&amp;gt;() = boolean&lt;br /&gt;
:Returns whether or not the party is asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wakeup&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Wakes up the party if they are asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_current_inventory&amp;gt;&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:If someone&#039;s inventory is being looked at, this returns the party position of the character that is being looked at. Otherwise, it returns nil.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lastmethod&amp;lt;/b&amp;gt;(ppos) = method, location, inst&lt;br /&gt;
:Returns the last attack method invoked by the given ppos.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_scanfor&amp;lt;/b&amp;gt;(arch) = id&lt;br /&gt;
:Scans the entire party&#039;s inventory for a given arch. Returns the id for the first instance of that arch if it is found, or nil if nothing is found.&lt;br /&gt;
&lt;br /&gt;
==Multiple Parties==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mpartyflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Multiple Parties|Multiple Parties]] flag.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_exviewinst&amp;lt;/b&amp;gt;(char, monster_id)&lt;br /&gt;
:This will associate a given monster inst with a character. The monster must be in LIMBO. From then on, whenever that character is seen from a 3rd person perspective, that monster will be drawn to represent that character. Don&#039;t kill this monster or bad things will happen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_apush&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_party_apop&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
:The game uses a &amp;quot;party stack&amp;quot; to keep track of which sub-party the various party-related commands affect. The currently viewed party is always at the bottom. When a party steps on a trigger, it is pushed onto the stack before the trigger is processed. This means things like &amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt; will generally affect the &amp;quot;right&amp;quot; party. You can directly manipulate the stack with these commands, but be careful. If you&#039;re not sure what to do with these commands, you probably don&#039;t need them.&lt;br /&gt;
&lt;br /&gt;
==Interacting with Insts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt;(object_arch, level, x, y, tile_location) = id&lt;br /&gt;
:Spawns a new instance at the specified coordinates and returns its id.&lt;br /&gt;
Note that if &amp;quot;level&amp;quot; is negative, various [[DSB/Special Values|Special Values]] can be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;(id, level, x, y, tile_location)&lt;br /&gt;
:Moves an instance to the specified location. The [[DSB/Special Values|Special Values]] can also be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_reposition&amp;lt;/b&amp;gt;(id, tile_location)&lt;br /&gt;
:Moves an instance to a new tile location on the same tile. Useful for rearranging monsters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Note: &amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt; etc. will not always immediately put the spawned/moved object into position. During the processing of a triggering event (wallitem or flooritem), all spawns and moves will be queued until the end of the processing in order to avoid changing the dungeon state while the triggering objects are still being iterated over. In most cases, the change will not be noticable, but you should be wary of this fact, especially if you are expecting to be able to manipulate the just-moved object in the same function.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move_moncol&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
Allow moving a monster and automatically handle flyer collisions.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_coords&amp;lt;/b&amp;gt;(id) = level, x, y, tile_location&lt;br /&gt;
:Returns the coordinates of an instance. This is either the location in the dungeon, or, using special coordinates, its location in a character or monster&#039;s inventory, in limbo, etc.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt;(level, x, y, tile_location) = id (or table of ids), ~[number]&lt;br /&gt;
:Checks a specified location and returns what&#039;s there. If this is a special coordinate, it is either nil or just an id number. If this is a dungeon location (that is, a level &amp;gt;= 0) or if the special specifier TABLE is used for tile_location, it will return a table of ids. -1 can also be used for the y coordinate when using a special coordinate to return a table of all matching ids, for example, IN_OBJ will give everything inside that object. In these cases, a number is also returned matching the number of instances fetched (but can be ignored if you choose)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_find_arch&amp;lt;/b&amp;gt;(id) = arch&lt;br /&gt;
:Determines the arch of the given instance id. This is often needed in order to access information about the object&#039;s general type.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_swap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Totally destroys the targeted instance and creates a new one at its location with its id number and the new archetype. Things like exvars are not preserved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_qswap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Quick-swaps an instance to a new archetype. That is, it changes only the arch, but no internal variables or exvars. This means that if the new arch is a radically different type, strange things will probably happen and the game might crash. It&#039;s quite handy for making push-buttons that change appearance and such, though.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delete&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Completely destroys an instance from the dungeon.&lt;br /&gt;
In most cases, it is better to send the instance an M_DESTROY message instead.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_facedir&amp;lt;/b&amp;gt;(id) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_facedir&amp;lt;/b&amp;gt;(id, direction)&lt;br /&gt;
:Gets or sets the direction a monster is facing or a flying instance is currently travelling.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_shoot&amp;lt;/b&amp;gt;(id, level, x, y, direction, tile_pos, power, damage, delta, ~[damage_delta])&lt;br /&gt;
:Sends the specified instance flying through the air. It originates at the given level, x, y, and tile_pos, flying in the given direction. Power and damage are variables used by the game to control how far the object flies and how hard it hits. Delta represents how much is subtracted from power each subtile of flight. Delta is also subtracted from damage, unless an optional damage delta is specified instead. When the instance runs out of power, it falls to the ground (or vanishes if &amp;lt;b&amp;gt;flying_only&amp;lt;/b&amp;gt; is set on its archetype)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_flystate&amp;lt;/b&amp;gt;(id) = power, direction, damage&lt;br /&gt;
:Returns the information on a flying instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_openshot&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:This is a minor hack used to specify that the instance has been shot in open space (by a champion or monster, instead of by a wall shooter, for example) and thus should not have collision detection immediately. If this is not set, the instance will instantly run into the character or monster that was supposed to have &amp;quot;launched&amp;quot; it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_collide&amp;lt;/b&amp;gt;(id, lev, x, y, tile, direction) = { {id, tile}, ~[...] }&lt;br /&gt;
:Performs collision detection on a flying object for the specified location. This is useful when directly moving monsters around (e.g., via &amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;) so that they will not apparently move &amp;quot;through&amp;quot; flying missiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_flyreps&amp;lt;/b&amp;gt;(???, ???, ...) = ???&lt;br /&gt;
:Allows you to set the number of update repetitions that a flying object performs per tick. For example, a value of 8 will cause the object to move 8 sub-tiles per tick, or 4 full tiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gfxflag&amp;lt;/b&amp;gt;(id, flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Graphics Flag|Graphics Flag]] for a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charge&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_charge&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets the charge of a given instance. This is normally used by limited-use items but it can have other applications. It is used to set the size of clouds and spells, too. It must be a number from 0 to 63.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_crop&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_crop&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets how much a door is cropped in its display. This is used when they open and close.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawnburst_begin&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_spawnburst_end&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Begins or ends a [[DSB/Spawnburst|Spawnburst]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_push_mouse&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:A shortcut command to push the specified instance into the mouse hand.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_pop_mouse&amp;lt;/b&amp;gt;() = id&lt;br /&gt;
:A shortcut command to pop anything in the mouse hand out, returning its id at the same time.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_valid_inst&amp;lt;/b&amp;gt;(id) = ternary value&lt;br /&gt;
:Returns true if the instance exists, false if it doesn&#039;t but the id is valid, and nil if it is not a valid instance id.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:Creates a new arch type.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Monsters==&lt;br /&gt;
Monsters are insts as well, and (almost?) all commands that affect insts will work just the same on monsters, but monsters have their own specialized functionality as well.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_hp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_hp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s HP. Please note that this function has nothing to do with how to get or set a character&#039;s HP. In addition, the scale used by monster HP is &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; scaled up by a factor of 10.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxhp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxhp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s max HP.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_tint&amp;lt;/b&amp;gt;(id, RGB, ~[intensity])&lt;br /&gt;
:Sets the &#039;tint&#039; of a monster, to give it a glowing effect. Monsters flash when they are hit by various spells.  There is finally an optional intensity level parameter, set at 127 by default with a range of 0 to 255.  0 Being completely black.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai&amp;lt;/b&amp;gt;(id, message, data) ~[= result]&lt;br /&gt;
:Sends an [[DSB/Monster AI|Monster AI]] message to the given monster.&lt;br /&gt;
If data is QUERY then the function will return information on the given value, rather than setting it. For example, dsb_ai(id, AI_FEAR, QUERY) will return the monster&#039;s current level of fear. [[DSB/Monster AI|Monster AI]] documentation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_boss&amp;lt;/b&amp;gt;(id) = boss_id&lt;br /&gt;
:Returns the given monster id&#039;s boss. The &amp;quot;boss&amp;quot; is the monster in each tile who controls when the entire group moves and attacks. This allows DSB monsters to all be distinct entities, but move in DM-style groups.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_promote&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Promotes the given monster id to be the boss of its tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_subordinates&amp;lt;/b&amp;gt;(boss_id) = { {id, tile}, [...] }&lt;br /&gt;
:Returns all monsters who are subordinate to the given boss.&lt;br /&gt;
&lt;br /&gt;
==Messaging==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg&amp;lt;/b&amp;gt;(delay, id, message, data, ~[sender])&lt;br /&gt;
:Sends the specified [[DSB/Messages|Messages]] to the specified instance after the specified delay. Messages are simply integers. The object responds to the message as specified by its msg_handler, defined in its archetype. See &amp;lt;i&amp;gt;base/msg_handlers.lua&amp;lt;/i&amp;gt; for many examples of what can be done with message handlers. Normally it doesn&#039;t matter where a message comes from. However, it is possible to assert the sender of the message, in the rare cases where it is needed.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg_chain&amp;lt;/b&amp;gt;(id, target_id)&lt;br /&gt;
:This causes the first instance to relay any messages it receives to the second instance. This is useful for making ceiling pits close at the same time floor pits do, and other situations where an instance should pass messages along.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_msgs_to&amp;lt;/b&amp;gt;(id, delay)&lt;br /&gt;
:Delays all messages bound for a given instance by the specified delay.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_enable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Enables an instance. This will clear its INACTIVE flag as well as make sure any events, triggerings, etc. that should happen do happen. This function is easier and safer to use than setting the flag directly.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_disable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Disables an instance. This will set its INACTIVE flag and make sure that any objects on it stop triggering it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_toggle&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:See the previous two.&lt;br /&gt;
&lt;br /&gt;
==Light==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light&amp;lt;/b&amp;gt;(handle) = lightlevel&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_light&amp;lt;/b&amp;gt;(handle, lightlevel)&lt;br /&gt;
:Gets or sets the light level on the given light handle, which is an integer from 0 to 9. The light level displayed is the sum of the dungeon level&#039;s base light level plus the 10 light handles. Currently, light handle 0 is used for light spells, handle 1 is used for torches, and 2 is used by illumulets.&lt;br /&gt;
&lt;br /&gt;
==Conditions==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_condition&amp;lt;/b&amp;gt;(type, inventory_gfx, portrait_gfx, update_freq, function, ~[flags]) = condition_id&lt;br /&gt;
:Adds a condition (status variable) to the list of those available. The type is either PARTY (affects the whole party) or INDIVIDUAL (affects one person). For individual conditions, two graphics can be specified, one that affects the inventory screen, the other that affects the portrait area. If type is PARTY the third parameter portrait_gfx is now considered as overlay_gfx and will be seen in the dungeon view port.  We can apply an underwater effect for example, as the overlay includes support for alpha channels if you want transparent parts.  &lt;br /&gt;
:If update_freq is &amp;gt; 0, the specified function will be called at the specified number of ticks. The function takes the following form:&lt;br /&gt;
&lt;br /&gt;
   function update_func(char, condition_strength)&lt;br /&gt;
     return new_condition_strength&lt;br /&gt;
   end&lt;br /&gt;
:&lt;br /&gt;
:Flags can be specified to control other aspects of the condition&#039;s appearance on the inventory screen. These flags are COND_MOUTH_RED, COND_MOUTH_GREEN, COND_EYE_RED, and COND_EYE_GREEN. These flags only affect INDIVIDUAL conditions. There was formerly a condition type called BAD_INDIVIDUAL that was an INDIVIDUAL condition with COND_MOUTH_RED. It is now &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;deprecated&amp;lt;/font&amp;gt;. Please don&#039;t use it in new code.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_condition&amp;lt;/b&amp;gt;(condition_id, type, inventory_gfx, portrait_gfx, update_freq, function)&lt;br /&gt;
:Replaces the information for the condition with the given id with the new condition. Good for changing conditions on the fly, but keep in mind that the fact that you&#039;ve changed the condition won&#039;t be saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_condition&amp;lt;/b&amp;gt;(char, condition) = strength&lt;br /&gt;
:Returns the strength of the specified condition for the specified character (or, in the case of conditions for the whole party, pass PARTY as the character)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_condition&amp;lt;/b&amp;gt;(char, condition, strength)&lt;br /&gt;
:Sets the strength of the condition. See previous function.&lt;br /&gt;
&lt;br /&gt;
==Popups and Readouts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_damage_popup&amp;lt;/b&amp;gt;(ppos, damage_type, integer)&lt;br /&gt;
:Shows the amount of damage taken by a character in a little popup over the character&#039;s name or portrait. The type is either HEALTH, STAMINA, or MANA, and a different background icon is displayed for each. The amount of damage shown should be in units as the player perceives them, not internal (so, divided by ten from internal representations)-- the default functions in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt; take care of this for you.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_damage&amp;lt;/b&amp;gt;(integer)&lt;br /&gt;
:This causes a number in a little explosion to appear in the area occupied by the attack icons. This is used for showing the amount of damage inflicted upon a monster by a melee attack.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_text&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:This causes text to momentarily appear in the area occupied by the attack icons. This is used for things like &amp;quot;CAN&#039;T REACH&amp;quot; or &amp;quot;NEED AMMO.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Fullscreen==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;(bitmap_or_func, click_func, update_func, mouse, fade)&lt;br /&gt;
:This engages the full-screen renderer, and is used for cut scenes or other interludes. If the first parameter passed is a bitmap, that bitmap will be displayed. If the first parameter is instead a function, that function will be executed every frame. The draw function will be passed the bitmap to draw to, the mouse&#039;s x location, and the mouse&#039;s y location, in the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;draw_function&amp;lt;/b&amp;gt;(bitmap, mouse_x, mouse_y)&amp;lt;/code&amp;gt;&lt;br /&gt;
:The click_func, if provided, will be executed every time the mouse is clicked. It is of the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;click_func&amp;lt;/b&amp;gt;(mouse_x, mouse_y, mouse_buttons)&amp;lt;/code&amp;gt;&lt;br /&gt;
:Update_func, if provided, will be executed every game tick. It takes no parameters.&lt;br /&gt;
:If mouse is nil or false, no mouse pointer will be drawn. If it is true, the standard &amp;quot;yellow arrow&amp;quot; mouse pointer will be drawn. If it is a bitmap, that bitmap will be drawn as the mouse pointer.&lt;br /&gt;
:There is an optional 5th parameter that allows a fade in/fade out.&lt;br /&gt;
:The full-screen renderer will run until any of its associated functions returns something other than false or nil.&lt;br /&gt;
&lt;br /&gt;
==Subrenderers==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_subrenderer_target&amp;lt;/b&amp;gt;() = bitmap&lt;br /&gt;
:Returns a bitmap to be drawn upon. Use only in a [[DSB/Subrenderers|Subrenderer]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_objzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y)&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer bitmap. This object zone can be used to access instances that are stored inside of the given instance. See the implementation of chests in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for more information and examples.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msgzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y, width, height, msg)&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer bitmap, with the given width and height. When it is clicked, the specified message will be sent to the instance. This can allow fairly complicated user interfaces in subrenderers.&lt;br /&gt;
&lt;br /&gt;
If the target id is SYSTEM, it will create a clickzone to control the engine instead. In those cases, two additional parameters must be specified, to pass information to the system. Allowable messages are:&lt;br /&gt;
* SYS_METHOD_OBJ, ppos, location = Shows the attack method dialogue for a given ppos from a given location&lt;br /&gt;
&lt;br /&gt;
* SYS_METHOD_SEL, inst, method = Selects the given attack method for the given instance. (Note: Currently, if the method was not first popped up via SYS_METHOD_OBJ, this will do nothing.)&lt;br /&gt;
&lt;br /&gt;
* SYS_METHOD_CLEAR, ppos, 0 = Clears the attack method for the given ppos.&lt;br /&gt;
&lt;br /&gt;
==Global Data, Utility Functions, and Misc.==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gameflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Global Flags|Global Flag]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_hide_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_show_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Functions to make the mouse pointer appear or disappear.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_unlock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
:Functions to lock or unlock the game. Complete locking prevents most timers from running (though animations and delayed functions still will), processing any player input, or triggering anything. If you lock the game and forget to unlock it, it will be left in an unplayable state, so be very careful how you use this! Note that this takes effect immediately (that is, even before any queued moves), which may not always be what you want. You can also lock only certain parts of the game, using the [[DSB/Locking Flags|locking flags]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rand&amp;lt;/b&amp;gt;(min, max) = integer&lt;br /&gt;
:Generates a random integer between min and max, inclusive.&lt;br /&gt;
You should &amp;lt;b&amp;gt;always&amp;lt;/b&amp;gt; use this function for random number generation, not anything built into Lua.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_linesplit&amp;lt;/b&amp;gt;(string, split) = lines, number_of_lines&lt;br /&gt;
:A utility function that splits up a string into individual lines (placing the number of lines returned in number_of_lines) demarcated by the split character. &amp;quot;/&amp;quot; (slash) is a common choice for a a split character. See the implementation of scrolls in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for an example.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_forward&amp;lt;/b&amp;gt;(direction) = x, y&lt;br /&gt;
:A utility function that, given a direction, returns the x and y offsets of which way is &amp;quot;forward.&amp;quot; One will always be 1 or -1, the other will always be 0.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileshift&amp;lt;/b&amp;gt;(location, direction) = location&lt;br /&gt;
:A utility function that shifts the specified location in the specified direction. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lookup_global&amp;lt;/b&amp;gt;(string) = variable&lt;br /&gt;
:Returns the variable named by the specified string. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_func&amp;lt;/b&amp;gt;(delay, function)&lt;br /&gt;
:Executes the given function after the given delay in ticks. References to Lua functions cannot be saved, so queued functions will &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; be saved. This should be something nonvital if the game is not locked, and should happen quickly. In most cases, using a message on a delay, which is saved, would work better.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_inventory_info&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the inventory_info has been changed, this lets the engine know. Note that this state is not saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_system&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the system strings or player colors have been changed, this lets the engine know. This may or may not be useful. With the moving of most inventory rendering into Lua-controlled subrenderers, this function has limited use.&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_export&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:Normally, Lua global variables aren&#039;t saved in savegames, however, a few usually need to be. If you need to store a global variable, add it to the export list with this function. Note that dsb_export requires a string giving the name of the variable. Don&#039;t pass the variable itself! You should also note that if you have a very long export list, you&#039;re probably doing something that could be done more easily with specialized code or more careful use of instances with exvars. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport&amp;lt;/b&amp;gt;(x, y)&lt;br /&gt;
:Sets the viewport. Odds are you should leave this one alone.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_enable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_disable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Enables or disables the specified magical rune for use in spells. All runes are enabled by default, just like in original DM. The rune is specified as an integer, where 1 = LO, 2 = UM, 7 = YA, and so on.&lt;br /&gt;
&lt;br /&gt;
These functions are now deprecated. You should manipulate the &amp;lt;b&amp;gt;g_disabled_runes&amp;lt;/b&amp;gt; table directly. For example, disabling the VI rune (rune 8) is as simple as &amp;lt;code&amp;gt;g_disabled_runes~[8] = false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_game_end&amp;lt;/b&amp;gt;(~[bool])&lt;br /&gt;
:Shows a game ending screen. Normally it&#039;s a bit more fun than the screen you get when the party dies, but if you pass it a boolean &#039;true&#039;, it will just show the standard blue &amp;quot;The End&amp;quot; screen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;clone_arch&amp;lt;/b&amp;gt;(object_arch) = new arch&lt;br /&gt;
:This function creates a new arch type, from the original passed in as a parameter.  See a simple [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28613&amp;amp;p=111165#p111165 example].&lt;br /&gt;
&lt;br /&gt;
==Pending Documentation==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_msgtype&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_include_file&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_screen_bitmap&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_cache_invalidate&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileptr_exch&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_contains&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_viewing&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_affecting&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_checksound&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gamelocks&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light_total&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_light_totalmax&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_exviewinst&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_import_arch&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Exposed functions]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Messages&amp;diff=1347</id>
		<title>DSB/Messages</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Messages&amp;diff=1347"/>
		<updated>2010-03-25T18:55:17Z</updated>

		<summary type="html">&lt;p&gt;Sophia: New page: Base messages as defined by DSB and used in ESB are the following: * Activate (M_ACTIVATE) - Enables instances, opens pits, closes doors, triggers generators, etc. * Deactivate (M_DEACTIVA...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Base messages as defined by DSB and used in ESB are the following:&lt;br /&gt;
* Activate (M_ACTIVATE) - Enables instances, opens pits, closes doors, triggers generators, etc.&lt;br /&gt;
* Deactivate (M_DEACTIVATE) - Disables instances, closes pits, opens doors, etc.&lt;br /&gt;
* Toggle (M_TOGGLE) - Enables a disabled instance and disables an enabled one.&lt;br /&gt;
* Next Tick (M_NEXTTICK) - Tells instances to proceed. Makes doors continue to open and close, monster generators re-enable, etc.&lt;br /&gt;
* Clean Up (M_CLEANUP) - Deletes the targeted instance from the target list of all instances in the dungeon.&lt;br /&gt;
* Reset Counter (M_RESET) - Sets a counter back to its default value.&lt;br /&gt;
* Destroy (M_DESTROY) - Removes the instance from the dungeon. This can cause Lua errors if triggers etc. target it and it isn&#039;t sent a Clean Up first.&lt;br /&gt;
&lt;br /&gt;
Define new messages with &amp;lt;b&amp;gt;dsb_add_msgtype&amp;lt;/b&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=1346</id>
		<title>DSB/Exposed functions</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/Exposed_functions&amp;diff=1346"/>
		<updated>2010-03-25T18:42:50Z</updated>

		<summary type="html">&lt;p&gt;Sophia: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Functions are given in the form:&lt;br /&gt;
;&amp;lt;b&amp;gt;function&amp;lt;/b&amp;gt;(arguments, ~[optional arguments]) = return value&lt;br /&gt;
:If the terminology doesn&#039;t make sense, check [DSBTerms].&lt;br /&gt;
Functions without a dsb_ prefix are part of [[DSB/Base Code|base/]], not the core engine.&lt;br /&gt;
&lt;br /&gt;
==Iterators==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_insts&amp;lt;/b&amp;gt;()&lt;br /&gt;
:This is an iterator used in Lua&#039;s for loops. To iterate over all instances of objects in a DSB dungeon, use something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for i in dsb_insts()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_in_obj&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Another iterator; see above for usage. This one is used to iterate all over all instances that are inside the given instance.&lt;br /&gt;
&lt;br /&gt;
==Bitmaps and Drawing==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;(name) = bitmap&lt;br /&gt;
:Searches the dungeon&#039;s directory for the bitmap, and then &amp;lt;i&amp;gt;graphics.dsb&amp;lt;/i&amp;gt;, and finally the default &amp;lt;i&amp;gt;graphics.dat&amp;lt;/i&amp;gt;. Returns a truecolor bitmap, but the bitmap can be 256 colors on disk to save space.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mask_bitmap(name)&amp;lt;/b&amp;gt; = bitmap&lt;br /&gt;
:This function loads a bitmap that requires two distinct regions of transparency that are used at different times, such as see-through door decorations or magic windows. The region that is transparent when the image is first blitted is represented by color 0, whereas the region that is &amp;quot;see through&amp;quot; is in the usual magenta color. This requires a 256 color bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_new_bitmap&amp;lt;/b&amp;gt;(xsize, ysize) = bitmap&lt;br /&gt;
:Creates a brand new bitmap and returns a reference to it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_destroy_bitmap&amp;lt;/b&amp;gt;(bitmap)&lt;br /&gt;
:Completely destroys a bitmap. Rarely needed, as Lua&#039;s garbage collector will automatically scoop up out-of-scope bitmaps. You should only invoke this by hand if you know for sure why you need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_clone_bitmap&amp;lt;/b&amp;gt;(bitmap) = bitmap&lt;br /&gt;
:Creates a &amp;quot;virtual bitmap&amp;quot; clone of the specified bitmap. It shares the same actual memory, but can have different offsets. This is useful if you, for example, have several wallitems for which you want to draw the same image on different parts of the wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_animate&amp;lt;/b&amp;gt;(bitmap, frames, frame_delay)&lt;br /&gt;
:Sets up a bitmap that is a series of frames for animation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_clear&amp;lt;/b&amp;gt;(bitmap, RGB)&lt;br /&gt;
:Clears a bitmap to the specified RGB value. An RGB is specified as a table of { R, G, B }.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_blit&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x_src, y_src, x_dest, y_dest, width, height)&lt;br /&gt;
:Blits one bitmap onto another.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_draw&amp;lt;/b&amp;gt;(src_bmp, dest_bmp, x, y, flip)&lt;br /&gt;
:Draws the entire source bitmap on to the destination, taking any animation or offsets into account. Pass true to flip to horizontally flip the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_width&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_bitmap_height&amp;lt;/b&amp;gt;(bitmap) = integer&lt;br /&gt;
:Returns the dimension of the bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_rect&amp;lt;/b&amp;gt;(bitmap, x_src, y_src, x_dest, y_dest, color, filled)&lt;br /&gt;
:Draws a rectangle. Pass true to filled for a filled rectangle.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;(bitmap, font, string, x, y, alignment, color) = integer&lt;br /&gt;
:Renders text onto a bitmap in the specified font and color, with the specified alignment: (LEFT, RIGHT, CENTER, or MULTILINE).  Returns the number of lines printed.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_dungeon_view&amp;lt;/b&amp;gt;(lev, x, y, dir, light) = bitmap&lt;br /&gt;
:Return a rendering of the viewport.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
:This function is called when your view changes to a different level.  &amp;lt;i&amp;gt;But what does it do?!&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Fonts and Text==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_font&amp;lt;/b&amp;gt;(name) = font&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a font.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_textformat&amp;lt;/b&amp;gt;(chars_per_line, y_offset_per_line, max_lines)&lt;br /&gt;
:This controls the format of MULTILINE text output by &amp;lt;b&amp;gt;dsb_bitmap_textout&amp;lt;/b&amp;gt;. The Y offsets are also used by the console (the text below the game view). By setting chars_per_line to something unreasonable, you can effectively disable word wrapping.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_write&amp;lt;/b&amp;gt;(RGB, string)&lt;br /&gt;
:Outputs the given text string in the given color to the console. (that is, a table of { R, G, B })&lt;br /&gt;
&lt;br /&gt;
==Sound and Music==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sound&amp;lt;/b&amp;gt;(name) = sound&lt;br /&gt;
:Searches the same paths as &amp;lt;b&amp;gt;dsb_get_bitmap&amp;lt;/b&amp;gt;, loading a sound.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_sound&amp;lt;/b&amp;gt;(sound, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound. An optional boolean parameter allows you to specify if the sound should loop. Be careful, the only way to stop a looping sound is via &amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;, so don&#039;t lose the channel handle!&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_3dsound&amp;lt;/b&amp;gt;(sound, lev, x, y, ~[loop]) = chan_handle&lt;br /&gt;
:Plays the given sound as though it originated from the given location in the dungeon. An optional boolean parameter allows you to specify if the sound should loop. Note that &amp;lt;i&amp;gt;base/util.lua&amp;lt;/i&amp;gt; also includes a useful function, explained next:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;local_sound&amp;lt;/b&amp;gt;(id, sound) = chan_handle&lt;br /&gt;
:Plays a sound that appears to originate from the location of a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_stopsound&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Stops the sound playing on a channel handle previously returned by a call to a sound playing function.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_soundvol&amp;lt;/b&amp;gt;(chan_handle)&lt;br /&gt;
:Obtains the current volume of the sound, ranging from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_soundvol&amp;lt;/b&amp;gt;(chan_handle, volume) &lt;br /&gt;
:Adjusts the volume of the sound, with the volume range from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
==Levels and Wallsets==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_getinfo&amp;lt;/b&amp;gt;(level) = x_size, y_size, light, xp_multiplier&lt;br /&gt;
:Returns the basic info about a level.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_tint&amp;lt;/b&amp;gt;(level, RGB)&lt;br /&gt;
:Tells DSB to tint the dynamically scaled and shaded objects in a level a certain way. By default, this is {0, 0, 0}, causing the dungeon to fade to black, just like DM, but if the ambient light color is different, or you are outdoors and fade to a misty grey instead of black, you will probably want to change this.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. Wallsets in DM 2.x ([CSBwin]) are easiest to use with this command, as they have a single very long wall, as opposed to assembling the front view out of &amp;quot;left&amp;quot; and &amp;quot;front&amp;quot; bitmaps. (see the next command)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;(floor, roof, pers0, pers0alt, pers1, pers1alt, pers2, pers2alt, pers3, persl3alt, farwall3, farwall3alt, front1, front2, front3, left1, left1alt, left2, left2alt, left3, left3alt, patch1, patch2, patch3, patchside, window) = wallset&lt;br /&gt;
:Creates a wallset from the specified bitmaps. This command takes 6 more arguments: 6 &amp;quot;left side&amp;quot; bitmaps. If you&#039;re using a converted DM2, [[DSB/DSB for RTC users|DSB for RTC users]], or WHACK wallset, you&#039;ll find this command useful.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_level_wallset&amp;lt;/b&amp;gt;(level, wallset)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_use_wallset&amp;lt;/b&amp;gt;(level, wallset) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Tells DSB to use the specified wallset on the specified level.&lt;br /&gt;
Note: this function was formerly known as &amp;quot;dsb_use_wallset,&amp;quot; and that is still a synonym for it, for now. In new dungeons, please use the new name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_alt_wallset&amp;lt;/b&amp;gt;(wallset, level, x, y, dir)&lt;br /&gt;
:Tells DSB to use the specified wallset only on the given direction of the given tile. If CENTER is specified, it will use that wallset on all directions of the given tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_text2map&amp;lt;/b&amp;gt;(level, x_size, y_size, light, xp_multiplier, maptable)&lt;br /&gt;
:Converts a table with a text-based map into a level. Each row of the table should represent a row of the dungeon, and contain a string with 0&#039;s or 1&#039;s representing walls and floors in that row. In this way, it is very similar to how dungeons are declared in an [[DSB/DSB for RTC users|DSB for RTC users]] text file.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_image2map&amp;lt;/b&amp;gt;(level, filename, light, xp_multiplier) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Converts a bitmap image into a level. One pixel = one square. It must be a 256 color image, where color 0 represents walls, color 1 represents open space, and further colors can be used to represent various objects in the dungeon by means of a conversion table. This function is now mostly deprecated because everyone is using ESB anyway.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_cell&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns a boolean specifying whether or not the given cell in the dungeon is a wall. Use &amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt; to find out anything else about what&#039;s there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_cell&amp;lt;/b&amp;gt;(level, x, y, value)&lt;br /&gt;
:Sets whether the given cell in the dungeon is a wall or open space. A value of nil, false, or 0 represents open space. A value of true or any other integer represents a wall.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_visited&amp;lt;/b&amp;gt;(level, x, y) = boolean&lt;br /&gt;
:Returns whether the party has visited the given dungeon cell. A wall will never be visited, unless it wasn&#039;t a wall at some point in the past.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp_multiplier&amp;lt;/b&amp;gt;(level) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp_multiplier&amp;lt;/b&amp;gt;(level, integer)&lt;br /&gt;
:Gets or sets the XP multiplier for a given level of the dungeon.&lt;br /&gt;
&lt;br /&gt;
==Characters==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_champion&amp;lt;/b&amp;gt;(portrait_gfxname, first_name, last_name, health, stamina, mana, strength, dexterity, wisdom, vitality, anti-magic, anti-fire, luck, fighter_level, ninja_level, priest_level, wizard_level) = char_id&lt;br /&gt;
:Adds a character to the roster and returns his/her id number, which can then be used for adjusting various stats or putting items in his/her pack. Note that the internal representations of the three bars and the 7 statistics are 10 times what is actually displayed. (That is, 100 health in-game is represented by 1000)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_offer_champion&amp;lt;/b&amp;gt;(char_id, mode, take_function)&lt;br /&gt;
:Offers the given char_id, with the options specified by &amp;quot;mode&amp;quot; available.&lt;br /&gt;
~[1 = resurrect, 2 = reincarnate, 3 = both]. The take_function is a Lua function that is executed if the offered character is resurrected or reincarnated. It is typically used to clear out the champion&#039;s mirror, or do something else to denote that the character is no longer available.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_toparty&amp;lt;/b&amp;gt;(ppos, char)&lt;br /&gt;
:Adds the specified character at the specified party position. (Unlike dsb_offer_champion the player is given no choice, the character is just added) It will fail silently if that position is already occupied.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_champion_fromparty&amp;lt;/b&amp;gt;(ppos)&lt;br /&gt;
:Removes anyone at the specified party position. It will fail silently if no one is there. If the party is reduced to nothing, the game will revert to &amp;quot;ghost mode.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charname&amp;lt;/b&amp;gt;(char) = string&lt;br /&gt;
:Returns the character&#039;s name.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s three bars. (HEALTH, STAMINA or MANA)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_stat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_stat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:Gets or sets the value of one of the character&#039;s stats. (STAT_STR, STAT_DEX, STAT_WIS, STAT_VIT, STAT_AMA, STAT_AFI, STAT_LUC)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxbar&amp;lt;/b&amp;gt;(char, bar) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxbar&amp;lt;/b&amp;gt;(char, bar, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxstat&amp;lt;/b&amp;gt;(char, stat) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxstat&amp;lt;/b&amp;gt;(char, stat, integer)&lt;br /&gt;
:As above, only pertaining to maximum values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;do_damage(ppos, char, type, amount)&amp;lt;/b&amp;gt;&lt;br /&gt;
:This function will damage the given character at the given ppos the given amount of the given type (HEALTH, STAMINA, or MANA). The units specified here are as the player perceives them (that is, divided by ten from internal representations and the same scale used by monsters)&lt;br /&gt;
Defined in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_load&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_maxload&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
:Returns the load or max load of a given character.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_food&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_food&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_get_water&amp;lt;/b&amp;gt;(char) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_water&amp;lt;/b&amp;gt;(char, integer)&lt;br /&gt;
:Get or set the character&#039;s food and water values.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_injury&amp;lt;/b&amp;gt;(char, location) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_injury&amp;lt;/b&amp;gt;(char, location, integer)&lt;br /&gt;
:Gets or sets the amount of injury a given location on the given character has sustained. This number is 0 if the location is uninjured and can go up to 100, but anything nonzero will highlight it in red and use the &amp;quot;bandaged&amp;quot; bitmap.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_portrait&amp;lt;/b&amp;gt;(char, portrait_name)&lt;br /&gt;
:Replaces the portrait of a character with the given image. This can happen on-the-fly at any time. Note that the portrait must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;portrait&amp;quot;, not gfx.portrait.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_charhand&amp;lt;/b&amp;gt;(char, hand_name)&lt;br /&gt;
:Replaces the &amp;quot;hand&amp;quot; of a character with the given image. This can happen on-the-fly at any time. Note that the image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;hand_image&amp;quot;, not gfx.hand_image.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_inventory&amp;lt;/b&amp;gt;(char, inventory_image_name)&lt;br /&gt;
:Replaces the inventory background of a character with the given image. This can happen on-the-fly at any time. Note that the background image must be specified as a string, not an entry in the gfx table. That is, pass &amp;quot;inventory&amp;quot;, not gfx.inventory.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_methods&amp;lt;/b&amp;gt;(char, methods_table_name)&lt;br /&gt;
:Replaces the default attack methods of a character with the given table of methods, or function returning a table. This can happen on-the-fly at any time. Note that the method table or function must be specified by name as a string, not as an actual table. It must a single global variable (not be contained in any other table).&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_xp_level&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_xp_level_nobonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
:These functions return the character&#039;s level of mastery at a certain skill (a class such as &#039;ninja&#039;) and subskill (or 0 for no subskill). The &amp;quot;nobonus&amp;quot; form does not take temporary XP or level-boosting items into account.  All references to the &amp;lt;i&amp;gt;dsb_xp_level&amp;lt;/i&amp;gt; call are wrapped by function &amp;lt;i&amp;gt;determine_xp_level(char, class, subskill)&amp;lt;/i&amp;gt; so that [http://www.dungeon-master.com/forum/viewtopic.php?f=53&amp;amp;t=28487&amp;amp;p=106622#p106622 it can be overridden].&lt;br /&gt;
  &lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_give_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gives the specified amount of XP in the specified skill and subskill (or 0 for no subskill).&lt;br /&gt;
Important: This function gives XP only. It doesn&#039;t deal with XP multipliers, leveling up, bonuses, or anything else.&lt;br /&gt;
More useful to most designers will be the helper function &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:This function takes XP multipliers, leveling up, etc. into account.&lt;br /&gt;
Defined in &amp;lt;i&amp;gt;base/xp.lua&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets the character&#039;s amount of experience directly. Setting XP directly doesn&#039;t do anything with stats, leveling up or down, or anything of that sort, so it is of limited use unless you really know what you&#039;re doing.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill) = xp&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_temp_xp&amp;lt;/b&amp;gt;(char, skill, subskill, xp)&lt;br /&gt;
:Gets or sets a temporary XP bonus. This, too, is handled by &amp;lt;b&amp;gt;xp_up&amp;lt;/b&amp;gt; automatically.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_bonus&amp;lt;/b&amp;gt;(char, skill, subskill) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_bonus&amp;lt;/b&amp;gt;(char, skill, subskill, integer)&lt;br /&gt;
:Gets or sets a level bonus associated with a given skill or subskill (or 0 for no subskill), such as what may be given by a magic item held in hand or worn around the neck.&lt;br /&gt;
&lt;br /&gt;
==The Party==&lt;br /&gt;
Many of these commands include optional support for [[DSB/Multiple Parties|Multiple Parties]]. In a standard DM dungeon, you can ignore all of that.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt;(~[party]) = level, x, y, facing&lt;br /&gt;
:Returns the ~[specified] party&#039;s location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_at&amp;lt;/b&amp;gt;(level, x, y) = party&lt;br /&gt;
:Returns which party is at a specified location, or nil if no party is there.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_place&amp;lt;/b&amp;gt;(level, x, y, facing, ~[party])&lt;br /&gt;
:Places the ~[specified] party at a specific location.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pfacing&amp;lt;/b&amp;gt;(ppos) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_pfacing&amp;lt;/b&amp;gt;(ppos, direction)&lt;br /&gt;
:Get or set the direction a given party position is facing relative to the rest of the party. (This changes when the members are attacked from monsters to the sides or behind)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_idle&amp;lt;/b&amp;gt;(ppos) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_idle&amp;lt;/b&amp;gt;(ppos, integer)&lt;br /&gt;
:Gets or sets the amount of time the given party position must be idle (that is, the attack method icons are ghosted). Note that these take party positions, not character numbers.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_leader&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:Returns the party position of the party&#039;s leader.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_char&amp;lt;/b&amp;gt;(ppos, ~[party]) = char&lt;br /&gt;
:Returns the character at the given party position, or nil if there isn&#039;t one.&lt;br /&gt;
If a party is specified, that party will be searched. If there is no party specified, only the current party will be searched. To search all parties, specify VARIABLE as the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_char_ppos&amp;lt;/b&amp;gt;(char) = ppos&lt;br /&gt;
:Returns the party position a given character occupies, or nil if he/she isn&#039;t in the party.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ppos_tile&amp;lt;/b&amp;gt;(ppos, ~[party]) = tile_dir&lt;br /&gt;
:Returns the tile location that the given party position occupies.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tile_ppos(tile_dir, ~[party])&amp;lt;/b&amp;gt; = ppos&lt;br /&gt;
:Returns the party position occupied by the given tile location, or nil if nobody is there.&lt;br /&gt;
A specific party can be optionally specified.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_sleepstate&amp;lt;/b&amp;gt;() = boolean&lt;br /&gt;
:Returns whether or not the party is asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wakeup&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Wakes up the party if they are asleep.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_current_inventory&amp;gt;&amp;lt;/b&amp;gt;() = ppos&lt;br /&gt;
:If someone&#039;s inventory is being looked at, this returns the party position of the character that is being looked at. Otherwise, it returns nil.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lastmethod&amp;lt;/b&amp;gt;(ppos) = method, location, inst&lt;br /&gt;
:Returns the last attack method invoked by the given ppos.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_scanfor&amp;lt;/b&amp;gt;(arch) = id&lt;br /&gt;
:Scans the entire party&#039;s inventory for a given arch. Returns the id for the first instance of that arch if it is found, or nil if nothing is found.&lt;br /&gt;
&lt;br /&gt;
==Multiple Parties==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_mpartyflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_mpartyflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Multiple Parties|Multiple Parties]] flag.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_exviewinst&amp;lt;/b&amp;gt;(char, monster_id)&lt;br /&gt;
:This will associate a given monster inst with a character. The monster must be in LIMBO. From then on, whenever that character is seen from a 3rd person perspective, that monster will be drawn to represent that character. Don&#039;t kill this monster or bad things will happen.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_apush&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_party_apop&amp;lt;/b&amp;gt;(party)&lt;br /&gt;
:The game uses a &amp;quot;party stack&amp;quot; to keep track of which sub-party the various party-related commands affect. The currently viewed party is always at the bottom. When a party steps on a trigger, it is pushed onto the stack before the trigger is processed. This means things like &amp;lt;b&amp;gt;dsb_party_coords&amp;lt;/b&amp;gt; will generally affect the &amp;quot;right&amp;quot; party. You can directly manipulate the stack with these commands, but be careful. If you&#039;re not sure what to do with these commands, you probably don&#039;t need them.&lt;br /&gt;
&lt;br /&gt;
==Interacting with Insts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt;(object_arch, level, x, y, tile_location) = id&lt;br /&gt;
:Spawns a new instance at the specified coordinates and returns its id.&lt;br /&gt;
Note that if &amp;quot;level&amp;quot; is negative, various [[DSB/Special Values|Special Values]] can be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;(id, level, x, y, tile_location)&lt;br /&gt;
:Moves an instance to the specified location. The [[DSB/Special Values|Special Values]] can also be used.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_reposition&amp;lt;/b&amp;gt;(id, tile_location)&lt;br /&gt;
:Moves an instance to a new tile location on the same tile. Useful for rearranging monsters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Note: &amp;lt;b&amp;gt;dsb_spawn&amp;lt;/b&amp;gt; etc. will not always immediately put the spawned/moved object into position. During the processing of a triggering event (wallitem or flooritem), all spawns and moves will be queued until the end of the processing in order to avoid changing the dungeon state while the triggering objects are still being iterated over. In most cases, the change will not be noticable, but you should be wary of this fact, especially if you are expecting to be able to manipulate the just-moved object in the same function.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_move_moncol&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
Allow moving a monster and automatically handle flyer collisions.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_coords&amp;lt;/b&amp;gt;(id) = level, x, y, tile_location&lt;br /&gt;
:Returns the coordinates of an instance. This is either the location in the dungeon, or, using special coordinates, its location in a character or monster&#039;s inventory, in limbo, etc.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fetch&amp;lt;/b&amp;gt;(level, x, y, tile_location) = id (or table of ids), ~[number]&lt;br /&gt;
:Checks a specified location and returns what&#039;s there. If this is a special coordinate, it is either nil or just an id number. If this is a dungeon location (that is, a level &amp;gt;= 0) or if the special specifier TABLE is used for tile_location, it will return a table of ids. -1 can also be used for the y coordinate when using a special coordinate to return a table of all matching ids, for example, IN_OBJ will give everything inside that object. In these cases, a number is also returned matching the number of instances fetched (but can be ignored if you choose)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_find_arch&amp;lt;/b&amp;gt;(id) = arch&lt;br /&gt;
:Determines the arch of the given instance id. This is often needed in order to access information about the object&#039;s general type.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_swap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Totally destroys the targeted instance and creates a new one at its location with its id number and the new archetype. Things like exvars are not preserved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_qswap&amp;lt;/b&amp;gt;(id, new_arch)&lt;br /&gt;
:Quick-swaps an instance to a new archetype. That is, it changes only the arch, but no internal variables or exvars. This means that if the new arch is a radically different type, strange things will probably happen and the game might crash. It&#039;s quite handy for making push-buttons that change appearance and such, though.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delete&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Completely destroys an instance from the dungeon.&lt;br /&gt;
In most cases, it is better to send the instance an M_DESTROY message instead.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_facedir&amp;lt;/b&amp;gt;(id) = direction&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_facedir&amp;lt;/b&amp;gt;(id, direction)&lt;br /&gt;
:Gets or sets the direction a monster is facing or a flying instance is currently travelling.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_shoot&amp;lt;/b&amp;gt;(id, level, x, y, direction, tile_pos, power, damage, delta, ~[damage_delta])&lt;br /&gt;
:Sends the specified instance flying through the air. It originates at the given level, x, y, and tile_pos, flying in the given direction. Power and damage are variables used by the game to control how far the object flies and how hard it hits. Delta represents how much is subtracted from power each subtile of flight. Delta is also subtracted from damage, unless an optional damage delta is specified instead. When the instance runs out of power, it falls to the ground (or vanishes if &amp;lt;b&amp;gt;flying_only&amp;lt;/b&amp;gt; is set on its archetype)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_flystate&amp;lt;/b&amp;gt;(id) = power, direction, damage&lt;br /&gt;
:Returns the information on a flying instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_openshot&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:This is a minor hack used to specify that the instance has been shot in open space (by a champion or monster, instead of by a wall shooter, for example) and thus should not have collision detection immediately. If this is not set, the instance will instantly run into the character or monster that was supposed to have &amp;quot;launched&amp;quot; it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_collide&amp;lt;/b&amp;gt;(id, lev, x, y, tile, direction) = { {id, tile}, ~[...] }&lt;br /&gt;
:Performs collision detection on a flying object for the specified location. This is useful when directly moving monsters around (e.g., via &amp;lt;b&amp;gt;dsb_move&amp;lt;/b&amp;gt;) so that they will not apparently move &amp;quot;through&amp;quot; flying missiles.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gfxflag&amp;lt;/b&amp;gt;(id, flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gfxflag&amp;lt;/b&amp;gt;(id, flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Graphics Flag|Graphics Flag]] for a given instance.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_charge&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_charge&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets the charge of a given instance. This is normally used by limited-use items but it can have other applications. It is used to set the size of clouds and spells, too. It must be a number from 0 to 63.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_crop&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_crop&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets how much a door is cropped in its display. This is used when they open and close.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_spawnburst_begin&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_spawnburst_end&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Begins or ends a [[DSB/Spawnburst|Spawnburst]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_push_mouse&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:A shortcut command to push the specified instance into the mouse hand.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_pop_mouse&amp;lt;/b&amp;gt;() = id&lt;br /&gt;
:A shortcut command to pop anything in the mouse hand out, returning its id at the same time.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_valid_inst&amp;lt;/b&amp;gt;(id) = ternary value&lt;br /&gt;
:Returns true if the instance exists, false if it doesn&#039;t but the id is valid, and nil if it is not a valid instance id.&lt;br /&gt;
&lt;br /&gt;
==Monsters==&lt;br /&gt;
Monsters are insts as well, and (almost?) all commands that affect insts will work just the same on monsters, but monsters have their own specialized functionality as well.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_hp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_hp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s HP. Please note that this function has nothing to do with how to get or set a character&#039;s HP. In addition, the scale used by monster HP is &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; scaled up by a factor of 10.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_maxhp&amp;lt;/b&amp;gt;(id) = integer&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_maxhp&amp;lt;/b&amp;gt;(id, integer)&lt;br /&gt;
:Gets or sets a monster&#039;s max HP.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_tint&amp;lt;/b&amp;gt;(id, RGB, ~[intensity])&lt;br /&gt;
:Sets the &#039;tint&#039; of a monster, to give it a glowing effect. Monsters flash when they are hit by various spells.  There is finally an optional intensity level parameter, set at 127 by default with a range of 0 to 255.  0 Being completely black.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai&amp;lt;/b&amp;gt;(id, message, data) ~[= result]&lt;br /&gt;
:Sends an [[DSB/Monster AI|Monster AI]] message to the given monster.&lt;br /&gt;
If data is QUERY then the function will return information on the given value, rather than setting it. For example, dsb_ai(id, AI_FEAR, QUERY) will return the monster&#039;s current level of fear. [[DSB/Monster AI|Monster AI]] documentation.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_boss&amp;lt;/b&amp;gt;(id) = boss_id&lt;br /&gt;
:Returns the given monster id&#039;s boss. The &amp;quot;boss&amp;quot; is the monster in each tile who controls when the entire group moves and attacks. This allows DSB monsters to all be distinct entities, but move in DM-style groups.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_promote&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Promotes the given monster id to be the boss of its tile.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_ai_subordinates&amp;lt;/b&amp;gt;(boss_id) = { {id, tile}, [...] }&lt;br /&gt;
:Returns all monsters who are subordinate to the given boss.&lt;br /&gt;
&lt;br /&gt;
==Messaging==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg&amp;lt;/b&amp;gt;(delay, id, message, data, ~[sender])&lt;br /&gt;
:Sends the specified [[DSB/Messages|Messages]] to the specified instance after the specified delay. Messages are simply integers. The object responds to the message as specified by its msg_handler, defined in its archetype. See &amp;lt;i&amp;gt;base/msg_handlers.lua&amp;lt;/i&amp;gt; for many examples of what can be done with message handlers. Normally it doesn&#039;t matter where a message comes from. However, it is possible to assert the sender of the message, in the rare cases where it is needed.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msg_chain&amp;lt;/b&amp;gt;(id, target_id)&lt;br /&gt;
:This causes the first instance to relay any messages it receives to the second instance. This is useful for making ceiling pits close at the same time floor pits do, and other situations where an instance should pass messages along.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_msgs_to&amp;lt;/b&amp;gt;(id, delay)&lt;br /&gt;
:Delays all messages bound for a given instance by the specified delay.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_enable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Enables an instance. This will clear its INACTIVE flag as well as make sure any events, triggerings, etc. that should happen do happen. This function is easier and safer to use than setting the flag directly.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_disable&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:Disables an instance. This will set its INACTIVE flag and make sure that any objects on it stop triggering it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_toggle&amp;lt;/b&amp;gt;(id)&lt;br /&gt;
:See the previous two.&lt;br /&gt;
&lt;br /&gt;
==Light==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light&amp;lt;/b&amp;gt;(handle) = lightlevel&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_light&amp;lt;/b&amp;gt;(handle, lightlevel)&lt;br /&gt;
:Gets or sets the light level on the given light handle, which is an integer from 0 to 9. The light level displayed is the sum of the dungeon level&#039;s base light level plus the 10 light handles. Currently, light handle 0 is used for light spells, handle 1 is used for torches, and 2 is used by illumulets.&lt;br /&gt;
&lt;br /&gt;
==Conditions==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_condition&amp;lt;/b&amp;gt;(type, inventory_gfx, portrait_gfx, update_freq, function, ~[flags]) = condition_id&lt;br /&gt;
:Adds a condition (status variable) to the list of those available. The type is either PARTY (affects the whole party) or INDIVIDUAL (affects one person). For individual conditions, two graphics can be specified, one that affects the inventory screen, the other that affects the portrait area. If update_freq is &amp;gt; 0, the specified function will be called at the specified number of ticks. The function takes the following form:&lt;br /&gt;
&lt;br /&gt;
   function update_func(char, condition_strength)&lt;br /&gt;
     return new_condition_strength&lt;br /&gt;
   end&lt;br /&gt;
:&lt;br /&gt;
Flags can be specified to control other aspects of the condition&#039;s appearance on the inventory screen. These flags are COND_MOUTH_RED, COND_MOUTH_GREEN, COND_EYE_RED, and COND_EYE_GREEN. These flags only affect INDIVIDUAL conditions. There was formerly a condition type called BAD_INDIVIDUAL that was an INDIVIDUAL condition with COND_MOUTH_RED. It is now &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;deprecated&amp;lt;/font&amp;gt;. Please don&#039;t use it in new code.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_replace_condition&amp;lt;/b&amp;gt;(condition_id, type, inventory_gfx, portrait_gfx, update_freq, function)&lt;br /&gt;
:Replaces the information for the condition with the given id with the new condition. Good for changing conditions on the fly, but keep in mind that the fact that you&#039;ve changed the condition won&#039;t be saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_condition&amp;lt;/b&amp;gt;(char, condition) = strength&lt;br /&gt;
:Returns the strength of the specified condition for the specified character (or, in the case of conditions for the whole party, pass PARTY as the character)&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_condition&amp;lt;/b&amp;gt;(char, condition, strength)&lt;br /&gt;
:Sets the strength of the condition. See previous function.&lt;br /&gt;
&lt;br /&gt;
==Popups and Readouts==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_damage_popup&amp;lt;/b&amp;gt;(ppos, damage_type, integer)&lt;br /&gt;
:Shows the amount of damage taken by a character in a little popup over the character&#039;s name or portrait. The type is either HEALTH, STAMINA, or MANA, and a different background icon is displayed for each. The amount of damage shown should be in units as the player perceives them, not internal (so, divided by ten from internal representations)-- the default functions in &amp;lt;i&amp;gt;base/damage.lua&amp;lt;/i&amp;gt; take care of this for you.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_damage&amp;lt;/b&amp;gt;(integer)&lt;br /&gt;
:This causes a number in a little explosion to appear in the area occupied by the attack icons. This is used for showing the amount of damage inflicted upon a monster by a melee attack.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_attack_text&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:This causes text to momentarily appear in the area occupied by the attack icons. This is used for things like &amp;quot;CAN&#039;T REACH&amp;quot; or &amp;quot;NEED AMMO.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Fullscreen==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_fullscreen&amp;lt;/b&amp;gt;(bitmap_or_func, click_func, update_func, mouse)&lt;br /&gt;
:This engages the full-screen renderer, and is used for cut scenes or other interludes. If the first parameter passed is a bitmap, that bitmap will be displayed. If the first parameter is instead a function, that function will be executed every frame. The draw function will be passed the bitmap to draw to, the mouse&#039;s x location, and the mouse&#039;s y location, in the form: &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;draw_function&amp;lt;/b&amp;gt;(bitmap, mouse_x, mouse_y)&amp;lt;/code&amp;gt;&lt;br /&gt;
The click_func, if provided, will be executed every time the mouse is clicked. It is of the form:&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;b&amp;gt;click_func&amp;lt;/b&amp;gt;(mouse_x, mouse_y, mouse_buttons)&amp;lt;/code&amp;gt;&lt;br /&gt;
Update_func, if provided, will be executed every game tick. It takes no parameters.&lt;br /&gt;
If mouse is nil or false, no mouse pointer will be drawn. If it is true, the standard &amp;quot;yellow arrow&amp;quot; mouse pointer will be drawn. If it is a bitmap, that bitmap will be drawn as the mouse pointer.&lt;br /&gt;
The full-screen renderer will run until any of its associated functions returns something other than false or nil.&lt;br /&gt;
&lt;br /&gt;
==Subrenderers==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_subrenderer_target&amp;lt;/b&amp;gt;() = bitmap&lt;br /&gt;
:Returns a bitmap to be drawn upon. Use only in a [[DSB/Subrenderers|Subrenderer]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_objzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y)&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer bitmap. This object zone can be used to access instances that are stored inside of the given instance. See the implementation of chests in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for more information and examples.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_msgzone&amp;lt;/b&amp;gt;(bitmap, id, number, x, y, width, height, msg)&lt;br /&gt;
:Creates an object zone associated with the given id at the given x and y coordinates on the given subrenderer bitmap, with the given width and height. When it is clicked, the specified message will be sent to the instance. This can allow fairly complicated user interfaces in subrenderers.&lt;br /&gt;
&lt;br /&gt;
If the target id is SYSTEM, it will create a clickzone to control the engine instead. In those cases, two additional parameters must be specified, to pass information to the system. Allowable messages are:&lt;br /&gt;
* SYS_METHOD_OBJ, ppos, location = Shows the attack method dialogue for a given ppos from a given location&lt;br /&gt;
&lt;br /&gt;
* SYS_METHOD_SEL, inst, method = Selects the given attack method for the given instance. (Note: Currently, if the method was not first popped up via SYS_METHOD_OBJ, this will do nothing.)&lt;br /&gt;
&lt;br /&gt;
* SYS_METHOD_CLEAR, ppos, 0 = Clears the attack method for the given ppos.&lt;br /&gt;
&lt;br /&gt;
==Global Data, Utility Functions, and Misc.==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gameflag&amp;lt;/b&amp;gt;(flag) = value&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_set_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_clear_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_toggle_gameflag&amp;lt;/b&amp;gt;(flag)&lt;br /&gt;
:Gets, sets, clears, or toggles the value of a [[DSB/Global Flags|Global Flag]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_hide_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_show_mouse&amp;lt;/b&amp;gt;()&lt;br /&gt;
:Functions to make the mouse pointer appear or disappear.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
&amp;lt;b&amp;gt;dsb_unlock_game&amp;lt;/b&amp;gt;(~[flag])&lt;br /&gt;
:Functions to lock or unlock the game. Complete locking prevents most timers from running (though animations and delayed functions still will), processing any player input, or triggering anything. If you lock the game and forget to unlock it, it will be left in an unplayable state, so be very careful how you use this! Note that this takes effect immediately (that is, even before any queued moves), which may not always be what you want. You can also lock only certain parts of the game, using the [[DSB/Locking Flags|locking flags]].&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rand&amp;lt;/b&amp;gt;(min, max) = integer&lt;br /&gt;
:Generates a random integer between min and max, inclusive.&lt;br /&gt;
You should &amp;lt;b&amp;gt;always&amp;lt;/b&amp;gt; use this function for random number generation, not anything built into Lua.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_linesplit&amp;lt;/b&amp;gt;(string, split) = lines, number_of_lines&lt;br /&gt;
:A utility function that splits up a string into individual lines (placing the number of lines returned in number_of_lines) demarcated by the split character. &amp;quot;/&amp;quot; (slash) is a common choice for a a split character. See the implementation of scrolls in &amp;lt;i&amp;gt;base/objects.lua&amp;lt;/i&amp;gt; for an example.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_forward&amp;lt;/b&amp;gt;(direction) = x, y&lt;br /&gt;
:A utility function that, given a direction, returns the x and y offsets of which way is &amp;quot;forward.&amp;quot; One will always be 1 or -1, the other will always be 0.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileshift&amp;lt;/b&amp;gt;(location, direction) = location&lt;br /&gt;
:A utility function that shifts the specified location in the specified direction. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_lookup_global&amp;lt;/b&amp;gt;(string) = variable&lt;br /&gt;
:Returns the variable named by the specified string. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_delay_func&amp;lt;/b&amp;gt;(delay, function)&lt;br /&gt;
:Executes the given function after the given delay in ticks. References to Lua functions cannot be saved, so queued functions will &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; be saved. This should be something nonvital if the game is not locked, and should happen quickly. In most cases, using a message on a delay, which is saved, would work better.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_inventory_info&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the inventory_info has been changed, this lets the engine know. Note that this state is not saved.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_update_system&amp;lt;/b&amp;gt;()&lt;br /&gt;
:If the system strings or player colors have been changed, this lets the engine know. This may or may not be useful. With the moving of most inventory rendering into Lua-controlled subrenderers, this function has limited use.&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_export&amp;lt;/b&amp;gt;(string)&lt;br /&gt;
:Normally, Lua global variables aren&#039;t saved in savegames, however, a few usually need to be. If you need to store a global variable, add it to the export list with this function. Note that dsb_export requires a string giving the name of the variable. Don&#039;t pass the variable itself! You should also note that if you have a very long export list, you&#039;re probably doing something that could be done more easily with specialized code or more careful use of instances with exvars. If you don&#039;t know what this is for, you probably don&#039;t need it.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_viewport&amp;lt;/b&amp;gt;(x, y)&lt;br /&gt;
:Sets the viewport. Odds are you should leave this one alone.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_enable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_rune_disable&amp;lt;/b&amp;gt;(rune) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Deprecated)&amp;lt;/font&amp;gt;&lt;br /&gt;
:Enables or disables the specified magical rune for use in spells. All runes are enabled by default, just like in original DM. The rune is specified as an integer, where 1 = LO, 2 = UM, 7 = YA, and so on.&lt;br /&gt;
&lt;br /&gt;
These functions are now deprecated. You should manipulate the &amp;lt;b&amp;gt;g_disabled_runes&amp;lt;/b&amp;gt; table directly. For example, disabling the VI rune (rune 8) is as simple as &amp;lt;code&amp;gt;g_disabled_runes~[8] = false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_game_end&amp;lt;/b&amp;gt;(~[bool])&lt;br /&gt;
:Shows a game ending screen. Normally it&#039;s a bit more fun than the screen you get when the party dies, but if you pass it a boolean &#039;true&#039;, it will just show the standard blue &amp;quot;The End&amp;quot; screen.&lt;br /&gt;
&lt;br /&gt;
==Pending Documentation==&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_override_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_add_msgtype&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_include_file&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_music&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_screen_bitmap&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_cache_invalidate&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_tileptr_exch&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_contains&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_viewing&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_party_affecting&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_checksound&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_gamelocks&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_light_total&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_light_totalmax&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_exviewinst&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_floor&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_wallset_flip_roof&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_import_arch&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_get_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
;&amp;lt;b&amp;gt;dsb_set_pendingspell&amp;lt;/b&amp;gt;(???) = ???&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|Exposed functions]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=Main_Page&amp;diff=1345</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=Main_Page&amp;diff=1345"/>
		<updated>2010-03-25T18:35:09Z</updated>

		<summary type="html">&lt;p&gt;Sophia: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;Welcome to the Dungeon master Wiki&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This wiki is dedicated to [http://dmweb.free.fr/ Dungeon Master], its engine, its clones, and to [http://www.dungeon-master.com/forum/viewtopic.php?t=23916 custom dungeons]&lt;br /&gt;
&lt;br /&gt;
For information about the original games (mainly &#039;&#039;&#039;Dungeon Master&#039;&#039;&#039;, &#039;&#039;&#039;Chaos Strikes back&#039;&#039;&#039; and &#039;&#039;&#039;Dungeon Master II&#039;&#039;&#039;), the [http://dmweb.free.fr/ Dungeon Master Encyclopaedia] is the best place.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Clones ==&lt;br /&gt;
* [[CSBwin]] - A clone based on the original source code by [[User:Paul Stevens|Paul Stevens]]&lt;br /&gt;
* [[DM Java]] - A clone written in Java&lt;br /&gt;
* [[DSB|Dungeon Strikes Back]] - A Lua-powered DM clone&lt;br /&gt;
* [[RTC|Return to Chaos]] - A Clone of DM&lt;br /&gt;
&lt;br /&gt;
== Custom Dungeons ==&lt;br /&gt;
* [[Conflux|Conflux III]] - A CSBwin dungeon created by [[Zyx]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
	<entry>
		<id>https://dmwiki.atomas.com/w/index.php?title=DSB/DSB_for_RTC_users&amp;diff=1344</id>
		<title>DSB/DSB for RTC users</title>
		<link rel="alternate" type="text/html" href="https://dmwiki.atomas.com/w/index.php?title=DSB/DSB_for_RTC_users&amp;diff=1344"/>
		<updated>2010-03-25T18:34:36Z</updated>

		<summary type="html">&lt;p&gt;Sophia: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here are some tips and tricks for using DSB if you&#039;re used to using RTC.&lt;br /&gt;
&lt;br /&gt;
==Floor Triggers==&lt;br /&gt;
Unlike in RTC, DSB floor triggers need not be on the CENTER of the tile. By placing them on one of the other directions, you can respond only to objects that are in that position.&lt;br /&gt;
&lt;br /&gt;
It may also be important to note that unlike in RTC (I think?), no guarantee is made as to the order that multiple triggers on one tile will execute. If you need to do a complex set of tasks in a specific order, write some custom Lua code. You can also use one trigger linked to multiple targets, but you should also be aware that there is no guarantee of the order that two messages arriving in the same tick will be processed.&lt;br /&gt;
&lt;br /&gt;
If you want to rapidly enable and disable something, the best way is to continue using the RTC idiom of sending it two toggle messages. In RTC, this was necessary to avoid using a relay; in DSB, this is not the case (see WALLITEM_RELAY below) but sending an activate and a deactivate that arrive in the same tick may arrive in the wrong order, leading to undesired results.&lt;br /&gt;
&lt;br /&gt;
==Alcoves==&lt;br /&gt;
DSB alcoves are, in general, much simpler than RTC alcoves. To do complicated things in response to objects put into an alcove, put a floor trigger on the same square as the alcove and use that instead. In particular, DSB alcoves have no concept of constant weight; you will need to use a floor trigger. A CENTER&#039;d floor trigger will respond to anything put in any alcove on that tile. To respond only to a single alcove on a tile with multiple alcoves, put the trigger on the same direction as the alcove. (That is, to respond only to the alcove on the NORTH side of the tile, put the floor trigger in the NORTH tile position, not in the CENTER)&lt;br /&gt;
&lt;br /&gt;
==WALLITEM_RELAY==&lt;br /&gt;
The &amp;quot;x_relay&amp;quot; arch is designed to be an accurate emulation of RTC&#039;s WALLITEM_RELAY, but for new dungeons, DSB&#039;s own native &amp;quot;msg_sender&amp;quot; arch includes more functionality, including the ability to specify a repeat rate. For really complex relays, you&#039;re best off just converting their functionality to Lua code.&lt;br /&gt;
&lt;br /&gt;
However, one of the most common applications of relays, increasing the number of targets and/or changing the message type, is not even needed in DSB: while RTC has a maximum of eight targets per trigger and they must all be sent the same message, DSB allows an effectively unlimited number, and in addition, each target can have a different message. For example : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
exvar~[[trigger_id]] = { target = {id1, id2, id3}, msg = {M_ACTIVATE, M_TOGGLE, M_DEACTIVATE} }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will cause &amp;lt;code&amp;gt;trigger_id&amp;lt;/code&amp;gt; to send M_ACTIVATE to id1, M_TOGGLE to id2, and M_DEACTIVATE to id3.&lt;br /&gt;
&lt;br /&gt;
ESB&#039;s target editor takes care of all of this automatically.&lt;br /&gt;
&lt;br /&gt;
==Door Buttons==&lt;br /&gt;
DSB door buttons are treated the same as any other button. Unlike RTC door buttons, they must be explicitly given a message and a target if you create them by hand. ESB will take care of automatically linking door buttons with their doors. Of course, the upside to this slightly greater complexity is that door buttons in DSB can do anything that any other button can do, not just open a door on the same tile.&lt;br /&gt;
&lt;br /&gt;
==Wallsets==&lt;br /&gt;
RTC wallsets should work, unmodified, in DSB as &amp;quot;ext wallsets,&amp;quot; using &amp;lt;b&amp;gt;dsb_make_wallset_ext&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==PNG and Alpha Channels==&lt;br /&gt;
DSB supports PNG images now, so they also should work unmodified.&lt;br /&gt;
&lt;br /&gt;
[[Category:DSB|DSB for RTC users]]&lt;/div&gt;</summary>
		<author><name>Sophia</name></author>
	</entry>
</feed>