【mud】进场景自动对话函数(clubpoem.c)

声明

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;
}
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值