( trapdoor.muf Revised 3-31-2001 Lynn A. Davis teph@tephras.com This program allows an exit to be set to deliver the user to an alternate destination a certain percentage of the time. To use this program link the exit to this program and set the following props on the exit: _trapdoor/chance: Set to the 1 in X number, ie set it to 20 for a 1 in 20 chance of tripping the trap. This must be a postive integer, 1 yields 100% chance of tripping the door. For the primary destination [the one more likely to be the destination of the exit] set the following on the exit: _trapdoor/pdest/dest: The dbref of destination room including the # sign. For example: @set =_trapdoor/pdest/dest:#1234 _trapdoor/pdest/succ: @success message. _trapdoor/pdest/osucc: @osuccess message. _trapdoor/pdest/odrop: @odrop message. The osuccess and odrop messages behave as normal omessages and will prefix the name of the person using the exit. For the secondary destination [the 'trap' room] set the same props replacing the 'pdest' with a 'sdest': @set =_trapdoor/sdest/dest:#1234 .... etc. BOTH destination rooms MUST be set _trapdoor_OK?:yes ALSO, set the source room and both destination rooms Jump_OK and do NOT set the @success, @osuccess, or @odrop messages on the exit. ) : not-exit-error me @ (get the #dbref of the player) "Trapdoor.muf must be linked to an exit. Please contact " trig owner truename strcat (add the name of the object's owner) " and report the error on object " strcat trig strcat (add the object #dbref) "(" trig name ")" (add the name for clarity) strcat strcat strcat (put that phrase together) " in room " strcat me @ location strcat (add the room #dbref) "(" me @ location ")." (add the name for clarity) strcat strcat strcat (put the error message all together) notify exit (tell the player the error, exit) ; : not-ok-trap-dest me @ (get the #dbref of the player) "Trapdoor.muf requires it's destination rooms be set " "_trapdoor_OK?:yes. Please contact " strcat trig owner truename strcat (add the name of the exit's owner) " and report the error on exit #" strcat trig intostr strcat (add the exit #dbref) " (" trig name ")" (add the name for clarity) strcat strcat strcat (put that phrase together) " in room #" strcat me @ location intostr strcat (add the room #dbref) " (" me @ location name "). " (add the name for clarity) strcat strcat strcat (put the phrase together) "Room " strcat trig (get the #dbref of the exit) "_trapdoor/sdest/dest" getprop (get the # of the room to fall into) strcat " owned by " strcat trig (get the #dbref of the exit) "_trapdoor/sdest/dest" getprop (get the # of the room to fall into) .atodbref (make that string a #dbref) owner truename strcat (get the owner's name) " is not set _trapdoor_OK?:yes." strcat notify exit (tell the player the error,exit) ; : not-ok-notrap-dest me @ (get the #dbref of the player) "Trapdoor.muf requires it's destination rooms be set " "_trapdoor_OK?:yes. Please contact " strcat trig owner truename strcat (add the name of the exit's owner) " and report the error on exit #" strcat trig intostr strcat (add the exit #dbref) " (" trig name ")" (add the name for clarity) strcat strcat strcat (put that phrase together) " in room #" strcat me @ location intostr strcat (add the room #dbref) " (" me @ location name "). " (add the name for clarity) strcat strcat strcat (put the phrase together) "Room " strcat trig (get the #dbref of the exit) "_trapdoor/pdest/dest" getprop (get the # of the safe room) strcat " owned by " strcat trig (get the #dbref of the exit) "_trapdoor/pdest/dest" getprop (get the # of the safe room) .atodbref (make that string a #dbref) owner truename strcat (get the owner's name) " is not set _trapdoor_OK?:yes." strcat notify exit (tell the player the error, exit) ; : trip-door trig (get the #dbref of the exit) "_trapdoor/sdest/succ" getprop (get the sdest @succ) me @ (get the #dbref of the player) swap (put the message on top) notify (show the player the pdest @succ) me @ (get the #dbref of the player) dup (make a copy) location (find out where they are) swap (move the player to the top) dup truename (make a copy and get their name) " " strcat (add a trailing space to their name) trig (get the #dbref of the exit) "_trapdoor/sdest/osucc" getprop (get the sdest @osucc) strcat (add the name to the message) me @ (get the #dbref of the player) swap pronoun_sub (convert the pronouns) notify_except (display the sdest @osucc) me @ (get the #dbref of the player) trig (get the #dbref of the exit) "_trapdoor/sdest/dest" getprop (get the # of the room to fall into) .atodbref (convert the string to #dbref) moveto (move the player) trig (get the #dbref of the exit) "_trapdoor/sdest/dest" getprop (get the # of the sdest room) .atodbref (convert the string to #dbref) me @ (get the #dbref of the player) dup truename (make a copy and get their name) " " strcat (add a trailing space to their name) trig (get the #dbref of the exit) "_trapdoor/sdest/odrop" getprop (get the sdest @odrop) strcat (add the name to the message) me @ (get the #dbref of the player) swap pronoun_sub (convert the pronouns) notify_except (display the sdest @odrop) ; : no-trip-door trig (get the #dbref of the exit) "_trapdoor/pdest/succ" getprop (get the normal @succ) me @ (get the #dbref of the player) swap (put the message on top) notify (show the player the normal @succ) me @ (get the #dbref of the player) dup (make a copy) location (find out where they are) swap (move the player to the top) dup truename (make a copy and get their name) " " strcat (add a trailing space to their name) trig (get the #dbref of the exit) "_trapdoor/pdest/osucc" getprop (get the normal @osucc) strcat (add the name to the message) me @ (get the #dbref of the player) swap pronoun_sub (convert the pronouns) notify_except (display the normal @osucc) me @ (get the #dbref of the player) trig (get the #dbref of the exit) "_trapdoor/pdest/dest" getprop (get the # of the safe room) .atodbref (convert the string to #dbref) moveto (move the person) trig (get the #dbref of the exit) "_trapdoor/pdest/dest" getprop (get the # of the safe room) .atodbref (convert the string to #dbref) me @ (get the #dbref of the player) dup truename (make a copy and get their name) " " strcat (add a trailing space to their name) trig (get the #dbref of the exit) "_trapdoor/pdest/odrop" getprop (get the normal @odrop) strcat (add the name to the message) me @ (get the #dbref of the player) swap pronoun_sub (convert the pronouns) notify_except (display the normal @odrop) ; : test-trip random (get a random number) trig (get the #dbref of the exit) "_trapdoor/chance" getprop (get the value of the chance prop) atoi (convert string->integer) % (reduce the random to the chance range) 1 + (convert to a number from 1 to 'chance') 1 = if (check if the number is 1) trip-door exit then (if it is, trip the sdest and exit) no-trip-door (else, let the player through) ; : test-config (test the setup for the program) trig exit? (is an exit running this program?) not if (if no) not-exit-error exit (display the error message) then (if yes continue) trig (get the #dbref of the exit) "_trapdoor/sdest/dest" getprop (get the # of the room to fall into) .atodbref (make that string a #dbref) "_trapdoor_OK?" getprop (get the permission prop) dup not if (is there such a prop?) not-ok-trap-dest exit then (no prop, display error message) "yes" stringcmp (is the string 'yes'?) (stringcmp returns 0 for true but if thinks zero is false so...) if (so the 'true' case is no permission) not-ok-trap-dest exit (display invalid sdest destination error) then (check the other destination room) trig (get the #dbref of the exit) "_trapdoor/pdest/dest" getprop (get the # of the safe room) .atodbref (make that string a #dbref) "_trapdoor_OK?" getprop (get the permission prop) dup not if (is there such a prop?) not-ok-notrap-dest exit then (no prop, display error message) "yes" stringcmp (is the string 'yes'?) (stringcmp returns 0 for true but if thinks zero is false so...) if (so the 'true' case is no permission) not-ok-notrap-dest exit (display invalid pdest destination error) then test-trip (run the program proper) ;