Author Topic: eventTalkResponse() displayed before the instigating talking  (Read 2006 times)

Offline purlow

  • Acquaintance
  • *
  • Posts: 4
    • View Profile
eventTalkResponse() displayed before the instigating talking
« on: October 30, 2006, 05:35:05 AM »
The other creator on my mud created a dragon NPC that is supposed to respond to some text with an emote. However, if the dragon is cloned after other players have entered the room, those players will see the dragon emote before the text is spoken. This is what I see:



code:
>speak in dragonish Hello, keerath
You say in Dragonish, "Hello, keerath."
Keerath snuffles up to you.




This is what others see when the dragon is cloned after they enter:



code:
Purlow teleports in.
Purlow clones Keerath.
Keerath snuffles up to Purlow.
Purlow says in Dragonish, "Hello, keerath."




This is what others see when the dragon is already cloned before they enter:



code:
> s
LPC University Reception [n]
A recycling bin is here.
Grand Master Purlow the Benevolent is standing here.
A polite young woman is standing here.
Keerath is standing here.

> Purlow says in Dragonish, "Hello, keerath."
Keerath snuffles up to Purlow.




Here is the code for the dragon:



code:
#include <lib.h>

inherit LIB_SENTIENT;

void eventRespond(object player);

static void create() {
    string privs;
    privs = query_privs();

    sentient::create();
    SetKeyName("Keerath");
    SetId(({ "Keerath", "gold dragon", "dragon", "keerath"}));
    SetAdjectives(({"non-player", "non player"}));
    SetShort("Keerath");
    SetLong("Though summoned by her Creator, this massive gold dragon queen is still imposing and retains
 her pride.  One would do well not to anger her or her Creator.");
    SetLevel(20);
    SetMelee(1);
    SetRace("dragon", 1);
    SetGender("female");
    SetClass("fighter");
    SetMorality(500);
    SetUnique(1);
    SetTalkResponses( (["hello, keerath" : (: eventRespond :) ]) );  
    SetAction(5, ({ "!emote stretches her neck towards you, hoping for scritches.", "!emote sighs content
edly.", "!emote regards you as a queen does her subjects." }));
    SetDie("With a piercing scream, the golden queen launches herself into the void between space.");

}

void eventRespond(object player) {

    message("other_action", (string)this_object()->GetName() + " snuffles up to " + (string)player->GetNa
me() + ".", environment(this_object()),  player);

    message("other_action", (string)this_object()->GetName() + " snuffles up to you.", player);
}

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

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
eventTalkResponse() displayed before the instigating talking
« Reply #1 on: October 30, 2006, 09:08:29 AM »

This out of order messaging is due to the "serial" manner in which

objects receive messages. To make a long story short, the

dragon is getting the spoken message and immediately responding

to it, before other living creatures in the room have received the

spoken message yet.



The reason it happens "sometimes" is the the order in which

living things receive these messages changes when creatures

leave and enter.



I'll modify a lib file to fix this and post it later today/tonight.



Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
eventTalkResponse() displayed before the instigating talking
« Reply #3 on: October 31, 2006, 05:26:49 AM »

If anyone downloaded that room.c fix for the

out-of-sequence bug, please download it again. Memrosh

just helped me find a bug in my bugfix.



Please get the updated file from:

http://dead-souls.net/fixes.html">http://dead-souls.net/fixes.html





(thx Memrosh!)