mush 状态栏
这个是主要代码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
这个是效果
http://img25.imageshack.us/img25/2203/gaugey.jpg ps 颜色会随着你的状态变化的
hiahia
下一步是做一个 华丽的mini window
其实代码是从
http://www.gammon.com.au/mushclient/plugins/
抄来的
grin
R&D = read & duplicate!!! mini window看起来也不麻烦
估计今天晚上就做好了 mini win也差不多了 final version 状态栏位子可以随意调整
还可以弄背景图片
总而言之是很好很强大 感觉很好啊,赶快共享插件,否则当场革毙,grin 不知道怎么做成puglin..... mush是很强的,慢慢学吧,我只熟悉js而已,mush提供的很多功能我还没用上。 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