Re: strange bug with locate object

From: Sammy (
Date: 10/31/95

On Mon, 30 Oct 1995, Who me? wrote:

> Well the code behind the bug is the fact that the spell parser
> does not pass any arguments to the spell from the command line,
> except character, victim, object, level and savetype.
> Therefore an object is found with the correct word in the objects alias
> but then the first alias only is used from the object.
> example
>   cast 'locate object' staff
> as long as staff is the first alias in the current objects's alias list
> it will find staff's but if the object has an alias dragon staff
> it will switch to search and find alias that contain dragon.
> It is a problem hard to correct it seems from my first glance.
> If anyone has fixed this or knows how to do it I would welcome your
> help/advice or whatever you can offer.
> Darksword the IMP
> Cities of Glory
> 4000

Here's a simple workaround.  First add a string variable obj_locate or 
something like that to char_player_data, or another struct in char_data.  
In do_cast, in the "if (t != NULL)" section do a string copy of t to 
ch->player.obj_locate.  Now in your "locate" code, have it check 
ch->player.obj_locate for the target, instead of using the target passed 
by the spell_parser.  Now it'll only check objects that fit the name in 
obj_locate.  Remember to NULL it back out after using it.

You should probably also do a one_argument on obj_locate before the 
locate, so they can't cast 'locate' ring staff wand etc and get locations 
on multiple names.


This archive was generated by hypermail 2b30 : 12/07/00 PST