> I have a minor issue with your code. As written, the specproc may only
> work with a single object (vnum 35) although it is of course possible
> to ASSIGNOBJ() to multiple objects. Of course you can say "if I add a
> new object, I just check for it's vnum too". Yes, this will work but it
> is not clean. Instead of checking the vnum, just check to see if the
> object has a specproc == invis_item.
>
> Here's how i did just that in an object specproc:
>
> SPECIAL(handgrenade)
> {
> ...
>
> /* make sure the object found has this as a specproc */
> if (obj_index[obj->item_number].func != handgrenade) {
> /* this is the wrong object */
> do whatever
> return;
> }
Or, even easier, check to see if this is the object the spec_proc is
atteched to, by use of "me".
in the top line of the proc:
SPECIAL(whatever)
{
struct obj_data *invis_obj = (struct obj_data *)me;
/* cast the "me" pointer to struct obj_data, and assign it to invis_obj */
if (invis_obj->carried_by != ch)
/* check to see if the person carrying the invis_obj is the character
issuing the command, if not exit the proc */
return 1;
...
}
Or whatever.
Chris.
_____________________________________________________
Q: How many IBM CPU's does it take to
execute a job?
A: Four; three to hold it down, and one to
rip its head off.
-----------------------------------------------------
Check out Dominia Mud, on snafu.net.au 3333
Or my homepage: http://yoyo.cc.monash.edu.au/~cjp
+------------------------------------------------------------+
| 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/08/00 PST