Valarin
Builder's Manual: Trigger Files
Previous Next Table of Contents

8. Trigger Files

 

8.1 The Format of a Trigger File


    #<virtual number>
    <name>~
    <intended for> <type> <number arg>
    <arg list>~
    <command 1>
    <command 2>
    .
    .
    .
    <command n>~
    #<virtual number>

    .
    .
    .

    $~
Virtual Number (VNum)
A number for the trigger. No two triggers for the same game object type (mob, item, or room), can have the same number. The virtual number must always be increasing as you go down the file, but the increments can be greater than one.

Name
The name of the trigger. This is used as a reference for manipulating triggers, though the virtual number will also work.

Intended For
Whether this trigger is inteded for mobs(0), objects(1) or rooms(2).

Type
This is the list of ASCII flags which specify the trigger types. The order does not matter, but it is case sensitive and there can not be spaces between the letters.

Valid types are:

           For Mobiles:
            a Global                 b Random                
            c Command                d Speech                
            e Act                    f Death                 
            g Greet                  h Greet-All             
            i Entry                  j Receive               
            k Fight                  l HitPrcnt              
            m Bribe                  n Load                  
            o Memory                

           For objects:
            a Global                 b Random                
            c Command                 
                                     f Timer                 
            g Get                    h Drop                  
            i Give                   j Wear                  
                                     l Remove                
                                     n Load                   

           And For Rooms:
            a Global                 b Random                
            c Command                d Speech                
                                     f Zone Reset            
            g Enter                  h Drop                  
Number Argument (NArg)
This is an integer which helps to determine if a trigger is executed. This field may not be used by some trigger types, but some number must always be in this place. The exact meaning is determined by the trigger type (see dgscripts section 4 for details).

Argument List (Arg)
This is a string field which is used to determine if a trigger is executed. It may not be used by some trigger types and can be left blank by putting a tilde on the line by itself. The exact meaning is determined by by the trigger type (see dgscripts section 4 for details).

Commands
These are a series of commands, each separated by a newline, and terminated by a tilde. Valid commands are covered in section 5.

 

8.2 Trigger File Example

    #100
    gateguard greet~
    g 100
    ~
    if (%direction% == north)
      wait 1
      emote snaps to attention as you approach.
      wait 1
      say Admittance to the city is now 10 coins for your group.
    end~
    #101
    gateguard pay 10~
    m 10
    ~
    wait 1
    unlock gate
    open gate
    wait 10
    close gate
    lock gate~
    #102
    gateguard pay 1~
    m 1
    ~
    wait 1
    say This is not enough!
    give %amount% coins %actor%~
    #103
    gateguard enter city~
    e 0
    leaves south.~
    wait 1
    close gate
    lock gate~
    #104
    gateguard gate opened~
    e 0
    The gate is opened from the other side~
    wait 5
    close gate
    lock gate~
    #99999
    $~
Previous Next Table of Contents
Builder's Information | Home