Re: object timers

From: Lubos Lunak (l.lunak@SH.CVUT.CZ)
Date: 05/08/98


Travis M. Fuller wrote:

> If this has been addressed before, I apologize. It seems that the timer
> value in oedit doesnt save to disk for objects. I had put in the portal
> code from the snippett site and configured my olc so I could create
> permanent portals online. Im using olc 1.6a btw.  The problem is
> permanent portals need a timer value of -1. This works perfectly when
> you create it but the timer value never actually saves to disk.
> Therefore, the next reboot, the timer value defaults to 0, making the
> portal last 1 tic. I put in an extra instance so it will save and read
> the timer value if there is one. My question is how do I make the code
> diferentiate between a normal object entry and one with the extra bit to
> save timer value? As it is now, I believe it will expect to see a 4th
> bit where the timer value would go. If there isnt one, what will happen?
>
> The portal object would look like this:
>
> #444
> portal mestari~
> a portal~
> A glowing portal to Mestari is here.~
> ~
> 24 0 0 -1       <---------- The negative 1 is the extra bit to identify
> the timer value
> -1 834 0 0
> 500 0 0
> E
> portal gate gateway mestari glowing~
> Looking through the portal, you can see the Administration building in
> Mestari.
> ~
>
> So how would the code read a normal object entry without the 4th bit for
> timer value?
> Hope this is somewhat clear. Thanks for any help.
>
> Travis

 I think there is a better way to do this ( something similar to the mobiles
E-spec parser ).
 Add this :
  DB.C : parse_object()

         j++;
      break;
+    case 'T':
+      get_line(obj_f, line);
+      sscanf(line, "%d ", t);
+      obj_proto[i].obj_flags.timer = t[0];
+      break;
    case '$':
    case '#':
      top_of_objt = i++;

OEDIT.C : oedit_save_to_disk()

   fprintf(fp,   "A\n"
     "%d %d\n",
    obj->affected[counter2].location,
   obj->affected[counter2].modifier
          );
    }
  }
+  if( GET_OBJ_TIMER(obj))
+    fprintf(fp, "T\n"
+                "%d\n",
+                GET_OBJ_TIMER(obj)
+          );
  /* write final line, close */
  fprintf(fp, "$~\n");

We use this for level restricted object. I hope this helps you and it's what
you want.
 I've tested it five minutes ago and it seems it works.

 L.Lunak
 l.lunak@sh.cvut.cz


     +------------------------------------------------------------+
     | 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