buddha/bin/
buddha/cnf/
buddha/lib/
buddha/lib/etc/boards/
buddha/lib/house/
buddha/lib/misc/
buddha/lib/plralias/ZZZ/
buddha/lib/plrfiles/
buddha/lib/plrfiles/ZZZ/
buddha/lib/plrobjs/
buddha/lib/plrobjs/ZZZ/
buddha/lib/world/
buddha/lib/world/gld/
buddha/src/
buddha/src/doc/
#0
Tutorial 1310 - Quest Offer~
0 g 100
~
* we don't want him to tell this to mobs. vnum -1 is reserved for players.
if %actor.vnum% == -1
  * only greet players coming from the south.
  if %direction% == south
    *wait 1 second, always give the player time before you start sending text.
    wait 1 sec
    say Can you help me, %actor.name%?
    wait 1 sec
    say An apprehensive ogre has something of mine.
    wait 1 sec
    say If you slay him I'll give you all the coins I can spare.
    wait 1 sec
    say Please, bring me the apprehension he has stolen.
    wait 2 sec
    emote looks to the east.
  end
end
~
#1
Tutorial 1311 - Kill Ogre~
0 f 100
~
say you got the best of me %actor.name%.
* load some apprehension
%load% obj 1300
* reload the mob for the next questor
%load% mob 1311
~
#2
Tutorial 1310 - Give/Quest Completion~
0 j 100
~
* check if this was indeed the right object
if %object.vnum% == 1300
  wait 1 sec
  say Thank you, %actor.name%
  %send% %actor% %self.name% gives you a gold piece.
  %echoaround% %actor% %actor.name% is rewarded for his valor.
  nop %actor.gold(1)%
  wait 5 sec
  %purge% %object%
else
  * this wasn't the right object - don't accept it
  say I don't want that - bring me back my apprehension.
  return 0
end
~
#3
Tutorial 1311 - Ogre Load~
0 n 100
~
wait 3 sec
say I'm back. Did you really think you could kill me so easily?
~
#4
Tutorial II 1312 - Guard Greet~
0 g 100
~
if %direction% == south
 wait 1 sec
 emote snaps to attention as you approach. 
 wait 1 sec
 say Admittance to the city is 10 coins. 
end 
~
#5
Tutorial II 1312 - Guard Bribe 10~
0 m 10
~
wait 1 sec
unlock gate 
wait 1 sec
open gate 
wait 10 sec 
close gate 
wait 1 sec
lock gate 
~
#6
Tutorial II 1312 - Guard Bribe < 10~
0 m 1
~
wait 1 sec
say This is not enough! 
wait 1 sec
give %amount% coins %actor.name% 
~
#7
Tutorial II 1312 - Guard Closes Gate~
0 e 0
The gate is opened from~
wait 5 sec 
close gate 
wait 1 sec
lock gate 
~
#8
Tutorial II 1312 - Guard Closes Gate~
0 e 0
leaves north.~
wait 1 sec
close gate 
wait 1 sec
lock gate 
~
#9
Tutorial Quest 1317 - Starter~
0 g 100
~
if %direction% == south
  if %actor.varexists(solved_example_quest_zone_14)%
    wait 1 sec
    say you have already completed this quest.
    halt
  else
    wait 1 sec
    say Hello, %actor.name%. Could you find me the magic eight ball?
    say Please say yes, %actor.name%.
  end
end
~
#10
Tutorial Quest 1317 - Accept~
0 d 1
yes~
if %actor.varexists(solved_example_quest_zone_14)%
  halt
else
  wait 1 sec
  say Perfect, %actor.name%. I'll make this easy. It is to the east.
  wait 3 sec
  say I'd go get it myself, but I'm lazy and you need the exercise.
  wait 1 sec
end
~
#11
Tutorial Quest 1317 - Completion~
0 j 100
~
   if %actor.varexists(solved_example_quest_zone_14)%
  halt
end
*
wait 1 sec
if %object.vnum% == 1394
  dance
  wait 1 sec
  say Thank you, %actor.name%.
  nop %actor.exp(50)%
  nop %actor.gold(50)%
  say finally, now I can get some answers.
  wait 1 sec
  emote shakes the magic eight ball vigorously.
  wait 1 sec
  emote does not seem too pleased with his answer.
  set solved_example_quest_zone_14 1
  remote solved_example_quest_zone_14 %actor.id%
  %purge% %object%
else
  say I don't want that!
  junk %object.name%
end
~
#12
Tutorial Quest 1441 - Load 8ball~
2 g 100
~
wait 2 sec
%echoaround% %actor.name% A magic eight ball drops from the sky striking %actor.name% on the head.
%send% %actor% A magic eight ball drops from the sky striking you on the head.
%load% obj 1394
%damage% %actor% %random.5%
~
#13
Restorative Comfy Bed 1401 - Sleep~
1 c 100
sl~
* does not work for level 32 and above.
if %mud.mudcommand% == sleep && %arg% == bed
  %force% %actor% sleep
  set laying_in_comfy_bed_14 1
  remote laying_in_comfy_bed_14 %actor.id%
end
~
#14
Restorative Comfy Bed 1401 - Heal~
1 b 100
~
if %random.char%
  set actor %random.char%
  if %actor.varexists(laying_in_comfy_bed_14)%
    %damage% %actor% -10
    %echo% %actor.name% seems refreshed from sleeping in the comfy bed.
  end
end
~
#15
Restorative Comfy Bed 1401 - Wake~
1 c 100
wa~
* does not work for level 32 and above.
if %cmd.mudcommand% == wake
  %force% %actor% wake
  rdelete laying_in_comfy_bed_14 %actor.id%
