DG scripts

DG scripts

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.

Contents

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


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Scripts (artificial intelligence) — Scripts were developed in the early AI work by Roger Schank, Robert P. Abelson and their research group, and are a method of representing procedural knowledge. They are very much like frames, except the values that fill the slots must be… …   Wikipedia

  • Scripts — Шрифты, имитирующие рукописный …   Краткий толковый словарь по полиграфии

  • scripts — skrɪpt n. handwriting, penmanship; original document; written text, manuscript; written text for a play (or film, television program, etc.); alphabet, system of writing; batch file, set of instructions that is executed without user interaction… …   English contemporary dictionary

  • scripts obligationes scriptis tolluntur, et nudi consensus obligatio contrario consensu dissolvitur — /skriptiy oblageyshiyowniyz skriptas tolanta/, et n(y)uwday kansensas 6blageysh(iy)ow kantreriyow kansens(y)uw dazolvatar/ Written obligations are superseded by writings, and an obligation of naked assent is dissolved by assent to the contrary …   Black's law dictionary

  • SCRIPTS — …   Useful english dictionary

  • Express Scripts — Express Scripts, Inc. Type Public company S P 500 Component Traded as NASDAQ: ESRX …   Wikipedia

  • Unicode scripts — In Unicode, a script is a collection of letters and other written signs used to represent textual information in one or more writing systems. [ [http://unicode.org/glossary/ Glosary of Unicode Terms] ] For example the Latin script supports… …   Wikipedia

  • Chinese family of scripts — Left: Chinese character in Traditional Chinese (hanzi, kanji, hanja, and hán tự). Right: Chinese character in Simplified Chinese The Chinese family of scripts are writing systems descended from the Chinese Oracle Bone Script and used for a… …   Wikipedia

  • Brahmic family of scripts — The Brahmic family is a family of syllabaries (writing systems) used in South Asia, Southeast Asia, and parts of Central Asia and East Asia, descended from the Brāhmī script of Mauryan India.The individual syllabaries may be called Brahmic… …   Wikipedia

  • Ancient Philippine scripts — are systems of writing that developed and flourished in the Philippine islands in about 300 BC. These scripts are related to other Southeast Asian systems of writing that developed from South Indian Brahmi scripts used in Asoka Inscriptions and… …   Wikipedia

  • Paleohispanic scripts — The Paleohispanic scripts are the writing systems created in the Iberian peninsula before the Latin alphabet became the dominant script. Most of them are typologically very unusual in that they are semi syllabic rather than purely alphabetic,… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”