[DGscripts] oasound & question

From: JonB (Jon@THEBARRETTS.COM)
Date: 06/22/98


As I was creating some scripts I wanted to make an object that would make a
sound in the surrounding rooms.  I noticed there was no command for it, so
I made one using masound as an example.  It has worked perfectly so far.
Here's the command if anyone wants it, please give the original dg coders
credit.

*** ./stk/dg_ogbcmd.cpp Fri Mar 13 14:43:54 1998
--- ./src/dg_ogbcmd.cpp Mon Jun 15 10:22:18 1998
*************** sh_int find_obj_target_room(obj_data *ob
*** 127,132 ****
--- 127,156 ----


  /* Object commands */
+ OCMD(do_oasound)
+ {
+     sh_int was_in_room;
+     int  door;
+
+     exter void act_to_room(char *str, room_data *room);
+
+     if (!*argument) {
+       obj_log(obj, "wasound called with no argument");
+       return;
+     }
+
+     skip_spaces(&argument);
+
+     was_in_room = obj_room(obj);
+
+     for (door = 0; door < NUM_OF_DIRS; door++) {
+       struct room_direction_data *exit;
+
+       if (((exit = world[was_in_room].dir_option[door]) != NULL) &&
+               (exit->to_room != NOWHERE) && (exit->to_room != was_in_room))
+           act_to_room(argument, &world[exit->to_room]);
+     }
+ }

  OCMD(do_oecho)
  {
*************** OCMD(do_odamage) {
*** 464,469 ****
--- 488,494 ----
  const struct obj_command_info obj_cmd_info[] = {
      { "RESERVED", 0, 0 },/* this must be first -- for specprocs */

+       { "oasound"    , do_oasound  , 0 },
      { "oecho"      , do_oecho    , 0 },
      { "oechoaround", do_osend    , SCMD_OECHOAROUND },

**** END SNIPPET ****

  I was also trying to make a room that would ask a specific char in the
room a question, and the player can answer it.  Now, I already have the
script working, but it only works when triggered by a player, ie: enter,
and speech triggers.  I would like it to be a random trigger, so the player
doesnt have to do anything to activate it.
  Is there a way to make a RANDOM trigger have a target, or choose a player
in the room if one is present?  If not, I was thinking of making a mob/room
command that would choose a player in the room and assign him/her to a
variable.  There are a couple of ways I have thought of doing this.

1: Mimic the random variable, I believe it would be used like this:
     eval player %target%
   where %target% would choose a playere in the room and assign it to player

2: use a new command as follows:
     mtarget player
   where the command would fill player with a target...

I have not looked into it to deeply yet.  I would still have to figure out
the variable code for DG, but are there any ideas/suggestioins?

Thanks

*>Jon<*


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST