Re: DGScripts and Attach

From: Thomas Arp (t_arp@mail1.stofanet.dk)
Date: 05/24/00


> attach 1201 %self.id%
> SCRIPT ERR: Trigger: Trigger Command Test, VNum 1203. attach invalid id
> arg: 'attach 1201 1104'
>
> Funny enough, the room I try to attach something to is 1104, so I guess
> that is correct..
Actually I only checked it with mobs - they have no problems like the ones you're mentioning.
> If I read the above SCRIPTERR correct, it tries to attach the trigger 1201
> to the ID 1104. Which according to the ID list (I made a function to list
> ID's some time back, since I needed to know what was what.. :) is Room
> 1104 (interessting enough).
this is the bug - I know I'm repeating myself :) - the actual id number is supposed to be the rooms real number (room_rnum) plus an arbitrary number (ROOM_ID_BASE) -not just the room vnum. So, since the rnum is ever changing (isn't it? - don't you build?), I added this code in dg_scripts.c - just above the 'unknown room field' part. Remove the old way of calculting %room.id% - it's obviously buggy. Here's the snip:
          if (r->people)
            sprintf(str,"%c%ld",UID_CHAR,GET_ID(r->people));
          else *str = '\0';
+      } else if (!str_cmp(field, "id")) {
+          for (count = 0;count <= top_of_world;count++)
+            if (world[count].number==r->number)
+              room_id=count;
+          if (room_id)
+            sprintf(str, "%ld", room_id + ROOM_ID_BASE );
+          else
+            *str='\0';
      } else {
 *str = '\0';
 sprintf(buf2,
  "Trigger: %s, VNum %d, type: %d. unknown room field: '%s'",
  GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), type, field);
 script_log(buf2);
      }

Because in the rest of the code, ROOM_ID_BASE is subtracted from a UID, before the room is found, thus making 1104 too low (1104-ROOM_ID_BASE = -48896), so attach can't find the room, giving an error.

Sorry about the terrible indentation - my mailer does these things to everything I put inhere.

Welcor


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



This archive was generated by hypermail 2b30 : 04/10/01 PDT