北大侠客行MUD论坛

 找回密码
 注册
搜索
热搜: 新手 wiki 升级
查看: 20219|回复: 27

mush 状态栏

[复制链接]
发表于 2009-4-2 04:09:59 | 显示全部楼层 |阅读模式
这个是主要代码

function doGauge (sPrompt, iCurrent, iMax)
InfoColour("black")
InfoFont("Arial", 10, 0)
Info(sPrompt)
InfoFont("Webdings", 10, 0)
local perc = math.floor(iCurrent/(iMax/10))
local color = "red"
if (perc > 8) then
  color = "green"
elseif (perc > 5) then
  color = "yellow"
end
InfoColour(color)
for i = 1, perc, 1 do
  Info("g")
end
InfoColour("dimgray")
for i = perc, 10 do
  Info("g")
end
end

这个是效果

本帖子中包含更多资源

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

x

评分

参与人数 1精华 +30 收起 理由
icer + 30

查看全部评分

北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-4-2 04:12:51 | 显示全部楼层
ps 颜色会随着你的状态变化的
hiahia

下一步是做一个 华丽的mini window
其实代码是从
http://www.gammon.com.au/mushclient/plugins/
抄来的
grin
R&D = read & duplicate!!!
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-4-2 06:01:52 | 显示全部楼层
mini window看起来也不麻烦
估计今天晚上就做好了
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-4-2 07:14:10 | 显示全部楼层
mini win也差不多了

本帖子中包含更多资源

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

x
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-4-2 07:49:03 | 显示全部楼层
final version

本帖子中包含更多资源

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

x
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-4-2 07:56:17 | 显示全部楼层
状态栏位子可以随意调整
还可以弄背景图片
总而言之是很好很强大
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2009-4-2 08:15:09 | 显示全部楼层
感觉很好啊,赶快共享插件,否则当场革毙,grin
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-4-2 08:16:34 | 显示全部楼层
不知道怎么做成puglin.....
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2009-4-2 08:20:18 | 显示全部楼层
mush是很强的,慢慢学吧,我只熟悉js而已,mush提供的很多功能我还没用上。
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2009-4-2 08:39:35 | 显示全部楼层
function drawGauge(win, font, param, left, top, current, maxium)
local height = WindowFontInfo(win, font, 1)
local descent = WindowFontInfo(win, font, 3)
WindowText (win, font,
param, -- text
left, top, 0, 0, -- rectangle
ColourNameToRGB ("darkgreen"), -- colour
false) -- not Unicode

width = WindowTextWidth (win, font, param)
local seperate = 5
local barTop = top + descent
local barLeft = left + width + seperate
local barWidth = 200
local barHeight = height - 2 * descent
local percent = current / maxium
local barColor = getColorByPercent(percent)
if (percent > 1) then
percent = 1
end
WindowRectOp (win, 2, barLeft, barTop, barLeft + barWidth * percent, barTop + barHeight, ColourNameToRGB(barColor)) -- draw rectangle
WindowRectOp (win, 1, barLeft, barTop, barLeft + barWidth, barTop + barHeight, ColourNameToRGB("blue")) -- draw rectangle

WindowText (win, font,
current .. "/" .. maxium, -- text
barLeft + barWidth + seperate, top, 0, 0, -- rectangle
ColourNameToRGB (barColor), -- colour
false)

end
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-26 04:16 AM , Processed in 0.013718 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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