作者laechan (小太保)
看板mud_sanc
标题[wizs] random semote
时间Sun Nov 8 14:14:13 2009
边打边改。
> call emoted;query_some_emote;"hi"
房间(/adm/daemons/emoted)-> query_some_emote( "hi" ) = ([
"me" : "$N向大家问好 ^_^\n",
"tme" : "$N很有风度地向$O问好。\n"
])
> semote hi
.me
$N向大家问好 ^_^
.tme
$N很有风度地向$O问好。
若依照上面的资料格式,要实作成 random 式的大概......可以。
刚看完 emoted.c 的 create 函数後也觉得大概不用改,我刚
已经有 test 过。
所以重点放在 channel_d.c,而它 call 的是 emoted.c 的
chat_emote 函数。
所以 channel_d.c 也不需要动,只需动 emoted.c 的函数即
可。
先改 emoted.c 的 chat_emote 函数.
if(tar &&
(stringp( str = emote[verb]["tothers"] ) || ( str = emote[verb]["tme"] ) ))
{
这里修改为底下..
if(tar &&
( stringp(str = emote[verb]["tothers"]) ||
str = emote[verb]["tme"] ||
str = emote[verb]["tmes"] ) )
{
tmes 即新增的东西。
然後再新增底下五行...
if(str=emote[verb]["tmes"])
{
tmps2=explode(str,"\n");
str=tmps2[random(sizeof(tmps2))];
}
接下来...
if(emote[verb] && !stringp( str = emote[verb]["others"] ))
str=emote[verb]["me"];
else
return 0;
修改为底下...
if(emote[verb] && !stringp( str = emote[verb]["others"] ))
{
if(str=emote[verb]["mes"])
{
tmps2=explode(str,"\n");
str=tmps2[random(sizeof(tmps2))];
}
else
str=emote[verb]["me"];
}
else
return 0;
ok, 改完了。
【闲聊─(‵y▽′)╭】用记事本 coding 中(Laechan:拳士)向大家问好。(随机抓取第二个
)
【闲聊─(‵y▽′)╭】用记事本 coding 中(Laechan:拳士)向大家问好。(随机抓取第三个
)
【闲聊─(‵y▽′)╭】用记事本 coding 中(Laechan:拳士)向大家问好。(随机抓取第二个
)
以上是同一个 semote 执行的结果。
Laechan
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.38.143.145