TeensyMud - 'A ruby mud server.'

FunctionalAutomatedResponseTriggersSystem

Functional Automated Response Triggers System

I wrote FARTS to test Ruby Racc. Racc (Ruby yACC) is a LALR(1) parser generator for Ruby. It looks and works just like YACC. It translates a ruby Racc file (.y) into an executable ruby program. The resulting program is dependendent on the Racc runtime module parser.rb. The runtime modules are part of the ruby core. However in order to create a parser or modify the one I created, you need to install the software from the above link which includes the parser generator.

The actual language and concepts are those found in the MercMobprogs?. When an event is handled by a GameObject it will check for and execute a trigger by the same name as the event on that GameObject. Whether the call to the trigger occurs before or after the normal event handling code is undefined. You'll have to read the code.

The first time a trigger is called on any given object, the script is compiled to an abstract syntax tree and stored on the object. Further calls to the trigger will skip the compilation step. The ASTs are not saved in the database.

The fart scripts themselves are stored in the farts directory under the name < program_name.fart >.

The command to manipulate triggers on GameObjects? is @fart:

Syntax:
@fart add #< oid > < progname > < eventtype >
@fart del #< oid > < eventtype >
@fart show #< oid >

Events

The following event types are available:

Grammar

program   : stmts

stmts     :
      | stmts stmt

stmt      : expr
      | command
      | if
      | END
      | END TRUE
      | END FALSE
      | '#' COMMENT

if        : IF expr stmts else ENDIF

else      : ELSE stmts
      | command   : ID
      | ID STRING

expr      : '!' expr
      | expr '==' expr
      | expr '!=' expr
      | expr '>' expr
      | expr '>=' expr
      | expr '<' expr
      | expr '<=' expr
      | expr <AND|'&&'> expr
      | expr <OR|'||'> expr
      | '(' expr ')'
      | '-' expr 
      | function
      | atom

atom      : NUMBER
      | FLOAT
      | STRING
      | ACTOR 
      | ACTOR '.' ID
      | THIS
      | THIS '.' ID
      | ARGS
      | ARGS '.' ID

function  : ID '(' args ')'

args      :
      | expr
      | args ',' expr

Modules