Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Bing

Members: 0
Guests: 16
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,396
629
DarrenPayn
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Smaug Snippets » Problems installing a sayto s...
Forum Rules | Mark all | Recent Posts

Problems installing a sayto snippet.
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jan 21, 2007, 8:16 am
Go to the top of the page
Go to the bottom of the page

desconocido

GroupMembers
Posts8
JoinedNov 21, 2006

Greetings.

I found this sayto snippet, written by Samson, and I'm trying to install it on AFKmud18, getting a bunch of errors at compile. I hope someone will be able to help me fix this, thanks in advance.

I'm running AFKmud18 under cygwin, which is all working fine. Here's the errors i get when I'm trying to compile, after adding the snippet to act_comm.c:

make -s afkmud
  Compiling o/act_comm.o....
act_comm.c: In function `void do_say_to_char(CHAR_DATA*, char*)':
act_comm.c:1948: warning: declaration of 'last_char' shadows a global declaratio
n
mud.h:2207: warning: shadowed declaration is here
act_comm.c:1975: error: `NOT_AUTHED' undeclared (first use this function)
act_comm.c:1975: error: (Each undeclared identifier is reported only once for ea
ch function it appears in.)
act_comm.c:1981: error: no match for 'operator&' in 'ch->char_data::in_room->roo
m_index_data::room_flags &  ROOM_SILENCE'
act_comm.c:2058: error: no match for 'operator&' in 'ch->char_data::in_room->roo
m_index_data::room_flags &  ROOM_LOGSPEECH'
act_comm.c:2071:4: warning: no newline at end of file
make[1]: *** [o/act_comm.o] Error 1
make: *** [all] Error 2


I've changed void into CMDF, but there's probably a lot more that I don't know about....

Here the actual snippet:

