[crossfire] Ability of inventory checker to check for specifics?
Mark Wedel
mwedel at sonic.net
Mon Jun 11 00:11:57 CDT 2007
Alex Schultz wrote:
> mail-lists+cfdev at dogphilosophy.net wrote:
>> Here's a hypothetical situation - say I want an area which is only accessible
>> to devotees of, say, Sorig.
>>
>> If I'm reading the wiki entry on inventory checkers correctly, it looks as
>> though I can have an inventory checker check for a specific skill
>> (e.g. "skill_praying") just as easily as a physical object. However, it
>> doesn't appear to be possible to check for (in this example) "title Sorig".
>> Similarly, I would assume it's not possible to check for a minimum level (for
>> example, if I wanted an area accessible only to "worshippers who have proven
>> themselves", translating to a minimum skill_praying level of 5)?
>>
>> Feature request, or am I just missing how this kind of thing can already be
>> done?
>>
>> On a related note, is there any way to check other player attributes e.g.
>> current str,dex,hp,etc with a detector/inventory checker/pedestal type
>> object?
> Nope, you're not missing anything. Currently, the only inventory checks
> possible are by name or by archetype I believe. You can however use
> python scripting to check other things currently. IMHO it would be nice
> to be able to check arbitrary attributes as such, however that would
> almost be getting to the point of adding a miniature scripting system in
> the rules to check with and would certainly be non-trivial to code. Of
> course it would be possible easily to implement checkers specific to
> things like what god they follow, though that does feel a bit too
> specific to me to be nice.
Pretty much agree - trying to add a checker for all these things with an
archetype would be pretty complicated (only clean way I could think to do it is
that the inventory checker has an inventory object that it uses to check against
- anything in the inventory object that is not zero/null is considered to be
something to be compared against in the object itself.
However, this would make for a really long function, as you'd basically have
something like:
if (checker->inv->foo && checker->inv->foo != ob->foo) continue // not a match
For every field in the object.
And non zero even gets odd - maybe you want to check that the field in the
object you are checking against is zero/null, etc.
I think python is the way to go. Maybe this is a case where a sample plugin
would be appreciated.
More information about the crossfire
mailing list