Jump to content
  • 0

NPC talk to a #channel


rayn

Question


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  164
  • Reputation:   55
  • Joined:  11/25/11
  • Last Seen:  

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.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  164
  • Reputation:   55
  • Joined:  11/25/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  04/21/14
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   72
  • Joined:  10/20/12
  • Last Seen:  


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

* 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
Link to comment
Share on other sites

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.

×
×
  • Create New...