声明
void do_test();
调用
void create ()
{
set ("short", "七楼:乐府诗社");
set ("long", @LONG
高楼之上,
满城繁华尽收眼底。
文人骚客都喜欢在这里品茶吟诗, 谈古论今,
你瞧,不知谁在茶桌上刚刚写好一首诗(poem)。
里边柜台上新贴了张启事(qishi),你不由得走过去看了几眼。
LONG);
set("exits", ([ /* sizeof() == 1 */
"down" : __DIR__"clubup5",
//"west" : __DIR__"shaizi-room",
//"east" : __DIR__"puke-room",
"up": __DIR__"club3",
]));
set("objects", ([
__DIR__"npc/teawaiter": 1,
__DIR__"npc/suanxiucai": 1,
//__DIR__"npc/gongsun": 1,
"/d/obj/misc/tables" : 1,
]));
setup();
remove_call_out("do_test");
poem_index=1;
running=0;
}
函数体
void do_test()
{
int newt;
object ob;
string first,second,quest;
if(objectp(ob=present("cha boshi",this_object()))
&& living(ob)) {
if(strlen(current)>2&&ans_curr==0) {
last=current;
last_all=current_all;
ans_last=0;
}
newt=0;
while(newt==0) {
if(!find_newline()) {
copy_to_old();
new_poem();
} else {
if(sscanf(poem[index],"%s %s",first,second)==2 &&
!sscanf(poem[index],"%*s[") &&
!sscanf(poem[index],"%*s(") &&
!sscanf(poem[index],"%*s□") ) {
if(strlen(first)>2&&strlen(second)>2) {
newt=1;
}
}
}
}
first=replace_string(first," ","");
second=replace_string(second," ","");
current_all=first+" "+second;
ans_curr=0;
if(strlen(first)>=14 && random(3)==0) {
quest=first;
} else if (strlen(second)>=14 && random(2)==0) {
quest=second;
} else {
quest=first+second;
}
current=replace_string(quest,",",""); // the answer
quest=mixup(quest); // the question
curr_show=quest;
switch(random(1)) {
case 0:
tell_room(this_object(),
"茶博士提笔在墙上写道:"+quest+"\n");
break;
}
}
call_out("do_test",60);
return;
}