Author Topic: cathch_tell not working  (Read 1964 times)

Offline Maze of Ith

  • Acquaintance
  • *
  • Posts: 33
  • Sometimes nothing can be a really cool hand.
    • View Profile
cathch_tell not working
« on: March 04, 2013, 07:47:37 pm »
As per the discussion with Cratylus and Goose, here is the code we have been working with that is not responding to eventPrints from objects...
Code: [Select]
#include <lib.h>
inherit LIB_SENTIENT;
void catch_tell(string str);

static void create(){
    ::create();
    SetKeyName("butler");
    SetId(({"butler"}));
    SetAdjectives(({"simple","neat"}));
    SetGender("male");
    SetShort("test butler");
    SetLong("a test butler");
    SetInventory(([
                ]));
    SetMelee(1);
    SetPolyglot(1);
    SetLevel(99);
    SetRace("human");
    set_heart_beat(1);
    SetLanguage("common",100);
    SetDefaultLanguage("common");
}

void catch_tell(string str) {
    string who;
    find_living("zed")->eventPrint("Somethings firing");
    tell_room(environment(this_object()), "something has fired");
}

void init(){
    ::init();
}

Basically, it does not respond to any tells, says, or eventPrints in its' environment.
zed @ looney2.com 8888
zed <at> lilypadmudlib <dot> com

Offline Maze of Ith

  • Acquaintance
  • *
  • Posts: 33
  • Sometimes nothing can be a really cool hand.
    • View Profile
Re: cathch_tell not working
« Reply #1 on: March 04, 2013, 07:57:31 pm »
The goal here is to get the npc object to respond when it sees or 'hears' a knock on the door, just so it is more clear what we are attempting.  :)

We are stuck at getting the NPC to acknowledge the eventPrint that knock.c fires off.

Cheers!
« Last Edit: March 04, 2013, 08:00:42 pm by Maze of Ith »
zed @ looney2.com 8888
zed <at> lilypadmudlib <dot> com

Offline chaos

  • BFF
  • ***
  • Posts: 291
  • Job, school, social life, sleep. Pick 2.5.
    • View Profile
    • Lost Souls
Re: cathch_tell not working
« Reply #2 on: March 04, 2013, 10:48:12 pm »
catch_tell() is not magic; it's only called under specifically defined circumstances, which you should consult your driver documentation about.  In my driver, it's called when the specific efuns say(), tell_object(), tell_room() or write() are used under circumstances where the object defining catch_tell() is an appropriate recipient for the message being sent.  Yours may differ.  If you are not seeing anything from your debug statement in catch_tell(), then your eventPrint() in knock.c (which anybody who doesn't use the same mudlib as you can't analyze anything about because you haven't provided the code for it) is probably not using any mechanism that causes catch_tell() to be called on your NPC.

Offline Maze of Ith

  • Acquaintance
  • *
  • Posts: 33
  • Sometimes nothing can be a really cool hand.
    • View Profile
Re: cathch_tell not working
« Reply #3 on: March 05, 2013, 01:47:07 am »
I am 99% sure I have it working now. I will verify and post the code.
zed @ looney2.com 8888
zed <at> lilypadmudlib <dot> com