Muds Wiki
Advertisement

Template:Unsourced DG scripts is a MUD scripting language that MUD builders can use to quickly add advanced interactive features to a MUD without requiring knowledge of a difficult programming language such as C.

The Death's Gate Language[]

The DG Scripting language was first developed at the now-defunct Death's Gate MUD, and is now a common addition to CircleMUD and some other codebases. DG Scripts are now part of the tbaMUD release which is the continuation of CircleMUD from a different Development Team.

While simple and quick to learn, DG is a complete programming language, and all the normal programming expression conventions such as 'if' and 'while' are available.

DG Scripts is based on the idea of the 'trigger' - a small program (script) which is called (run) as a consequence of a certain action. Triggers are normally attached to a mobile, object, or room (as of tbaMUD 3.58 they are also attachable to players themselves). Although this may sound restrictive, in practice this set up is limited only by the imagination, as the results of one trigger will often be used to trigger another.

The player, of course, does not usually see the association between object and trigger, so the effects can seem intelligent or random, adding excitement to the MUD. The association can be further masked by a delay or by assigning a variable which is noticed by another trigger later.

Trigger Types[]

There are many trigger types, here are five of the most important.

  • Random - this trigger is like a dice that is thrown every few seconds, with a certain percentage chance of success.
  • Command - This lets you create an ad-hoc or local command, i.e. one that only works in one room.
  • Speech - This trigger is called if certain keywords or a key phrase is spoken.
  • Act - This trigger runs in response to a certain act.
  • Greet - This trigger runs when a player (or mob) enters the room.

Variables[]

In DG scripts, percent signs are used to show that a word is a variable (similar to csh), for example: %actor.name%.

The first half of the variable can refer to an actor (player or mob that trips the trigger), or to a mobile, object or room. The second half refers to a property that player or object has, such as the name, virtual number, strength and so on.

Commands[]

A script can use any of the normal game commands. It can also use some special 'wizard-like' commands. In most implementations of DG scripts, these commands are prefixed with m, o or w (for mobile, object or room).

  • teleport - move a player, mobile or object to somewhere else.
  • echo - allows free-form text to be displayed within the room.
  • mat - allows commands to be run in other rooms.
  • purge - destroy an object.
  • load - bring a new object or mobile into the game.
  • force - make a player or mobile to do something.

The following is not to be considered gameplay advice or 'how-to-play'. It simply shows a working script for a programming language and has no use to the average player. This is intended as an example for a game designer.

This is an actual script that was used in ActsMUD for a while. In this script, if a particular cupboard becomes empty, then a cook will wash up some cups and put them away in the cupboard.

Although it seems, to the player, that the cook is reacting to events; the cook is actually a puppet of the cupboard which stays in full control. The cupboard checks itself every few seconds to see 'if' there are no cups inside (object 22222 is a cup). If so, then the cupboard creates (loads) some new cups, and forces the cook to pick them up (%force% cook get cup), and put them in the cupboard (%force% cook put cup cupboard). The say and echo commands are just to make it all seem a little more natural.

0) Vnum  : 11111
1) Name  : Cupboard refill
2) Intended for : Objects
3) Trigger types: Random
4) Numeric Arg  : 100
5) Arguments  :
6) Commands:
set cook cook
if !%cook%
halt
end
if %self.count(22222)% == 0
%force% cook say Raca! There are no cups in the cupboard.
%load% obj 22222
%force% cook get cup
%load% obj 22222
%force% cook get cup
%load% obj 22222
%force% cook get cup
%echo% The cook does some frantic washing up.
%force% cook put cup cupboard
%force% cook put cup cupboard
%force% cook put cup cupboard
%force% cook Say that is better
end

External links[]

Smallwikipedialogo.png This page uses content from Wikipedia. The original article was at DG scripts.
The list of authors can be seen in the page history. As with Muds Wiki, the text of Wikipedia is available under the Creative Commons Attribution-Share Alike License 3.0 (Unported) (CC-BY-SA).
Advertisement