end
~
#16
Damage Example~
2 g 100
~
* By Rumble
* First put a wait in so the echo waits for the player to get into the room.
wait 1 sec
%echo% As %actor.name% enters the room a bolt of lightning smites %actor.himher%.
* Take away 10 hitpoints
%damage% %actor% 10
wait 5 sec
%echo% The Gods feel sorry for %actor.name% and restore him to full health.
* Restore 10 hitpoints (-# heals the actor).
%damage% %actor% -10
* Another Example that damages actor to 1 hitpoint
wait 2 sec
%echo% hp: %actor.hitp%
eval all_but_one_hitp %actor.hitp% - 1
%echo% all_but_one_hitp: %all_but_one_hitp%
if %all_but_one_hitp% > 0
  %damage% %actor% %all_but_one_hitp%
  %echo% hp: %actor.hitp%
end
~
#17
Door Example~
2 c 100
move~
* Example by Falstar for room 14520
* The following trigger is designed to reveal a trapdoor leading down when 
* Player types 'Move Chest'
*
* The following ARGument determines what can be MOVEd ('move' Command inserted
* in Arg List of trigger)
if %arg% == chest
  *Send text to player to show effect of command
  %send% %actor% You move the chest across the floor, revealing a trapdoor underneath!!
  *Send text to other players in room to inform them of Player's discovery
  %echoaround% %actor.name% %actor.name% has discovered a hidden trapdoor under a chest!
  * Set door flags to 'ab' - Exit is a door that can be opened and closed, then close door
  %door% 14520 down flags ab
  * Change door name to 'trapdoor' (used in door commands, eg open trapdoor, lock trapdoor)
  %door% 14520 down name trapdoor
  * Set room that trapdoor exits leads to (Room 14521 in this case)
  %door% 14520 down room 14521
  * Set Exit desc for the wary adventure who decides to 'look down'
  %door% 14520 down description A wooden ladder leads down into the darkness.
  * Set the Vnum of the KEY OBJECT which will lock/unlock door
  %door% 14520 down key 14500
  * Now for Continuity, door commands must be set for reverse direction FROM 14521
  %door% 14521 up flags ab
  %door% 14521 up name trapdoor
  %door% 14521 up room 14520
  %door% 14521 up description A wooden ladder leads up into a storeroom.
  %door% 14521 up key 14500
  * IMPORTANT: Note reverse of direction in both the commands and extra 
  * descriptions and room numbers it can be very easy to get lost here and 
  * probably get your adventurer lost too. Finally set up what happens when 
  * adventurer tries to move anything else and end the trigger
else
  %send% %actor% Move what ?!
end
* Another example by Welcor
* if %arg% == tapestries
*   %send% %actor% You pull the tapestries down, and reveal a secret vault!
*   %echoaround% %actor% As %actor.name% pulls the tapestries down a secret vault is revealed.
*   %door% 23667 east flags abcd
*   %door% 23667 east key 23634
*   %door% 23667 east name vault
*   %door% 23667 east room 23668 
* else
*   %send% %actor% Pull what ?!
* end
~
#18
Switch Echo Example~
2 g 100
~
* By Rumble
* put a wait in here so it doesn't fire before the player enters the room
wait 1
switch %random.3%
  case 1
    * only the person entering the room will see this.
    %send% %actor% You trip over a root as you walk into the room. 
    * everyone in the room except the actor will see this.
    %echoaround% %actor% %actor.name% trips on a root walking into the room.
    * everyone in the room will see this.
    %echo% The root suddenly springs to life and attacks!
    * let everyone in the zone hear about this.
    %zoneecho% %self.vnum% %actor.name% is a clutz.
  break
  case 2
    %send% %actor% You strut into the room. 
    %echoaround% %actor% %actor.name% Seems to have a big head..
    %echo% A strong breeze kicks some leaves up into the air.
  break
  case 3
    %echo% A light breeze picks up, causing the leaves to rustle quietly.
  break
  default
    * this should be here, even if it's never reached
    %echo% This is the default case in case I missed something
  break
done
~
#19
AT Example~
2 b 100
~
%at% 1233 %echo% wat'd to a room
%at% Rumble %echo% wat'd to Rumble
~
#20
Rumble's Spy~
0 d 100
*~
* Arguments: * means all speech will trigger this.
* This will echo all speech to Rumble.
%at% rumble %echo% %actor.name% says, '%speech%'
~
#21
Transform Example~
0 g 100
~
* %transform% test
* as a greet trigger, entering the room will cause
* the mob this is attached to, to toggle between mob 1 and 99.
say Beginning transform.
if %self.vnum%==1
  %transform% 99
else
  %transform% -1
end
say Transform complete.
~
#22
IF Example~
0 g 100
~
* By Relsqui
* First we set %anumber% to some number between 1 and 100.
eval anumber %random.100%
* Then the beginning of the if-block.
if (%anumber% == 5)
  * The following commands are only executed if the above condition is true.
  * (That is, if %anumber% is equal to 5.)
  clap
  say It's your lucky day!
  say You picked my favorite number!
  * If those commands were executed, the program skips to the next end.
  * Otherwise, it looks for an elseif.
elseif (%anumber% > 90)
  * To read the following commands, the program must have determined the 
  * following: The first condition (%anumber% == 5) is false.
  * The second condition (%anumber% > 90) is true.
  emote shrinks down to the size of a mouse.
  say Squeak squeak squeak!
  * If the first elseif condition was also false, the program looks for the 
  * next one.
elseif (%anumber% < 10)
  * Here's a tricky one.
  * If %anumber% equals 5, the program will already have run the commands 
  * immediately after the if-statement at the top. Therefore, the following 
  * commands only run when: %anumber% is not five (failing the first check.)
  * %anumber% is not greater than 90 (failing the second check.)
  * %anumber% is less than 10 (passing the third check.)
  emote grows an elephant's nose.
  emote blows a mighty blast with %self.hisher% trunk.
  * And now, the default, when %anumber% fails all the above checks.
else
  * Note that else has no condition.
  emote disappears in a cloud of blue smoke.
  %purge% %self%
  * For that to happen, all of this must be true: %anumber% is not five. 
  * %anumber% is not greater than 90. %anumber% is not less than 10. If all 
  * those conditions are met, the mob will disappear in a cloud of blue smoke.
  * Finally, please don't forget the all-important...
end
* Ends are good. They tell the program when the if-block is over. After any of 
* the above sets of commands runs, the program skips to the next end. 
*
* Notes:
* We could have omitted the else. If we had, and none of the conditions had 
* been met, no commands in the if-block would run. However, there can never be 
* more than one else. There is only one default. There must always be the same
* number of if's and end's. We could have had any number of ifelses, from zero 
* on up. To summarize, here is the basic format of an if-block:
* if (condition)
*   (commands)
* elseif (condition) <---optional. 0 or more
*   (commands)
* else <---optional. 1 or 0
*   (commands)
* end
*
* So the simplest possible if-block would be:
* if (condition)
*   (commands)
* end
~
#23
Object While Damage Example~
1 h 100
~
* By Rumble
* A script to make a bomb go off 3 seconds after it is dropped.
set room_var %actor.room%
* Wait, then send a message when the bomb goes off.
wait 3 s
%echo% The Grenade blasts into smithereens, striking everyone here.
* Target the first char
set target_char %room_var.people%
* Do stuff
while %target_char%
  * Set the next target before this one perhaps dies.
  set tmp_target %target_char.next_in_room%
  * This is where the good/bad things are supposed to happen.
  %send% %target_char% The explosion hurts you.
  %damage% %target_char% 30
  * Find next target
  set target_char %tmp_target%
  * Loop back
done
~
#24
Room While Teleport Example~
2 b 100
~
* By Rumble
*Determine number of people in the room.
eval person %self.people%
%echo% There are %person% people here.
wait 1 sec
*While there are still people in the room.
while (%person%) 
  %send% %person% You are next!
  %echo% I am targetting %person.name%.
  %echoaround% %person% %person.name% is struck by a bolt of lightning. Leaving only a pile of ash.
  %teleport% %person% 1300
  %force% %person% look
  eval person %self.people%
done
~
#25
Command Example~
2 c 100
l~
if %cmd.mudcommand% == look && window /= %arg%
  %echo% %actor.name% %arg% at the %arg%.
end
~
#26
Blocks Mobs Not Following~
2 g 100
~
* This trigger blocks all mobs except those that are charmed, pets, etc.
* If it is a mob (players are vnum -1, mobs are anything higher than that).
if %actor.vnum% == -1
  * If the mob does not have a master than do not let it enter.
  if !%actor.master%
    return 0
  end
end
~
#27
Character Variables Example~
0 b 100
~
* Variables Example by Rumble
* Random trigger so we must define actor
set actor %random.char%
* Make sure actor can be seen and is a player.
if %actor.canbeseen% && %actor.vnum% == -1
  %echo% ACTOR.NAME:      %actor.name%
  %echo% ALIAS:           %actor.alias%
  %echo% CANBESEEN:       %actor.canbeseen%
  %echo% CHARISMA:        %actor.cha%
  %echo% CLASS:           %actor.class%
  %echo% CONSTITUTION:    %actor.con%
  %echo% DEXTERITY:       %actor.dex%
  %echo% EXPERIENCE:      %actor.exp%
  %echo% FIGHTING:        %actor.fighting%
  %echo% GOLD:            %actor.gold%
  %echo% HAS_ITEM:        %actor.has_item(1300)%
  %echo% ID:              %actor.id%
  %echo% INTELLIGENCE:    %actor.int%
  %echo% IS_KILLER:       %actor.is_killer%
  %echo% IS_THIEF:        %actor.is_thief%
  %echo% LEVEL:           %actor.level%
  %echo% HITPOINTS:       %actor.hitp%
  %echo% MANA:            %actor.mana%
  %echo% MOVEMENT POINTS: %actor.move%
  %echo% MASTER:          %actor.master%
  %echo% FOLLOWER:        %actor.follower%
  %echo% MAX HITPOINTS:   %actor.maxhitp%
  %echo% MAX MANA:        %actor.maxmana%
  %echo% MAX MOVE:        %actor.maxmove%
  %echo% NEXT_IN_ROOM:    %actor.next_in_room%
  %echo% PRACTICES        %actor.prac%
  %echo% ROOM:            %actor.room%
  %echo% SEX:             %actor.sex%
  %echo% HISHER:          %actor.hisher%
  %echo% HESHE:           %actor.heshe%
  %echo% HIMHER:          %actor.himher%
  %echo% INVENTORY:       %actor.inventory%
  %echo% SKILL BACKSTAB:  %actor.skill(backstab)%
  %echo% STRENGTH/STRADD: %actor.str%/%actor.stradd%
  %echo% TITLE:           %actor.title%
  %echo% VNUM:            %actor.vnum%
  %echo% WISDOM:          %actor.wis%
  %echo% WEIGHT:          %actor.weight%
  * Objects TSTAT 28, Rooms TSTAT 29, Text TSTAT 30, Special TSTAT 31.
  *
  * equipment positions: 0-18 or light, rfinger, lfinger, neck1, neck2, 
  * body, head, legs, feet, hands, arms, shield, about, waist, rwrist, 
  * lwrist, wield, hold, inv
  * This example will check wield 16
  if %actor.eq(wield)%
    eval wield %actor.eq(wield)%
    %echo% WIELDING ID: %wield.id%, NAME: %wield.name%, SHORTDESC: %wield.shortdesc%, TIMER:: %wield.timer%, TYPE: %wield.type%, VAL0: %wield.val0%, VAL1: %wield.val1%, VAL2: %wield.val2%, VAL3: %wield.val3%, VNUM: %wield.vnum%, 
    %echo% CARRIED_BY: %wield.carried_by%, NEXT_IN_LIST: %wield.next_in_list%, WORN_BY: %wield.worn_by%, WEIGHT: %wield.weight%, COST: %wield.cost%, COST_PER_DAY: %wield.cost_per_day%
  end
end
~
#28
Object Variables Example~
1 b 100
~
* By Rumble
%echo% ID:           %self.id%
%echo% NAME:         %self.name%
%echo% SHORTDESC:    %self.shortdesc%
%echo% TIMER:        %self.timer%
%echo% TYPE:         %self.type%
%echo% VAL0:         %self.val0%
%echo% VAL1:         %self.val1%
%echo% VAL2:         %self.val2%
%echo% VAL3:         %self.val3%
%echo% VNUM:         %self.vnum%
%echo% CARRIED_BY:   %self.carried_by%
%echo% NEXT_IN_LIST: %self.next_in_list%
%echo% WORN_BY:      %self.worn_by%
%echo% WEIGHT:       %self.weight%
%echo% COST:         %self.cost%
%echo% COST_PER_DAY: %self.cost_per_day%
%echo% CONTENTS:     %self.contents%
%echo% IS_INROOM:    %self.is_inroom%
%echo% ROOM:         %self.room%
%purge% self
~
#29
Room Variables Example~
2 b 100
~
* By Rumble
%echo% ID:       %self.id%
%echo% NAME:     %self.name%
%echo% NORTH:    %self.north% %self.north(vnum)% 
%echo% SOUTH:    %self.south% %self.south(key)%
%echo% EAST:     %self.east% %self.east(bits)%
%echo% WEST:     %self.west% %self.west(room)%
%echo% UP:       %self.up%
%echo% DOWN:     %self.down%
%echo% VNUM:     %self.vnum%
%echo% PEOPLE:   %self.people%
%echo% WEATHER:  %self.weather%
%echo% SECTOR:   %self.sector%
%echo% CONTENTS: %self.contents%
~
#30
Text Variables Example~
2 d 100
*~
* By Rumble
* The Arguments: * means all speech will fire the trigger.
%echo% SPEECH:     %speech%
%echo% STRLEN:     %speech.strlen%
%echo% TRIM:       %speech.trim%
%echo% CAR:        %speech.car%
%echo% CDR:        %speech.cdr%
%echo% MUDCOMMAND: %speech.mudcommand%
%echo% CONTAINS:   %speech.contains(test)%
~
#31
Special Variables Example~
2 bd 100
*~
* By Rumble
%echo% SELF ID:    %self.id%
%echo% HOUR:       %time.hour%
%echo% DAY:        %time.day%
%echo% MONTH:      %time.month%
%echo% YEAR:       %time.year%
%echo% PEOPLE:     %people.1233%
%echo% RANDOM NUM: %random.99%
%echo% RANDOM PC:  %random.char%
%echo% SPEECH:     %speech%
~
#32
Mob Checks Player Inventory~
0 g 100
~
* By Jamie Nelson modified by Rumble* Checks if the actor is wielding the item
if %actor.eq(wield)%
eval wep %actor.eq(wield)%
if %wep.vnum%==1300
set has_it 1
end
end
* Checks the actors inventory if not wielding it.
if !%has_it%
eval i %actor.inventory%
while %i%
set next %i.next_in_list%
if %i.vnum%==1300
set has_it 1
break
end
* checks inside containers
if %i.type% == CONTAINER
while %i.contents%
if %i.contents.vnum%==1300
set has_it 1
break
end
done
end    
set i %next%
done
end
* 
if %has_it%
say %actor.name% has that special item.
else
say %actor.name% doesnt have that crappy item.
end
~
#33
Mob Quote Using Arrays~
0 d 100
quote~
* By Jamie Nelson from the forum http://groups.yahoo.com/group/dg_scripts/
eval w1max %random.20%
eval w2max %random.20%
eval w3max %random.20%
eval w4max %random.20%
eval w5max %random.11%
eval w6max %random.20%
set  w1[0] phenomenal
set  w1[1] rapid
set w1[2] chilling
set  w1[3] insipid
set  w1[4] nauseating
set  w1[5] astronomical
set  w1[6] austere
set  w1[7] inevitable
set  w1[8] inescapable
set  w1[9] reckless
set  w1[10] haphazard
set  w1[11] accelerating
set  w1[12] profound
set  w1[13] awesome
set  w1[14] terrifying
set  w1[15] ubiquitous
set  w1[16] ignominious
set  w1[17] unprecedented
set  w1[18] unparalleled
set  w1[19] insidious
set  w1[20] broad
set  w2[0] growth
set  w2[1] decline
set  w2[2] prospects
set  w2[3] acceleration
set  w2[4] threat
set  w2[5] expansion
set  w2[6] oneness
set  w2[7] outgrowth
set  w2[8] madness
set  w2[9] evacuation
set  w2[10] diminishment
set  w2[11] consumption
set  w2[12] decay
set  w2[13] putrefaction
set  w2[14] vapidity
set  w2[15] downsizing
set  w2[16] degeneration
set  w2[17] litigation
set  w2[18] declivity
set  w2[19] hastening
set  w2[20] paradigm shifting
set  w3[0] the Internet
set  w3[1] urban tax dollars
set  w3[2] new technologies
set  w3[3] gender identification disorders
set  w3[4] censorship
set  w3[5] interpersonal communications
set  w3[6] modern life
set  w3[7] rampant paradigm shifts
set  w3[8] consumer spending
set  w3[9] rain forests
set  w3[10] human literacy
set  w3[11] natural resources
set  w3[12] traditional values
set  w3[13] media junk food
set  w3[14] family values
set  w3[15] corporate mentality
set  w3[16] the American justice system
set  w3[17] technological change
set  w3[18] the ozone layer
set  w3[19] human resources
set  w3[20] current epistemologies
set  w4[0] forever dissipate
set  w4[1] escalate
set  w4[2] aggrandize
set  w4[3] overhaul
set  w4[4] deteriorate
set  w4[5] revolutionize
set  w4[6] uglify
set  w4[7] put an end to
set  w4[8] enslave
set  w4[9] bankrupt
set  w4[10] truncate
set  w4[11] nullify
set  w4[12] sabotage
set  w4[13] destabilize
set  w4[14] incapacitate
set  w4[15] hasten
set  w4[16] dehumanize
set  w4[17] evaporate
set  w4[18] indenture
set  w4[19] intensify
set  w4[20] undermine
set  w5[0] today's
set  w5[1] tomorrow's
set  w5[2] the entrenchment of our
set  w5[3] worldwide
set  w5[4] our children's
set  w5[5] modern
set  w5[6] all of our
set  w5[7] our future
set  w5[8] our
set  w5[9] the demise of our
set  w5[10] our grandchildren's
set  w5[11] all hope for
set  w6[0] business models
set  w6[1] re-ruralization
set  w6[2] human condition
set  w6[3] family values
set  w6[4] self-esteem
set  w6[5] medical insights
set  w6[6] human psyche
set  w6[7] human depth
set  w6[8] egalitarianism
set  w6[9] World Wide Web
set  w6[10] future values
set  w6[11] hopes and dreams
set  w6[12] business models
set  w6[13] political climate
set  w6[14] education
set  w6[15] cultural heritage
set  w6[16] lifestyles
set  w6[17] fiduciary responsibility
set  w6[18] genetic diversity
set  w6[19] intestinal fortitude
set  w6[20] computer literacy
set w1 %%w1[%w1max%]%%
eval w1 %w1%
set msg The %w1%
set w2 %%w2[%w2max%]%%
eval w2 %w2%
set msg %msg% %w2% of
set w3 %%w3[%w3max%]%%
eval w3 %w3%
set msg %msg% %w3%
set w4 %%w4[%w4max%]%%
eval w4 %w4%
set msg %msg% will %w4%
set w5 %%w5[%w5max%]%%
eval w5 %w5%
set msg %msg% %w5%
set w6 %%w6[%w6max%]%%
eval w6 %w6%
set msg %msg% %w6%
say %msg%
~
#34
Switch Example~
0 g 100
~
* By Falstar
switch %random.6%
  case 0
    set book 'Creative cooking with human flesh'
  break
  case 1
    set book 'Re-animating the Dead for Dummies'
  break
  case 2
    set book 'How to teach your henchman to rob graves in 7 days'
  break
  case 3
    set book 'An A-Z guide of Mage-induced maladies and mutations'
  break
  case 4
    set book '101 Easy ways to rescue a damsel in distress'
  break
  case 5
    set book 'Witch Hazel's Bumper Book of rare herbs and potions'
  break
  case 6
    set book 'Arcane Artifacts made easy'
  break
  default
    * this should be here, even if it's never reached
    set book default reached
done
*
wait 1 s
%echo% Dr. Von Erhartz seems engrossed in reading a large leatherbound book through a battered pair
%echo% of reading glasses. The title reads: %book%.
%echo% The doctor looks up at you, seeming to notice you for the first time.
wait 1 s
say ah %actor.name%, I was wondering when you'd drop by.
~
#35
Mob Room Wander Switch~
0 b 100
~
* By Rumble
* So we don't get problems if more than one is loaded.
context %self.id%
eval room %self.room%
switch %room.vnum%
  case 1300
    say this is where I began my journey.
    break
  case 1301
    say Ah, yes, the beginning.
    break
  case 1302
    say TBA, The Builder's Academy Implementation explained!
    break
  case 1303
    say Building blocks for beginners.
    break
  case 1304
    say Writing good descriptions. Very important.
    break
   case 1305
    say Learning redit.
    break
  case 1306
    say Oedit by osmosis.
    break
  case 1307
    say Medit by the numbers.
    break
  case 1308
    say Zedit confuses everyone.
    break
  case 1309
    say Sedit. We all love capitalism.
    break
  case 1310
    say Trigedit is tricky.
    break
  case 1311
    say Planning for those who lack direction.
    break
  case 1312
    say Advanced building, what an interesting topic.
    break
  case 1421
    say Storytelling, now that is a good idea.
    break
  case 1313
    say I'm finished. Finally. That Rumble is long winded.
    break
  default
    say so much reading, so little time.
    break
done
~
#36
Time Example~
0 b 1
~
* By Rumble w/help from Jamie Nelson on http://groups.yahoo.com/group/dg_scripts/
* Convert hour from 24 hour to 12 hour clock with am/pm
if %time.hour% > 12
  eval hour %time.hour% - 12
  set ampm pm
else
  set hour %time.hour%
  set ampm am
end
*
* No 0 hour. Change it to 12.
if %time.hour% == 0
  set hour 12
end
*
* Figure out what day (1-35).
switch %time.day%
  case 1
  case 7
  case 14
  case 21
  case 28
  case 35
    set day the Day of the Moon
    break
  case 2
  case 8
  case 15
  case 22
  case 29
  set day the Day of the Bull
    break
  case 3
  case 9
  case 16
  case 23
  case 30
  set day the Day of the Deception
    break
  case 4
  case 10
  case 17
  case 24
  case 31
  set day the Day of Thunder
    break
  case 5
  case 11
  case 18
  case 25
  case 32
  set day the Day of Freedom
    break
  case 6
  case 12
  case 19
  case 26
  case 33
  set day the Day of the Great Gods
    break
  case 7
  case 13
  case 20
  case 27
  case 34
  set day the Day of the Sun
    break
  default
    set day I don't know what day it is
    break
done
*
* What suffix should we use for the number of the day.
switch %time.day%
  case 1
  case 21
  case 31
    set suf st
    break
  case 2
  case 22
  case 32
    set suf nd
    break
  case 3
  case 23
  case 33
    set suf rd
    break
  default
    set suf th
    break
done
*
* What month are we in (1-17).
    set m1 Month of Winter
    set m2 Month of the Winter Wolf
    set m3 Month of the Frost Giant
    set m4 Month of the Old Forces
    set m5 Month of the Grand Struggle
    set m6 Month of the Spring
    set m7 Month of Nature
    set m8 Month of Futility
    set m9 Month of the Dragon
    set m10 Month of the Sun
    set m11 Month of the Heat
    set m12 Month of the Battle
    set m13 Month of the Dark Shades
    set m14 Month of the Shadows
    set m15 Month of the Long Shadows
    set m16 Month of the Ancient Darkness
    set m17 Month of the Great Evil
eval months %%m%time.month%%%
*
* My test to make sure my variables are printing out what I expect them to.
* %echo% Hour: %time.hour% Day: %time.day% Month: %time.month% Year: %time.year%
*
* Finally the output.
%echo% It is %hour% o'clock %ampm%, on %day%.
%echo% The %time.day%%suf% Day of the %months%, Year %time.year%.
~
#37
Emote Copycat~
0 c 100
e~
if %cmd.mudcommand% == emote && %arg%
  wait 2 sec
  emote %arg%
end
~
#38
Mob Receive and Assemble Example~
0 j 100
~
* Example by Aeon
wait 2 sec
* Check mob's inventory (this does not include equipped items)
if %self.inventory(16701)% && %self.inventory(16702)% && %self.inventory(16703)% && %self.inventory(16704)% && %self.inventory(16705)%
  * Removing items from the mob
  %purge% flour
  %purge% salt
  %purge% sugar
  %purge% soda
  %purge% egg
  * For roleplay sake
  say Thank you %actor.name%! Now here is the cake.
  * Give the reward
  %load% obj 16706
  give cake %actor.name%
end
~
#39
Mob Following Assist Master~
0 b 100
~
* By Rumble
if %self.master%
  eval master %self.master%
  if %master.fighting%
    say I will save you Master %master.name%
    wait 1 sec
    assist %master.name%
  end
end
~
#40
mfollow Example~
0 b 100
~
* By Welcor
set actor %random.char%
mfollow %actor%
say I follow you now %actor.name%
say self.master: %self.master%
say actor: %actor%
eval follower %self.master%
say follower: %follower%
say follower.name : %follower.name%
~
#41
Hunt Example~
0 o 100
~
* Mob must first have a memory trig, attach 74.
%echo% Sleeping for 10 secs, give %actor.name% a head start.
sleep
%echo% Targetting %actor.name%
wait 10 s
wake
stand
north
north
up
%echo% Hunting...%actor.name%
mhunt %actor%
eval mhunt_target %actor%
global mhunt_target
attach 202 %self.id%
~
#42
Container with Personal Key~
1 c 100
*~
* By Jamie Nelson from the forum http://groups.yahoo.com/group/dg_scripts/
* Container script for use with no key
if %actor.vnum% == -1
  return 0 
  halt
end
*
switch %cmd%
  case codeset
    if %actor.name% != test
      %send% %actor% I am sorry %actor.name%, only Rumble can set the code.
      halt
    end
    if !%arg%
      %send% %actor% You must supply a code.
      halt
    else
      eval isnum ((%arg%*2)/2)
      if %isnum%<=999
        %send% %actor% You must supply a code that is a number. (more then 1)
        %send% %actor% And for security reasons, greater then 4 digits.
        halt
      else
        oset 3 %isnum%
        %send% %actor% You set the code on %self.shortdesc% to %isnum%.
        set fingerprint %isnum%
        remote fingerprint %actor.id%
      end
    end
  break
  case recognise
    %send% %actor% A laser scans your fingerprint.
    if %arg%!=%self.val3%
      %send% %actor% Access Denied.
      halt
    else
      %send% %actor% Access Granted. Fingerprint Memorized.
      set fingerprint %self.val3%
      remote fingerprint %actor.id%
    end
  break
  case fingerprint
    if %arg%!=open
      if %arg!=close
        %send% %actor% You must type either: 
        %send% %actor% fingerprint open
        %send% %actor% or
        %send% %actor% fingerprint close
        halt
      else
        set oc 2
      end
    else
      set oc 1
    end
    %send% %actor% A laser scans your fingerprints.
    if !%actor.varexists(fingerprint)%
      %send% %actor% Access Denied.
      halt
    else
    %send% %actor% Access Granted.
    if %oc%==2
      oset 1 15
      %send% %actor% Closed and locked.
    elseif %oc%==1
      oset 1 0
      %send% %actor% Unlocked and open.
    else
      %send% Broken.
    end
  end
  break
  default
    return 0
  break
done
~
#43
Mob Wait Until Example~
0 ab 100
~
* By Aeon This script wakes the mob at dawn, and puts him to sleep at night.
wait until 06:00
wake
say It's morning already!
wait 1 s
yawn
wait 1 s
stand
wait until 21:00
emote looks sleepy.
yawn
wait 10 s
rest
wait 10 s
sleep
~
#44
Mob Death Purges Equipment~
0 f 100
~
remove all
eval i %self.inventory%
while (%i%)
  set next %i.next_in_list%
  %purge% %i%
  set i %next% 
done
~
#45
Rumble's Shotgun~
1 b 100
~
* By Rumble
* if the object is being wielded
if %self.worn_by%
* a random trigger so actor has to be defined
eval actor %self.worn_by%
  * if the person wielding the object is fighting
  if %actor.fighting%
    * evaluate uniquely to this player
    context %actor.id%
    * count the shots
    eval shotgun_rounds %shotgun_rounds% + 1
    * remember the count for the next time this trig fires
    global shotgun_rounds
    * double barrel shotgun, only has 2 rounds
    if %shotgun_rounds% > 2
      * detaching trig since gun is out of ammo.
      detach 1361 %self.id%
      halt
    end  
    * have to define the victim
    eval victim %actor.fighting%
    * send the message and do the damage
    %echoaround% %actor.name% %actor.name% points %self.shortdesc% at %victim.name% and pulls the trigger.
    %send% %actor% You point %self.shortdesc% at %victim.name% and pull the trigger.
    %damage% %victim% 10
  end
end
~
#46
Parrot Array Example~
0 d 100
*~
* By Meyekul
*** Squak for the nice people, Polly
wait 1s
emote squawks loudly.
wait 1s
*** 75% chance of learning phrase
eval polly %random.4%
if (%polly% > 1)
  say %speech%
  %echo% %speech%
  %echo% %phrase(1)%
  %echo% %phrase(2)%
  %echo% %phrase(3)%
  *** Ignore if already known
  switch %speech%
    case test
    case test 2
    case %phrase(3)%
    case %phrase(4)%
    case %phrase(5)%
    case %phrase(6)%
    case %phrase(7)%
    case %phrase(8)%
    case %phrase(9)%
    case %phrase(10)%
      emote looks at you curiously.
    break
    default
    break
  done
  *** Learn new phrases
  eval number (%number% + 1)
  eval phrase(%number%) %speech%
  global number
  global phrase(%number%)
  *** Reset array after 10 phrases
  if (%number% == 10)
    eval number 0
    global number
    eval maxphrases 1
    global maxphrases
  end
end
~
#47
Mob Greet Steal~
0 g 100
~
* By Rumble
eval item %actor.inventory%
eval item_to_purge %%actor.inventory(%item.vnum%)%%
if %item_to_purge%
  %echo% purging %item.shortdesc% with vnum %item.vnum% in %actor.name%'s inventory.
  %purge% %item_to_purge% 
else
%echo% I cant find %item.shortdesc% with vnum %item.vnum% in %actor.name%'s inventory.
  %echo% I cant find an item in %actor.name%'s inventory.
end
~
#48
Object Command Assemble~
1 c 100
join~
* By Rumble
eval currentroom %self.room% 
if %currentroom.vnum% == 1233 && %actor.inventory(1315)% && %actor.inventory(1316)%
  %echo% room check correct: %currentroom.vnum%
  %purge% %actor.inventory(1316)%
  %echo% orb purged
  switch %random.2%
    case 1
      %transform% 12
      %echo% staff loaded
    break
    default
      %transform% 1317
      %echo% broken staff loaded
    break
  done
  detach 1389 %self.id%
else
  %send% %actor% You can not do that here.
end
~
#49
Magic Eight Ball~
1 c 2
shake~
* By Rumble
* Numeric Arg: 2 means in character's carried inventory
* does not work for level 32 and above.
* There are 20 possible answers that the Magic Eight Ball can give. 
* Of these, nine are full positive, two are full negative, one is 
* mostly positive, three are mostly negative, and five are abstentions. 
*
if %arg% /= ball || %arg% /= eightball
  %echoaround% %actor.name% %actor.name% shakes the magic eight ball vigorously.
  %send% %actor% You shake the magic eight ball vigorously.
    switch %random.20%
      case 1
        %send% %actor% The magic eight ball reveals the answer: Outlook Good 
      break
      case 2
        %send% %actor% The magic eight ball reveals the answer: Outlook Not So Good 
      break
      case 3
        %send% %actor% The magic eight ball reveals the answer: My Reply Is No
      break
      case 4
        %send% %actor% The magic eight ball reveals the answer: Don't Count On It
      break
      case 5
        %send% %actor% The magic eight ball reveals the answer: You May Rely On It
      break
      case 6
        %send% %actor% The magic eight ball reveals the answer: Ask Again Later
      break
      case 7
        %send% %actor% The magic eight ball reveals the answer: Most Likely 
      break
      case 8
        %send% %actor% The magic eight ball reveals the answer: Cannot Predict Now
      break
      case 9
        %send% %actor% The magic eight ball reveals the answer: Yes 
      break
      case 10
        %send% %actor% The magic eight ball reveals the answer: Yes Definately
      break
      case 11
        %send% %actor% The magic eight ball reveals the answer: Better Not Tell You Now 
      break
      case 12
        %send% %actor% The magic eight ball reveals the answer: It Is Certain
      break
      case 13
        %send% %actor% The magic eight ball reveals the answer: Very Doubtful
      break
      case 14
        %send% %actor% The magic eight ball reveals the answer: It Is Decidedly So
      break
      case 15
        %send% %actor% The magic eight ball reveals the answer: Concentrate And Ask Again
      break
      case 16
        %send% %actor% The magic eight ball reveals the answer: Signs Point To Yes 
      break
      case 17
        %send% %actor% The magic eight ball reveals the answer: My Sources Say No 
      break
      case 18
        %send% %actor% The magic eight ball reveals the answer: Without A Doubt 
      break
      case 19
        %send% %actor% The magic eight ball reveals the answer: Reply Hazy, Try Again
      break
      case 20
        %send% %actor% The magic eight ball reveals the answer: As I See It, Yes
      break
      default
        %send% %actor% The magic eight ball explodes since your question is unanswerable.
      break
    done
else
%send% %actor% shake What?
end
~
#50
Room Global Random Example~
2 ab 100
~
* Fires whether a player is in the room or not.
switch %random.4%
  case 1
    %echo% A shrill cry from a distant bird pierces the air.
  break
  case 2
    %echo% The town bell rings in the distance.
  break
  case 3
    %echo% A flock of doves circles overhead.
  break
  default
    %echo% Voices can be heard arguing in the distance.
  break
done
~
#51
Room Random Example~
2 b 100
~
* Fires only when a player is in the room.
* Actor is not defined with random, so lets define it.
set actor %random.char%
%damage% %actor% -100
%echo% A healing breeze flows through the room.
* Example by Snowlock
* %echo% The pungent fumes burn your lungs!
* set target_char %self.people%
* while %target_char%
*   set tmp_target %target_char.next_in_room%
*   %damage% %target_char% 3
*   set target_char %tmp_target%
* done
~
#52
Room Command Example~
2 c 100
l~
* does not work for level 32 and above.
* Make sure the command is look, check for any abbrev of test
if %cmd.mudcommand% == look && test /= %arg%
  %echo% The trigger works!
  %force% %actor% applaud
else
  * If it doesn't match let the command continue.
  return 0
end
* Portal example with arguments: e
* if %cmd.mudcommand% == enter && portal /= %arg%
*   %send %actor% You enter the portal.
*   %echoaround %actor.name% %actor.name% bravely steps into the portal.
*   %teleport% %actor% 3001
*   %force% %actor% look
*   %echoaround% %actor% %actor.name% steps through a portal.
* else
*   return 0
* end
**
** Another example, argument: p
** if %cmd.mudcommand% == pick && mushroom /= %arg%
**   %load% obj 1300
**   %force% %actor% say it works
** else
**   return 0
** end
~
#53
Room Speech Example~
2 d 1
*~
* evaluate the first word
eval word %speech.car%
* evaluate the rest of the speech string
eval rest %speech.cdr%
* while there is a first word keep going
while %word%
  %echo% the first word is: %word%
  %echo% the remaining text is: %rest%
  eval word %rest.car%
  eval rest %rest.cdr%
done
~
#54
Room Global Zone Reset Example~
2 af 100
~
%door% 23667 east purge 0
%echo% As if by magic all the tapestries rise to their previous positions.
~
#55
Room Enter Example~
2 g 100
~
if %actor.sex% == female
  wait 1 sec
  %echo% Ladies are always welcome!
else
  %send% %actor% No men allowed.
  return 0
end
~
#56
Room Drop Example~
2 h 100
~
%echo% %actor.name% tries to drop object type: %object.type%
if %object.type% == TRA
  %echo% No Littering!
  return 0
end
~
#57
Room Cast Example~
2 p 100
~
%echo% %actor.name% tried to cast spellnumber: %spell%: %spellname% on %vict.name% %obj.name%.
return 0
~
#58
Room Leave Example~
2 q 100
~
%echo% %actor.name% tries to leave to the %direction%.
return 0
~
#59
Room Door Example~
2 r 100
~
if %cmd% == open
  %echoaround% %actor% As %actor.name% tries to %cmd% the door to the %direction% a bucket of water dumps on %actor.hisher% head.
  %send% %actor% Splash!!
  %send% %actor% A bucket of water drops on top of your head as you open the door.
  %damage% %actor% 10
  %echo% The door slams shut again.
  detach 1459 %self.id%
  return 0
end
~
#60
Mob Global Random Example~
0 ab 100
~
* Fires whether a player is in the room or not.
switch %random.4%
  case 1
    emote whistles an annoying tune.
  break
  case 2
    emote stares at you with interest.
  break
  case 3
    emote ponders your existence.
  break
  default
    emote starts to sing a piercing melody about a lost love
  break
done
~
#61
Mob Random Example~
0 b 100
~
* This is required because a random trig does not have an actor.
set actor %random.char%
wait 1 sec
say Hey!  You don't belong here!
emote mumbles, 'Now what was that spell...'
wait 1 sec
switch %random.3%
  case 1
    dg_cast 'harm' %actor%
  break
  case 2
    dg_cast 'magic missle' %actor%
  break
  default
    say That wasn't right...
    %echo% A failed spell backfires on the mage!
    %damage% %self% 10
  break
done
~
#62
Mob Command Example~
0 c 100
l~
* does not work for level 32 and above.
* Make sure the command is look, check for any abbrev of window
* and make sure there is an arg.
if %cmd.mudcommand% == look && %arg% /= window
  %echo% %actor.name% tried to %cmd% at the %arg%.
  return 0
else
  * If it doesn't match let the command continue.
  return 0
end
~
#63
Mob Speech and Expressions Example~
0 d 1
*~
* Check if the actor is male OR female.
if %actor.sex% == male || %actor.sex% == female
  say you are a male or female.
else
  say you are not a male or female.
end
*
* Check if it is a player AND make sure player level
* is less than 10 (9 and lower).
if %actor.vnum% == -1 && %actor.level% < 10
  say you are a player below level 10.
else
  say you are either not a player or not below level 10.
end
*
* Check class not equal to.
if %actor.class% != warrior
  say you are not a warrior.
else
  say you are a warrior.
end
*
* Check alignment between 350 and -350 (neutral).
if %actor.align%  350 && %  -350
  say you are neutral.
else
  say you are not neutral.
end
*
* Check strength greater than or equal to 16, less than or equal to 18. (16-18)
* If this was done without the equalities (=) it would check str 17 only.
if %actor.str% >= 16 && %actor.str% <= 18
  say your strength is 16-18.
else
  say your strength is not 16-18.
end
*
* Check the speech to see if it is a substring of concatenated.
if concatenated /= %speech%
  say your speech was a substring of concatenated.
else
  say your speech was not a substring of concatenated.
end
*
* Create a random number 1-10 and assign it to rnumber.
eval rnumber %random.10%
say your random number is: %rnumber%
* increment it by 1.
eval rnumber %rnumber% + 1
say your incremented random number is: %rnumber%
~
#64
Mob Action Example~
0 e 0
kisses you.~
wait 1 sec
slap %actor.name%
say I'm not that kind of girl.
pout
eval inroom %self.room%
%zoneecho% %inroom.vnum% %self.name% shouts, '%actor.name% kisses like a fish.
~
#65
Mob Death Example~
0 f 50
~
%echo% %self.name% curses %actor.name% before drawing %self.hisher% final breath.
~
#66
Mob Greet Example~
0 g 100
~
* To make a trigger fire only on players use:
if %actor.vnum% == -1
   say Hello, and welcome, %actor.name%
end
* Check what direction they came from.
if %direction%
  say Hello, %actor.name%, how are things to the %direction%?
else
* If the character popped in (word of recall, etc) this will be hit
  say Where did YOU come from, %actor.name%?
end
if %direction% == down
  say Ah, hello %actor.name% I have been waiting for you. Go learn to build.
  %teleport% %actor% 1300
  %force% %actor% look
end
~
#67
Mob Greet-All Example~
0 h 100
~
say Hello, and welcome, %actor.name%
~
#68
Mob Entry Example~
0 i 100
~
* first find the room the mob is in and put the value in %inroom%
eval inroom %self.room%
* then check on the rooms vnum
if %inroom.vnum% == 1233
  say I, %self.name%, declare this room Rumble's.
end
~
#69
Mob Receive Example~
0 j 100
~
if %object.vnum% == 1300
  %purge% %object%
  say thanks!
  nop %actor.gold(1)%
else
  say I don't want that!
  return 0
end
~
#70
Mob Fight Example~
0 k 100
~
context %self.id%
if (%already_fighting%)
  wait 10
  unset already_fighting
else
  dg_cast 'magic missile' %actor.name%
  set already_fighting 1
  global already_fighting
end
~
#71
Mob Hitprcnt Example~
0 l 50
~
context %self.id%
if (%have_shouted%)
  return 0
  halt
else
  %echo% %self.name% shouts 'HELP! I'm under ATTACK! HELP!'
  set have_shouted 1
  global have_shouted
end
~
#72
Mob Bribe Example~
0 m 1
~
say thank you, step inside.
wait 2 sec
%echoaround% %actor% %self.name% pushes %actor.name% through a concealed door.
%send% %actor% %self.name% helps you through a concealed door.
%teleport% %actor% 1300
~
#73
Mob Load Example~
0 n 100
~
   switch %random.5%
  case 1
    %load% obj 3010
    wield dagger
    break
  case 2
    %load% obj 3011
    wield sword
    break
  case 3
    %load% obj 3012
    wield club
    break
  case 4
    %load% obj 3013
    wield mace
    break
  case 5
    %load% obj 3014
    wield sword
    break
  default
    * this should be here, even if it's never reached
    break
done
~
#74
Mob Memory Example Part 1~
0 g 100
~
* This must be set by another trigger first before the mem trigger can be used.
mremember %actor.name%
say I'll remember you now, %actor.name%
~
#75
Mob Memory Example Part 2~
0 o 100
~
wait 4 s
poke %actor.name%
say i've seen you before, %actor.name%.
mforget %actor.name%
~
#76
Mob Cast Example~
0 p 100
~
if (%spellname%==magic missile)
  %echo% %self.name% is protected by a shield spell negating %actor.name%s Magic Missile.
  return 0
else
  %echo% %self.name%s shield spell doesn't protect %self.himher% from %actor.name%s magic.
  return 1
end
~
#77
Mob Leave Example~
0 q 100
~
if %actor.level% > 10
  say You may not leave here, %actor.name%.
  %send% %actor% %self.name% prevents you from leaving the room.
  %echoaround% %actor% As %actor.name% tries to leave the room, %self.name% stops %actor.himher%.
  return 0
end
~
#78
Mob Door Example~
0 r 100
~
say %actor.name% do not try to %cmd% the door to the %direction% again. Or else!
return 0
~
#79
Obj Global Random Example~
1 ab 100
~
* Fires whether a player is in the room or not.
switch %random.4%
  case 1
    %echo% %self.name% seems to glow a strange green.
  break
  case 2
    %echo% A strange feeling comes over you.
  break
  case 3
    %echo% A pulsating beat can be felt in the air.
  break
  default
    %echo% A strange liquid flows gently out of %self.name%
  break
done
~
#80
Obj Random Example~
1 b 100
~
%echo% The trigger fires now!
eval actor %self.worn_by%
if !%actor%
  halt
end
%send% %actor% Ichiban's blade thirsts for blood.
~
#81
Obj Command Example~
1 c 7
open~
* Numeric Arg: 7 means obj can be worn, carried, or in room.
* does not work for level 32 and above.
* Make sure the command is open, check for any abbrev of closet
* and make sure there is an arg.
if %cmd.mudcommand% == open && closet /= %arg%
  %send% %actor% As you open the closet something runs out.
  %echoaround% %actor% %actor.name% opens a closet and something comes out.
  %load% mob 1
else
* If it doesn't match let the command continue.
  return 0
end
* An example for sitting in a chair. Arg: s
* if %cmd.mudcommand% == sit && chair /= %arg%
*   %echoaround% %actor% %actor.name% sits in a chair.
*   %send% %actor% You sit in a chair.
* else
*   return 0
* end
~
#82
Obj Timer Example~
1 f 100
~
* %echo% The trigger fires now!
* otimer 3
%echo% The ice cream melts away.
%purge% %self%
~
#83
Obj Get Example~
1 g 100
~
if (%actor.level% < 31)
  %transform% 1398
  return 0
else
  %echo% You hear, 'Please put me down, %actor.name%'
end
~
#84
Obj Drop Example~
1 h 100
~
if %actor.level% < 31
  %send% %actor% You fail to drop %self.shortdesc%.
  return 0
else
  %send% %actor% %self.shortdesc% glows a bright yellow, then explodes.
  %purge% %self%
end
~
#85
Obj Give Example~
1 0 100
~
if %actor.level% < 31
  %send% %actor% You can't give %victim.himher% that.
  %send% %victim% %actor.name% tries to give you %self.shortdesc%, but fails.
  return 0
else
  %echo% %actor.name% is allowed to give %victim.name% %self.shortdesc%.
end
~
#86
Obj Wear Example~
1 j 100
~
if (%actor.str% < 17)
  return 0
end
%send% %actor% send to actor.
%echoaround% %actor% %actor.name% echoaround actor
%damage% %actor% 100
~
#87
Obj Remove Example~
1 l 90
~
return 0
~
#88
Obj Load Example~
1 n 100
~
%echo% %self.name% appears out of nowhere.
~
#89
Obj Leave Example~
1 q 100
~
if %actor.vnum% == -1
  if %random.100% + %actor.dex% > 50
    %send% %actor% You slip on %self.shortdesc% and fall.
    %echoaround% %actor% %actor.name% slips on %self.shortdesc% and falls.
    return 0
    %force% %actor% sit
  else
    %send% %actor% You slip on %self.shortdesc%, but manage to retain your balance.
    %echoaround% %actor% %actor.name% slips on %self.shortdesc%, but manages to retain %actor.hisher% balance.
  end
end
~
#90
Obj Cast Example~
1 p 100
~
%echo% %actor.name% cast spell number: %spell%: %spellname% on %self.shortdesc%
~
#91
Special Characters Example~
1 b 100
~
* Special Characters Example by Rumble - how to automatically substitute possessive pronouns.
eval obj %self.name%
eval obj %obj.car%
%echo% VNUM:                    %self.vnum%
%echo% FIRST KEYWORD:           %obj%
%echo% NAME'S, SOMEONE'S, YOUR: |%obj%
%echo% NAME, SOMEONE, YOU:      %obj%
%echo% IT, YOU, HE/SHE:         &%obj%
%echo% IT, YOU, HIM/HER:        *%obj%
* object only
%echo% SOMETHING, NAME          '%obj%
~
#92
Room Command Combination Lock~
2 c 100
push~
*
* combinationlock, based on script by Rumble
* small modifications made by Welcor
*
* To allow multiple scripts based on this script we set a context:
  context %self.id%
* clear old var, if set.
  unset reset_buttons
* check argument
  if %arg% == red
    %send% %actor% You push the red button.
    set pushed_red 1
    global pushed_red
  elseif %arg% == yellow
    %send% %actor% You push the yellow button.
    if %pushed_red%
      set pushed_yellow 1
      global pushed_yellow
    else 
      set reset_buttons 1
    end
  elseif %arg% == green
    %send% %actor% You push the green button.
    if %pushed_red% && %pushed_yellow%
      set pushed_green 1
      global pushed_green
    else
      set reset_buttons 1
    end
  elseif %arg% == blue
    %send% %actor% You push the blue button.
    if %pushed_red% && %pushed_yellow% && %pushed_green%
      set pushed_blue 1
      global pushed_blue
    else
      set reset_buttons 1
    end
  elseif %arg% == purple
    %send% %actor% You push the purple button.
    if %pushed_red% && %pushed_yellow% && %pushed_green% && %pushed_blue%
      %send% %actor% You hear a loud click as you push the final button.
      set reset_buttons 1
    else
      set reset_buttons 1
      end
  elseif %arg% == white
    %send% %actor% You push the white reset button.
    set reset_buttons 1
  else
    %send% %actor% Push what ?!
    halt
  end
* reset the buttons if necessary
  if %reset_buttons%
    unset reset_buttons
    unset pushed_red
    unset pushed_yellow
    unset pushed_green
    unset pushed_blue
    %send% %actor% The buttons all suddenly pop back out.
  end
* send the state of the buttons
  %send% %actor% red:%pushed_red% yellow:%pushed_yellow% green:%pushed_green% blue:%pushed_blue% purple:%pushed_purple%
~
#93
if/elseif/else Example~
2 g 100
~
if %actor.vnum% == -1
  wait 1 sec
  if %actor.sex% == male
    %echo% male
  elseif %actor.sex% == female
    %echo% elseif female
  else
    %echo% else nuetral
  end
else
  %echo% mob
end
~
#94
Kind Soul 13 - Give Newbie Equipment~
0 g 100
~
*/ra 'generic' '%self.inventory.name%' next patch level release
* remove comments below to allow equipping naked char next pl.
* By Rumble
if %actor.vnum% == -1  
  *  if !%actor.eq(*)%
  *    say get some clothes on! Here, I will help.
  *    %load% obj 200 %actor% light
  *    %load% obj 201 %actor% rfinger
  *    %load% obj 202 %actor% lfinger
  *    %load% obj 203 %actor% neck1
  *    %load% obj 204 %actor% neck2
  *    %load% obj 205 %actor% body
  *    %load% obj 206 %actor% head
  *    %load% obj 207 %actor% legs
  *    %load% obj 208 %actor% feet
  *    %load% obj 209 %actor% hands
  *    %load% obj 210 %actor% arms
  *    %load% obj 211 %actor% shield
  *    %load% obj 212 %actor% about
  *    %load% obj 213 %actor% waist
  *    %load% obj 214 %actor% rwrist
  *    %load% obj 215 %actor% lwrist
  *    %load% obj 216 %actor% wield
  *    %load% obj 217 %actor% hold
  *    halt
  *  end
  wait 2 sec
  if !%actor.eq(light)%
    Say you really shouldn't be wondering these parts without a light source %actor.name%.
    shake
    %load% obj 200
    give generic %actor.name%
    halt
  end
  if !%actor.eq(rfinger)% || !%actor.eq(lfinger)%
    Say did you lose one of your rings?
    sigh
    %load% obj 201
    give generic %actor.name%
    halt
  end
  if !%actor.eq(neck1)% || !%actor.eq(neck2)%
    Say you lose everything don't you?
    roll
    %load% obj 203
    give generic %actor.name%
    halt
  end
  if !%actor.eq(body)%
    say you won't get far without some body armor %actor.name%.
    %load% obj 205
    give generic %actor.name%
    halt
  end
  if !%actor.eq(head)%
    Say protect that noggin of yours, %actor.name%.
    %load% obj 206
    give generic %actor.name%
    halt
  end
  if !%actor.eq(legs)%
    Say why do you always lose your pants %actor.name%?
    %load% obj 207
    give generic %actor.name%
    halt
  end
  if !%actor.eq(feet)%
    Say you can't go around barefoot %actor.name%.
    %load% obj 208
    give generic %actor.name%
    halt
  end
  if !%actor.eq(hands)%
    Say need some gloves %actor.name%?
    %load% obj 209
    give generic %actor.name%
    halt
  end
  if !%actor.eq(arms)%
    Say you must be freezing %actor.name%.
    %load% obj 210
    give generic %actor.name%
    halt
  end
  if !%actor.eq(shield)%
    Say you need one of these to protect yourself %actor.name%.
    %load% obj 211
    give generic %actor.name%
    halt
  end
  if !%actor.eq(about)%
    Say you are going to catch a cold %actor.name%.
    %load% obj 212
    give generic %actor.name%
    halt
  end
  if !%actor.eq(waist)%
    Say better use this to hold your pants up %actor.name%.
    %load% obj 213
    give generic %actor.name%
    halt
  end
  if !%actor.eq(rwrist)% || !%actor.eq(lwrist)%
    Say misplace something?
    smile
    %load% obj 215
    give generic %actor.name%
    halt
  end
  if !%actor.eq(wield)%
    Say without a weapon you will be Fido food %actor.name%.
    %load% obj 216
    give generic %actor.name%
    halt
  end
  if !%actor.eq(hold)%
    Say this might help you %actor.name%.
    %load% obj 217
    give generic %actor.name%
    halt
  end
end
~
#95
Dog 9 - Eating its own stool~
0 g 100
~
if %actor.vnum% == -1  
  wait 2 sec
  %echo% %self.name% sniffs a pile of steaming stool.
  wait 2 sec
  take stool
  wait 2 sec
  %echo% %self.name% devours the steaming pile of stool.
  wait 3 sec
  %echo% %self.name% walks around in a circle, stops, then squats.
  wait 2 sec
  drop stool
end
~
#96
Obj Command 81 - Paintball Shoot Blue~
1 c 2
shoot~
* By Rumble w/help from Jamie Nelson on http://groups.yahoo.com/group/dg_scripts/
eval inroom %actor.room%
if (%arg.room% != %actor.room%) || (%arg.id% == %actor.id%)
  %send% %actor% Shoot: Invalid Target!
  halt
end
if %arg.inventory(80)%
  %echoaround% %actor.name% %actor.name% blasts %arg.name% with %actor.hisher% paintball gun.
  %send% %actor% You blast %arg.name%.
  %send% %arg% You lose!
  %purge% %arg.inventory(80)%
  %zoneecho% %inroom.vnum% %actor.name% shoots %arg.name%. A score for the Blue Team.
elseif %arg.inventory(81)%
  %send% %actor% They are on your team!
elseif
  %send% %actor% %arg.name% is not playing.
end
~
#97
Obj Command 80 - Paintball Shoot Red~
1 c 2
shoot~
* By Rumble w/help from Jamie Nelson on http://groups.yahoo.com/group/dg_scripts/
eval inroom %actor.room%
if (%arg.room% != %actor.room%) || (%arg.id% == %actor.id%)
  %send% %actor% Shoot: Invalid Target!
  halt
end
if %arg.inventory(81)%
  %echoaround% %actor.name% %actor.name% blasts %arg.name% with %actor.hisher% paintball gun.
  %send% %actor% You blast %arg.name%.
  %send% %arg% You lose!
  %purge% %arg.inventory(81)%
  %zoneecho% %inroom.vnum% %actor.name% shoots %arg.name%. A score for the Red Team.
elseif %arg.inventory(80)%
  %send% %actor% They are on your team!
elseif
  %send% %actor% %arg.name% is not playing.
end
~
#98
Mob Act - 98 Teleporter Give~
0 e 0
has entered the game.~
* By Rumble
if %actor.vnum% == -1  
  *if !%actor.eq(*)%
  *    %load% obj 200 %actor% light
  *    %load% obj 201 %actor% rfinger
  *    %load% obj 202 %actor% lfinger
  *    %load% obj 203 %actor% neck1
  *    %load% obj 204 %actor% neck2
  *    %load% obj 205 %actor% body
  *    %load% obj 206 %actor% head
  *    %load% obj 207 %actor% legs
  *    %load% obj 208 %actor% feet
  *    %load% obj 209 %actor% hands
  *    %load% obj 210 %actor% arms
  *    %load% obj 211 %actor% shield
  *    %load% obj 212 %actor% about
  *    %load% obj 213 %actor% waist
  *    %load% obj 214 %actor% rwrist
  *    %load% obj 215 %actor% lwrist
  *    %load% obj 216 %actor% wield
  *    %load% obj 217 %actor% hold
  *end
  wait 2 sec
  if !(%actor.inventory(82)%)
    wait 1 s
    say You are not prepared to travel these realms to their fullest.
    wait 1 s
    say Maybe I can help you.
    %load% obj 82
    give teleporter %actor.name%
    *could actor carry the weight?
    if !%actor.inventory(82)%
      drop teleporter
    end
    wait 2 s
    say With this you may teleport to areas that may not be accessible in any other way.
    wait 2 s
    say HELP AREAS
  end
~
#99
Obj Command 82 - Teleporter~
1 c 3
teleport~
* By Rumble w/help from Jamie Nelson on http://groups.yahoo.com/group/dg_scripts/
%send% %actor% You attempt to manipulate space and time.
%echoaround% %actor% %actor.name% attempts to manipulate space and time.
wait 1 sec
set Sanctus 100
set jade 400
set newbie 500
set sea 600
set camelot 775
set nuclear 1800
set spider 1999
set arena 2000
set tower 2200
set memlin 2798
set mudschool 2800
set midgaard 3001
set capital 3702
set haven 3998
set chasm 4200
set arctic 4396
set Orc 4401
set monastery 4512
set ant 4600
set zodiac 5701
set grave 7401
set zamba 7500
set gidean 7801
set glumgold 8301
set duke 8660
set oasis 9000
set domiae 9603
set northern 10004
set south 10101
set dbz 10301
set orchan 10401
set elcardo 10604
set iuel 10701
set omega 11501
set hannah 12500
set wyvern 14000
set caves 16999
set cardinal 17501
set circus 18700
set western 20001
set terringham 23200
set dragon 23300
set school 23400
set mines 23500
set aldin 23601
set crystal 23875
set pass 23901
set maura 24000
set enterprise 24100
set new 24200
set valley 24300
set prison 24457
set nether 24500
set yard 24700
set elven 24801
set jedi 24901
set dragonspyre 25000
set ape 25100
set vampyre 25200
set windmill 25300
set village 25400
set shipwreck 25516
set keep 25645
set jareth 25705
set light 25800
set mansion 25907
set grasslands 26000
set igor's 26100
set forest 26201
set farmlands 26300
set banshide 26400
set beach 26500
set ankou 26600
set vice 26728
set desert 26900
set wasteland 27001
set sundhaven 27119
set station 27300
set smurfville 27400
set sparta 27501
set shire 27700
set oceania 27800
set notre 27900
set motherboard 28000
set khanjar 28100
set kerjim 28200
set haunted 28300
set ghenna 28400
set hell 28601
set goblin 28700
set galaxy 28801
set werith's 28900
set lizard 29000
set black 29100
set kerofk 29202
set trade 29400
set jungle 29500
set froboz 29600
set desire 29801
set cathedral 29900
set ancalador 30000
set campus 30100
set bull 30401
set chessboard 30537
set tree 30600
set castle 30700
set baron 30800
set westlawn 30900
set graye 31003
set teeth 31100
set leper 31200
set altar 31400
set mcgintey 31500
set wharf 31700
set dock 31800
set yllnthad 31900
set bay 32200
set pale 32300
set army 32400
set revelry 32500
set perimeter 32600
if !%arg%
  *they didnt type a location
  set fail 1
else
  *take the first word they type after the teleport command
  *compare it to a variable above
  eval loc %%%arg.car%%%
  if !%loc%
    *they typed an invalid location
    set fail 1
  end
end
if %fail%
  %send% %actor% You fail.
  %echoaround% %actor% %actor.name% fails.
  halt
end
%echoaround% %actor% %actor.name% seems successful as %actor.heshe% steps into another realm.
%teleport% %actor% %loc%
%force% %actor% look
%echoaround% %actor% %actor.name% steps out of space and time.
~
$~