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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  global messages
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

global messages

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Taebryn   (58 posts)  [Biography] bio
Date Sun 25 Jan 2004 03:00 AM (UTC)  quote  ]
Message
i would like to code in global messages such as connect messages that are displayed all over the world

ex:
Cadwick has connected to the game.
Cadwick has disconnected from the game.

and i would like to code in an 'ooc' command or a 'narrate' command, works like the say command but chat is displayed in all rooms

ex:
OOC hello everyone
Sam (OOC): Hello everyone

any ideas? ive tried adding connect messages right after it logs it to buf, but i can never get it to work

thanks

Arthurian MUD in development.

Reign of Arthur
http://arthur.vze.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,631 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 25 Jan 2004 04:56 AM (UTC)  quote  ]
Message
It already does them (eg. admins "tell to all") so to help you, you need to post what you did so we can see what is wrong with it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #2 on Sun 25 Jan 2004 05:14 AM (UTC)  quote  ]
Message
This is easy enough. This is taken from my code (I'm going to assume you have SMAUG):

find the end of the nanny function in comm.c, which should look like this (or something similar):

    act( AT_ACTION, "$n has entered the game.", ch, NULL, NULL, TO_ROOM );
    do_look( ch, "auto" );
    mail_count(ch);
    break;

    }

    return;
}

Then just make it look like this this:

    act( AT_ACTION, "$n has entered the game.", ch, NULL, NULL, TO_ROOM );
    sprintf( buf, "%s has connected to the game", ch->name );
    echo_to_all( AT_GREEN, buf, ECHOTAR_ALL );
    do_look( ch, "auto" );
    mail_count(ch);
    break;

    }

    return;
}


Then at the top of do_quit in act_comm.c, define buf. Then, go down and find the line:

act( AT_BYE, "$n has left the game.", ch, NULL, NULL, TO_ROOM );


After that line, add this:
sprintf( buf, "%s has disconnected from the game", ch->name );
echo_to_all( AT_GREEN, buf, ECHOTAR_ALL );

Of course you can change AT_GREEN to whatever color you want. As for the OOC channel or w/e, you just have to mess with your channel files and settings. Follow the steps below:

Stick this function in act_comm.c

void do_ooc( CHAR_DATA *ch, char *argument )
{
    talk_channel( ch, argument, CHANNEL_OOC, "ooc" );
    return;
}

Update tables.c to include the do_ooc function so you can use it on your mud (once this compiles, create it by doing cedit ooc create do_ooc ). You need to update the talk_channel function. Look through the function and find the line that says:
switch ( channel )

Below it should be lots of stuff. If its not in there already, just add something similar to this:

    case CHANNEL_OOC:
        set_char_color( AT_OOC, ch );
        sprintf( buf, "(OOC) $n: $t" );
        position        = ch->position;
        ch->position    = POS_STANDING;
        act( AT_OOC, buf, ch, argument, NULL, TO_CHAR );
        ch->position    = position;
        break;

