北大侠客行MUD论坛

 找回密码
 注册
搜索
热搜: 新手 wiki 升级
楼主: lkyun

请会用mush和zmud的高手进来指点下

[复制链接]
发表于 2009-7-1 08:13:42 | 显示全部楼层
help->content->scripting->function list->utils->msgbox
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-7-1 08:23:29 | 显示全部楼层
Lua function
utils.msgbox
Summary
Display a message box and get a response
Prototype
response = utils.msgbox ( msg, title, type, icon, default )

Description
This lets you display a Windows message box (very similar to MsgBox in VBscript). The intention is to allow you to display (in a small dialog box), information of an urgent nature, or ask a yes/no type question.
The calling sequence is:

result = utils.msgbox ( msg, title, type, icon, default )

The only required argument is the message text itself, the others default to their first possible value. The first 4 arguments are string arguments, the last is a number.
  · msg = message to display (max 1000 characters)
  · title = title of box - if nil, defaults to "MUSHclient" (max 100 characters)
  · type = type of box (must be in lower case and exactly as shown here):

  · "ok" - The message box contains one push button: OK. This is the default.
  · "abortretryignore" - The message box contains three push buttons: Abort, Retry, and Ignore.
  · "okcancel" - The message box contains two push buttons: OK and Cancel.
  · "retrycancel" - The message box contains two push buttons: Retry and Cancel.
  · "yesno" - The message box contains two push buttons: Yes and No.
  · "yesnocancel" - The message box contains three push buttons: Yes, No, and Cancel.
  · icon = type of icon:

  · "!" - An exclamation-point icon appears in the message box. This is the default.
  · "?" - A question-mark icon appears in the message box.
  · "i" - An icon consisting of a lowercase letter i in a circle appears in the message box.
  · "." - A stop-sign icon appears in the message box.
  · default = default button (1 - 3)
This sets the default button (the one with the focus) to be either button 1, 2 or 3. The default is the first button.

Return value = (string) yes, no, ok, retry, ignore, cancel, abort
Example:

print (utils.msgbox ("You are being paged", "Warning!", "ok", "!", 1)) --> ok
print (utils.msgbox ("You are being paged")) --> ok
print (utils.msgbox ("Go ahead?", "Question", "yesno", "?")) --> yes / no

好复杂,勉强看懂了
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2009-7-1 08:25:46 | 显示全部楼层
Lua语言,楼上的比我快
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2009-7-1 09:34:58 | 显示全部楼层
原帖由 sure 于 2009-6-30 11:46 PM 发表
maper比我牛,我只写了领悟、朱熹、红豆的trigger值得一提,maper做的是gps定位,超牛

sure 你太谦虚了,你的每一次出手都改变了游戏进程。
我那个自动行走是参考别人的
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2009-7-1 09:59:14 | 显示全部楼层
duno,maper,sure == 已知的三位论坛中的MUSH高手

估计还有更多不怎么上论坛的……

上两张图,估计可以解释得更清楚:





需要注意第二张图中的第二个圆圈,那个“.”很重要。

[ 本帖最后由 ddid 于 2009-7-1 10:32 AM 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-7-16 20:10:49 | 显示全部楼层
大家说的都是在trigger中用的,我在脚本中加入后总是提示出错啊,下面三种格式都有问题,谁能给个标准格式
world.utils.msgbox("答完了,退出!");
.utils.msgbox("答完了,退出!");
utils.msgbox("答完了,退出!");
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2009-7-16 20:23:51 | 显示全部楼层
引用怎么老是会出问题呢?
楼上的详细说说你在脚本中是怎么用的?包括触发,脚本语言等等。

[ 本帖最后由 maper 于 2009-7-16 08:24 PM 编辑 ]
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-7-16 20:33:46 | 显示全部楼层
function asktest()
{
var num=parseInt(world.GetVariable("ansnum"));
num=num+1;
world.send("tell bake "+num);
world.SetVariable("ansnum",num);
if(num==50)
{
world.SetVariable("ansnum",0);
utils.msgbox("答完了,退出!");
}
else
{
//world.SetVariable("fdnum",0);
world.DoAfter(3,"ask hongdou about test");
}
}
function testwait()
{
world.DoAfter(1,"ask hongdou about test");
}
function answertest()
{
var a=world.GetVariable("an");
var a1=world.GetVariable("an1");
var a2=world.GetVariable("an2");
var a3=world.GetVariable("an3");
var a4=world.GetVariable("an4");
switch (a) {
  case a1:
   world.send("answer 1");
   break;
  case a2:
   world.send("answer 2");
   break;
  case a3:
   world.send("answer 3");
   break;
  case a4:
   world.send("answer 4");
   break;
  default:
   utils.msgbox("请手动回答!");
   break;
}
}


这是我在论坛上下的红豆机器人的脚本,红色这两句我想改成提示框弹出,但每次满足条件后mush就会报错说格式不对
触发里全是答案,就不必要贴上来了

[ 本帖最后由 lkyun 于 2009-7-16 08:42 PM 编辑 ]
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2009-7-16 20:41:51 | 显示全部楼层
utils.msgbox只能在lua语言下使用,而你使用的是js。
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-7-16 20:43:45 | 显示全部楼层
那我干脆tell另一个id,用zmud4.62里的#mess来提示,笨办法啊
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|北大侠客行MUD ( 京ICP备16065414号-1 )

GMT+8, 2024-6-10 05:23 PM , Processed in 0.013643 second(s), 13 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表