CMDF do_say_to_char( CHAR_DATA *ch, char *argument )  
{  
    char arg[MAX_INPUT_LENGTH], last_char;  
    char buf[MAX_STRING_LENGTH];  
    CHAR_DATA *vch;  
    CHAR_DATA *victim;  
    EXT_BV actflags;  
    int arglen;  
#ifndef SCRAMBLE  
 
    int speaking = -1, lang;  
   
    for ( lang = 0; lang_array[lang] != LANG_UNKNOWN; lang++ )  
        if ( ch->speaking & lang_array[lang] )  
        {  
            speaking = lang;  
            break;  
        }  
#endif  
   
    argument = one_argument( argument, arg );  
   
    if ( arg[0] == '\0' || argument[0] == '\0' )  
    {  
        send_to_char( "Say what to whom?\n\r", ch );  
        return;  
    }  
    if ( ( victim = get_char_world( ch, arg ) ) == NULL  
         || ( IS_NPC(victim) && victim->in_room != ch->in_room )  
         || (!NOT_AUTHED(ch) && NOT_AUTHED(victim) && !IS_IMMORTAL(ch) ) )  
    {  
        send_to_char( "They aren't here.\n\r", ch );  
        return;  
    }  
   
    if ( IS_SET( ch->in_room->room_flags, ROOM_SILENCE ) )  
    {  
        send_to_char( "You can't do that here.\n\r", ch );  
        return;  
    }  
   
    arglen = strlen( argument ) - 1;  
    /* Remove whitespace and tabs. */  
    while( argument[arglen] == ' ' || argument[arglen] == '\t' )  
        --arglen;  
    last_char = argument[arglen];  
      
    actflags = ch->act;  
    if ( IS_NPC(ch) )  
        xREMOVE_BIT( ch->act, ACT_SECRETIVE );  
    for ( vch = ch->in_room->first_person; vch; vch = vch->next_in_room )  
    {  
        char *sbuf = argument;  
   
        if ( vch == ch )  
            continue;  
   
        /* Check to see if character is ignoring speaker */  
        if (is_ignoring(vch, ch))  
        {  
            /* continue unless speaker is an immortal */  
            if(!IS_IMMORTAL(ch) || get_trust(vch) > get_trust(ch))  
                continue;  
            else  
            {  
                set_char_color(AT_IGNORE, vch);  
                ch_printf( vch, "You attempt to ignore %s, but are unable to do so.\n\r", ch->name );  
            }  
        }  
   
#ifndef SCRAMBLE  
 
        if ( speaking != -1 && (!IS_NPC(ch) || ch->speaking) )  
        {  
            int speakswell = UMIN(knows_language(vch, ch->speaking, ch), knows_language(ch, ch->speaking, vch) );  
            if ( speakswell < 75 )  
                sbuf = translate(speakswell, argument, lang_names[speaking]);  
        }  
#else  
        if ( !knows_language(vch, ch->speaking, ch)  
        &&  (!IS_NPC(ch) || ch->speaking != 0) )  
            sbuf = scramble(argument, ch->speaking);  
#endif  
        sbuf = drunk_speech( sbuf, ch );  
   
        MOBtrigger = FALSE;  
   
    }  
    ch->act = actflags;  
    MOBtrigger = FALSE;  
      
    switch( last_char )  
    {  
    case '?':  
        act( AT_SAY, "You ask $N, '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_CHAR );  
        act( AT_SAY, "$n asks $N, '$t&c'", ch, drunk_speech( argument, ch), victim, TO_NOTVICT );  
        act( AT_SAY, "$n asks you '$t&c'", ch, drunk_speech( argument, ch), victim, TO_VICT );  
	break;  
   
    case '!':  
        act( AT_SAY, "You exclaim at $N, '$t&c'", ch, drunk_speech( argument, ch), victim, TO_CHAR );  
        act( AT_SAY, "$n exclaims at $N, '$t&c'", ch, drunk_speech( argument, ch), victim, TO_NOTVICT );  
        act( AT_SAY, "$n exclaims to you, '$t&c'", ch, drunk_speech( argument, ch), victim, TO_VICT );  
	break;  
   
    default:  
        act( AT_SAY, "You say to $N '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_CHAR );  
        act( AT_SAY, "$n says to $N '$t&c'", ch, drunk_speech( argument, ch), victim, TO_NOTVICT );  
        act( AT_SAY, "$n says to you '$t&c'", ch, drunk_speech( argument, ch), victim, TO_VICT );  
	break;  
    }  
      
    if ( IS_SET( ch->in_room->room_flags, ROOM_LOGSPEECH ) )  
    {  
        sprintf( buf, "%s: %s", IS_NPC( ch ) ? ch->short_descr : ch->name, argument );  
        append_to_file( LOG_FILE, buf );  
    }  
    mprog_speech_trigger( argument, ch );  
    if ( char_died(ch) )  
        return;  
    oprog_speech_trigger( argument, ch );  
    if ( char_died(ch) )  
        return;  
    rprog_speech_trigger( argument, ch );  
    return;  
}  


I'd appreciate it if someone could help me fix this.

-D.
       
Post is unread #2 Jan 21, 2007, 8:57 am   Last edited Jan 21, 2007, 8:59 am by Keberus
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

Well it seems like they switched to extended bitvectors for the room flags so change
    if ( IS_SET( ch->in_room->room_flags, ROOM_LOGSPEECH ) )


to
    if ( xIS_SET( ch->in_room->room_flags, ROOM_LOGSPEECH ) )

and
    if ( IS_SET( ch->in_room->room_flags, ROOM_SILENCE ) ) 

to
    if ( xIS_SET( ch->in_room->room_flags, ROOM_SILENCE ) ) 


Its saying last_char is already used so change all refernces to a diff name like last_charv.

To get NEW_AUTH to work at the top of act_comm.c find
#include "boards.h"
#include "language.h"


and add new_auth.h to make it look like this:
#include "boards.h"
#include "language.h"
#include "new_auth.h"


That should fix your problems.

Later,
KeB
       
Post is unread #3 Jan 21, 2007, 9:38 am
Go to the top of the page
Go to the bottom of the page

desconocido

GroupMembers
Posts8
JoinedNov 21, 2006

Thanks for the quick response, Keberus, I really appreciate it.

It worked for the most part, except the following:

act_comm.c: In function `void do_say_to_char(CHAR_DATA*, char*)':
act_comm.c:1976: error: `get_auth_state' undeclared (first use this function)
act_comm.c:1976: error: (Each undeclared identifier is reported only once for ea
ch function it appears in.)
make[2]: *** [o/act_comm.o] Error 1


The part it's reffering to:

    if ( ( victim = get_char_world( ch, arg ) ) == NULL  
         || ( IS_NPC(victim) && victim->in_room != ch->in_room )  
         || (!NOT_AUTHED(ch) && NOT_AUTHED(victim) && !IS_IMMORTAL(ch) ) )


I'm one of the biggest newbs out here, but I'm slowly making progress. :)
       
Post is unread #4 Jan 21, 2007, 10:13 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,644
JoinedJan 1, 2002

You should be aware that AFKMud has included a form of the sayto snippet for quite some time now. It's generally found by way of the "ask" command, so installing the sayto snippet is actually unnecessary.
       
Post is unread #5 Jan 21, 2007, 10:53 am
Go to the top of the page
Go to the bottom of the page

desconocido

GroupMembers
Posts8
JoinedNov 21, 2006

Ah, I could just cp that piece of code and change the outcome to whatever's suitable. I've noticed the ask command before and even looked at the code, but I never realized it's basicly the same as the sayto snippet.

I'll go have a look at it, thank you.
       
Pages:<< prev 1 next >>