[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Problem with explode, not sending message

Problem with explode, not sending message

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Kronos   USA  (35 posts)  [Biography] bio
Date Sat 11 Dec 2004 09:20 PM (UTC)
Message
Alright, i've looked this thing up and down and I can't figure out why It isn't sending the message, first of all, here's the code for explode:

void explode( OBJ_DATA *obj )
{
if ( obj->armed_by )
{
ROOM_INDEX_DATA *room;
CHAR_DATA *xch;
bool held = FALSE;

for ( xch = first_char; xch; xch = xch->next )
if ( !IS_NPC( xch ) && nifty_is_name( obj->armed_by, xch->name ) )
{
if ( obj->carried_by )
{
act( AT_WHITE, "$p EXPLODES in $n's hands!", obj->carried_by, obj, NULL, TO_ROOM );
act( AT_WHITE, "$p EXPLODES in your hands!", obj->carried_by, obj, NULL, TO_CHAR );
room = xch->in_room;
held = TRUE;
}
else if ( obj->in_room )
room = obj->in_room;
else
room = NULL;

if ( room )
{
if ( !held && room->first_person )
act( AT_WHITE, "$p EXPLODES!", room->first_person , obj, NULL, TO_ROOM );
room_explode( obj , xch, room );
}
}
}
make_scraps(obj);
}

when the armed item is sitting in the room, and the timer runs out, it seems that the message of "$p EXPLODES!" is not being sent, or at least not seen. Is there perhaps a small error with this?:

act( AT_WHITE, "$p EXPLODES!", room->first_person , obj, NULL, TO_ROOM );

everyone in the room does recieve damage, and the scraps are made. When someone is holding the item it sends the correct messages, but only they get hit with the "shockwave" from room_explode_1

void room_explode_1( OBJ_DATA *obj , CHAR_DATA *xch, ROOM_INDEX_DATA *room , int blast )
{
CHAR_DATA *rch;
CHAR_DATA *rnext;
OBJ_DATA *robj;
OBJ_DATA *robj_next;
int dam;

if ( IS_SET( room->room_flags, BFS_MARK ) )
return;

SET_BIT( room->room_flags , BFS_MARK );

for ( rch = room->first_person ; rch ; rch = rnext )
{
rnext = rch->next_in_room;
act( AT_WHITE, "The shockwave from a massive explosion rips through your body!", room->first_person , obj, NULL, TO_ROOM );
dam = number_range ( obj->value[0] , obj->value[1] );
damage( rch, rch , dam, TYPE_UNDEFINED );
if ( !char_died(rch) )
{
if ( IS_NPC( rch ) )
{
if ( IS_SET( rch->act , ACT_SENTINEL ) )
{
rch->was_sentinel = rch->in_room;
REMOVE_BIT( rch->act, ACT_SENTINEL );
}
start_hating( rch , xch );
start_hunting( rch , xch );
}
}
}

for ( robj = room->first_content; robj; robj = robj_next )
{
robj_next = robj->next_content;
if ( robj != obj && robj->item_type != ITEM_SPACECRAFT && robj->item_type != ITEM_SCRAPS
&& robj->item_type != ITEM_CORPSE_NPC && robj->item_type != ITEM_CORPSE_PC && robj->item_type != ITEM_DROID_CORPSE)
make_scraps( robj );
}

/* other rooms */
{
EXIT_DATA *pexit;

for ( pexit = room->first_exit; pexit; pexit = pexit->next )
{
if ( pexit->to_room
&& pexit->to_room != room )
{
if ( blast > 0 )
{
int roomblast;
roomblast = blast - 1;
room_explode_1( obj , xch, pexit->to_room , roomblast );
}
else
echo_to_room( AT_WHITE, pexit->to_room , "You hear a loud EXPLOSION not to far from here." );
}
}
}

}

Why is it doing this??

Thanks,
Kronos
[Go to top] top

Posted by Kronos   USA  (35 posts)  [Biography] bio
Date Reply #1 on Sun 12 Dec 2004 12:59 AM (UTC)
Message
The codebase by the way is SWRFUSS. I remember this problem being in the stock SWR so it's old news. Is there anyone who can help me out?

-Kronos
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #2 on Sun 12 Dec 2004 01:03 AM (UTC)
Message
Can you specify what line was not being displayed? Remember that act does not show to stunned/sleeping characters. I'm not sure if room->first_person will work.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Kronos   USA  (35 posts)  [Biography] bio
Date Reply #3 on Sun 12 Dec 2004 01:18 AM (UTC)
Message
it's this here:

act( AT_WHITE, "$p EXPLODES!", room->first_person , obj, NULL, TO_ROOM );

if room->first_person is the problem, what would work?

-Kronos
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #4 on Sun 12 Dec 2004 01:42 AM (UTC)
Message
Well it should work I guess, if used properly. Can you verify that room is not null when it gets to that act?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Kronos   USA  (35 posts)  [Biography] bio
Date Reply #5 on Sun 12 Dec 2004 01:45 AM (UTC)
Message
As far as I can see it's not null. I see other messages like the explosive being turned to scraps, and I recieve damage, but i'm not getting the explosion message..

any idea?
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #6 on Sun 12 Dec 2004 05:47 PM (UTC)
Message
Use GDB and step through it to see where its getting caught on, what criteria that is, and then see where that criteria was being improperly set.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #7 on Sun 12 Dec 2004 08:37 PM (UTC)
Message
Don't forget that the to_room flag on the act means to everybody except the actor and the victim.

Since you use room->first_person, this means that the first person in the room will not see the message.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Kronos   USA  (35 posts)  [Biography] bio
Date Reply #8 on Mon 13 Dec 2004 08:40 PM (UTC)
Message
Ah, you are correct! How could I change it so that everyone, including the first person in the room, could see the messages?

Thanks,
Kronos
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #9 on Tue 14 Dec 2004 12:06 PM (UTC)
Message
Simply add two more acts, use the same string, and use TO_CHAR and TO_VICT.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Kronos   USA  (35 posts)  [Biography] bio
Date Reply #10 on Tue 14 Dec 2004 04:29 PM (UTC)
Message
It works! I see the message, I did the same thing with the shockwave message. But I get this:

A grenade EXPLODES!
Log: [*****] BUG: Act: null vch with TO_VICT.
Log: [*****] BUG: Kronos ($p EXPLODES!)
The shockwave from a massive explosion rips through your body!
Log: [*****] BUG: Act: null vch with TO_VICT.
Log: [*****] BUG: Kronos (The shockwave from a massive explosion rips through yo
ur body!)
That really did HURT!
The shockwave from a massive explosion rips through your body!
Log: [*****] BUG: Act: null vch with TO_VICT.
Log: [*****] BUG: Kronos (The shockwave from a massive explosion rips through yo
ur body!)

Although it works, it's giving me those bug messages.. can I fix that or should I just leave it alone? How would I go about doing that?

Thanks,
Kronos
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #11 on Tue 14 Dec 2004 04:45 PM (UTC)
Message
Oh right, no victim. Okay, get rid of TO_ROOM, and have it TO_CHAR. Then have another that is TO_NOTVICT. So just TO_CHAR and TO_NOTVICT.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Kronos   USA  (35 posts)  [Biography] bio
Date Reply #12 on Tue 14 Dec 2004 05:49 PM (UTC)
Message
Works like a charm =)

Thank you very much for your help!

-Kronos
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


23,996 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]