Jump to content
  • 0

NPC talk to a #channel


Question

Posted

Anyone know if it is possible to have a script talk to a #channel?

 

Something similar to 'message' script command but instead of targeting a char name, it goes to #main, for example. This way, players can filter out these messages if they leave the channel.

3 answers to this question

Recommended Posts

Posted

Hmm.. anyone? This would be a great feature. Perhaps "message" script command can be modified to accept input from a NPC instead of just players.

Posted

Hello,

 

Is there any way to automate a player sending a message to a channel? Like: Once a player enter a specific map a message will automatically send to a certain channel.

Posted


/*==========================================

* channelmes (sends message to given channel)

*------------------------------------------*/

BUILDIN_FUNC(channelmes)

{

const char *channel_name = script_getstr(st,2), *msg = script_getstr(st,3);

struct Channel * channel = channel_name2channel(channel_name,NULL,0);

if( channel ) {

DBIterator *iter;

struct map_session_data *user;

char message[CHAN_MSG_LENGTH];

snprintf(message, CHAN_MSG_LENGTH, "[ #%s ] %s",channel->name, msg);

iter = db_iterator(channel->users);

for( user = (struct map_session_data*)dbi_first(iter); dbi_exists(iter); user = (struct map_session_data*)dbi_next(iter) ) {

//I didn't use clif_channel_msg or channel_send here, because they need a sender sd...

clif_colormes(user,channel->color,message);

}

}

return SCRIPT_CMD_SUCCESS;

}

BUILDIN_DEF(channelmes,"ss"),

//usage:

channelmes("#main","Hi, I am "+strcharinfo(0)+".");

  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...