[CF-Devel] plugin and events

Mark Wedel mwedel at sonic.net
Wed Sep 25 01:40:57 CDT 2002


Todd Mitchell wrote:
>
     
      ----- Original Message -----
     
     
>
     
      Yes, I didn't want to be able to hook local objects to the global map reset
     
     >
     
      event, I was thinking that a new local map refresh event could be useful
     
     >
     
      (and not too prohibitive since it would only have to check objects on that
     
     >
     
      map).  Then you would not have a problem that objects would not be in memory
     
     >
     
      since it would only be objects going into memory that could hook the event.
     
     >
     
      I don't know if this is possible but it sounds (to the non-expert here)
     
     >
     
      possible... (what is the CFWreadymapname wrapper?)
     
     
  Normally, when a map is reset, it has already been swapped out (no objects in 
memory).  When the map resets, its temp file is removed, and its entry from the 
list of linked maps is removed.

  It would certainly be possible to re-load the map before resetting it, but 
this is a bit odd, and certainly not the most efficient.  Updating values on a 
such a map may be of limited use (since the changes are going to be lost).  Now 
I suppose the map could be loaded, the map searched for objects with map reset 
scripts, then the map get saved out again, and then reset, but the efficiency of 
this is terrible.

  Crossfire is single threaded.  disk i/o can be a real killer in terms of 
performance - ideally, you want each tick to process in the same amount of time. 
  Doing all that above is very likely to stretch out the time it takes to 
process that tick.

  Its unclear to me why you really need to wait for the map reset event to do 
what you want




>
     
      no problem with using unique-item files, but for some things you wanted to
     
     >
     
      do it would be more (dynamic? straightforward? simple?) if there was a local
     
     >
     
      map refresh hook.  Thinking more of non pickable objects - or intercepting
     
     >
     
      the arch that is placed on a map (like creatures who are tougher depending
     
     >
     
      on how many players are on the server when the map is created/refreshed.)
     
     
  Sounds what you are really looking for is a 'call my script the first time 
this map is loaded into memory'.  That is very different than when a map resets 
- when the server first starts, for example, you would get a lot of the former, 
but none of hte later - the maps aren't being reset, they are just being loaded in.

  It shouldn't be too hard to 'fake' this behaviour with very minor code changes 
- the server already has logic that goes through newly loaded map looking for 
objects with the auto_apply flag set (only a few specific types, like random 
treasures).  It would be possible to extend this (additional plugin type, or to 
do something like use the auto_apply flag (or some other new flag) to tell it to 
run a script.


>
     
     
     >
     
     
     >>
     
       Now it would be useful to attach scripts to most unique objects - in
     
     >>
     
     particular to the pickup and drop - if someone drops a unique item in a
     
     >
     
     
     >
     
      shop
     
     >
     
     
     >>
     
     (tries to sell it), it goes back to its starting location for example -
     
     >
     
     
     >
     
      pickup
     
     >
     
     
     >>
     
     could be used for it to store away where it was picked up.
     
     >
     
     
     >
     
     
     >
     
      This is a good idea too, I remember on the Abermud there was a pit where you
     
     >
     
      dumped quest items and other garbage and got some xp for them - presumably
     
     >
     
      doing  you could then return some items into circulation or kick off a
     
     >
     
      refresh(?) of that quest.
     
     
  this could be much more useful for things like guild house keys, common 
apartment keys, etc.  Right now, there aren't too many objects that have unique 
set, so this isn't too big an issue.

  You can't uniqueness too much for objects - after all, you don't want the good 
items gone forever because the player who accumlated then just stored them away, 
so most objects will need to remain non unique.



    
    


More information about the crossfire mailing list