On Thu, Sep 09, 2010 at 10:18:41PM +1200, Ralph Versteegen wrote:
> Well, this email was originally going to be part of the one about SAV,
> but then I remembered that NPC instance data has never been read from
> .SAV!
> 
> I'd like start adding of data to NPC instances, like zone
> restrictions. (I'll have to create an NPC instance editor.)
> Actually, I already started.  A few months ago I wrote these (below),
> but didn't check them in because I was waiting for .SAV to be dropped.
> Opps! Sorry Jeremy!
> But anyway, I just thought I may as well ask about functions for
> reading/writing NPC instance data.
> 
> functions:
> 472,setnpcbit,3,0,0,1         #set NPC instance bit (npcref, bit, value)
> 473,getnpcbit,2,0,0           #get NPC instance bit (npcref, bit)
> 
> constants:
> 0,NPCbit:ignore walls
> 1,NPCbit:not obstruction
> 2,NPCbit:suspend use
> 3,NPCbit:suspend movement
> 
> (Incidentally, those "bits" are not actually stored as bits in the
> UDT.) And then other non-flag data like zone restrictions would each
> get a pair of getter/setting functions. Would people prefer something
> more uniform like alter/read npc (below)? Or the opposite extreme of
> individual read/write functions for each bit?
> 
> 472,read npc instance,3,0,0,1         #set NPC instance data (npcref,
> data id, value)
> 473,write npc instance,2,0,0           #get NPC instance data (npcref, data 
> id)
> 
> 0,NPCinst:ignore walls
> 1,NPCinst:not obstruction
> 2,NPCinst:suspend use
> 3,NPCinst:suspend movement
> 4,NPCinst:zone

I like individual functions for each bit. I may have advocated generic 
functions with constants in the past, but I am really starting to hate 
the heck out of them. it is all about what I want to be writing as an 
end-user in my script:

# this is good
set npc ignore walls(npc, true)

# this is bad
set npc bit(npc, NPCbit:ignore walls, true)

As I said, I know the library is already full of stuff that does it the 
second way, I just wish now that it wasn't.

But I suppose this is a matter of personal taste, and my opinion on this 
is certainly not the final word.

---
James
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to