Just note that that is what mine is, your can be different depending on how you want things done and whatnot. It will require tinkering. Also, one last thing, you may need to update mud.h. If so (you'll get an error about AT_OOC not exisiting), go into mud.h and search for something similar to this:
#define AT_RED 9

Just go to the last one and add:
#define AT_OOC 20

Note: 20 should be the number of the last one + 1. I'm not sure why you don't have an OOC channel with stock though.

Sorry if this was just blaber and you don't understand. All of this is in relation to my SWR 1.0 FUSS modified codebase, so yeah.

Good luck.

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Taebryn   (58 posts)  [Biography] bio
Date Reply #3 on Fri 20 Feb 2004 04:15 AM (UTC)  quote  ]
Message
i have tried what you said, i do get a message now when some1 leaves, it says

$n has left the game
$n has left the game

it does not fill in a name, and it says it twice
what am i doing wrong

Arthurian MUD in development.

Reign of Arthur
http://arthur.vze.com
[Go to top] top

Posted by Seifz   (24 posts)  [Biography] bio
Date Reply #4 on Fri 20 Feb 2004 04:42 AM (UTC)  quote  ]
Message
Concerning the OOC channel you want:

Open up act_comm.c and find the function do_chat. Below it, add this function:

void do_ooc( CHAR_DATA *ch, char *argument )
{
if (NOT_AUTHED(ch))
{
send_to_char("Huh?\n\r", ch);
return;
}
talk_channel( ch, argument, CHANNEL_OOC, "say OOC" );
return;
}

Then, in that same file, find void talk_command and locate the switch (channel). Add the following case:

case CHANNEL_OOC:
set_char_color( AT_GOSSIP, ch );
ch_printf( ch, "You (OOC): %s\n\r", verb, argument );
sprintf( buf, "$n (OOC): $t", verb );
break;

Now, in act_info.c, locate void do_channels and in the section of channels that everyone can see, add:

ch_printf_color( ch, "%s", !IS_SET( ch->deaf, CHANNEL_OOC ) ?
" &G+OOC" :
" &g-ooc" );

below the part for Yell. Scroll down a bit until you see a section that lists all of the channels in a format similar to this:

else if ( !str_cmp( arg+1, "ooc" ) ) bit = CHANNEL_OOC;

Add that line directly above:

else if ( !str_cmp( arg+1, "all" ) ) ClearAll = TRUE;

And then go to the next part which has lines like this:

REMOVE_BIT (ch->deaf, CHANNEL_OOC);

and add yours to the list. Do the same thing for the SET_BIT section right below it (except replace REMOVE_BIT with SET_BIT, of course.

Now, open mud.h and find the Channel Bits section. Add your new channel using the line:

#define CHANNEL_OOC BV28

If you already have a 28, use 29, etc. In the command functions area of mud.h, add:

DECLARE_DO_FUN( do_ooc );

Then, open tables.c and add:

if ( !str_cmp( name, "do_ooc" )) return do_ooc;

under the 'o' case of switch( name[3] ) of the DO_FUN *skill_function( char *name ) area.

Finally, under char *skill_name( DO_FUN *skill ) in the same tables.c file, add:

if ( skill == do_ooc ) return "do_ooc";

Now, delete tables.o, act_comm.o, and act_info.o and then make. And then startup your MUD, and type:

cedit ooc create do_ooc
cedit ooc level 1
cedit ooc flags possessed polymorphed

And that's it! It sounds harder than it is... If I could figure it out, and I know little to nothing about code, I'm sure you can get it. Hope this helps. Sorry it's so messy. :/
[Go to top] top

Posted by Taebryn   (58 posts)  [Biography] bio
Date Reply #5 on Sat 21 Feb 2004 02:23 AM (UTC)  quote  ]
Message
thanks, the ooc channel works fine now

its just the enter and exit messages that dont

Arthurian MUD in development.

Reign of Arthur
http://arthur.vze.com
[Go to top] top

Posted by Thyris   (3 posts)  [Biography] bio
Date Reply #6 on Thu 04 May 2006 01:40 AM (UTC)  quote  ]
Message
OK, I've got up to everything but the adding of the DO_FUN in tables.c for some reason it refuses to work and gives me the error:

/home/thyrisor/public_html/dist/src/tables.c:489: undefined reference to `do_ooc'
tables.o(.text+0x5bd4): In function `skill_name':
/home/thyrisor/public_html/dist/src/tables.c:1136: undefined reference to `do_ooc'
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make[1]: Leaving directory `/home/thyrisor/thyris.org/html/dist/src'
make: *** [all] Error 2

I'm so confused :/
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #7 on Thu 04 May 2006 02:10 AM (UTC)  quote  ]
Message
Did you remember to add the line in mud.h?

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

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #8 on Thu 04 May 2006 03:06 AM (UTC)  quote  ]
Message
Looks like a linker error. Did you add the function do_ooc? Did you call it something else? More importantly, did you call it exactly what you entered in tables.c?

Could you perhaps provide the lines of code it is referring to?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Conner   USA  (381 posts)  [Biography] bio
Date Reply #9 on Thu 04 May 2006 09:00 AM (UTC)  quote  ]
Message
Regarding the entrance and exit messages, I used Rantic's info channel snippet, and it works beautifully for me, which can be found on Cronel's site at http://cronel.mube.net/code.shtml look for infochan.tgz, it's pretty nice and it announces Player logins, logouts, deaths, and level gains without modification.

For the ooc channel.. I took the easy way out and just changed the code for the traffic channel (which I couldn't see a real use for) to read the way I wanted so I'd have an OOC channel instead.. don't forget to use cedit online to create the command to actually use the new channel as well.

-=Conner=-
--
Come test your mettle in the Land of Legends at telnet://tcdbbs.zapto.org:4000
or, for a little family oriented medieval fun, come join us at The Castle's Dungeon BBS at telnet://tcdbbs.zapto.org
or, if you just want information about either, check our web page at http://tcdbbs.zapto.org
[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.


3,207 views.

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [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.

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]