请教高手指点迷津。miniwindow下,
mush4.7以上版本怎么弄miniwindow?怎么下面代码无法画出miniwindow呢?请教下哪里有问题哦??
---------miniwindows 模块------------
--字体
FONT_NAME1 = "Arial"
FONT_NAME2 = "Webdings"
FONT_NAME3 = "Lucida Console"
FONT_SIZE_11 = 11
FONT_SIZE_12 = 12
--尺寸
EDGE_WIDTH = 3
--位置
WINDOW_POSITION = 6 -- see below (6 is top right)
--[[
常用positions:
4 = top left
5 = center left-right at top
6 = top right
7 = on right, center top-bottom
8 = on right, at bottom
9 = center left-right at bottom
--]]
-- colours
WINDOW_BACKGROUND_COLOUR = ColourNameToRGB ("white")
BOX_COLOUR = ColourNameToRGB ("royalblue") -- Box boarder's colour
WINDOW_TEXT_COLOUR = ColourNameToRGB ("black")
-- offset of text from edge
TEXT_INSET = 5
-- get a unique name
win = GetPluginID () -- get a unique name
-- end configuration
function draw_window()
--[[
print("----------------------")
tprint(basic)
print("----------------------")
tprint(special)
--]]
skills_table={}
for i = 1,#basic do
table.insert(skills_table,basic)
end
for i = 1,#special do
table.insert(skills_table,special)
end
local _skills_ch = {}
local _skills_lev = {}
for i = 1,#skills_table do
_skills_ch = me.skills].name
_skills_lev = me.skills].lv
if skills_table == cur_lingwu_skill then
_lx_special = special
end
end
-- window size in pixels
WINDOW_WIDTH = 250
WINDOW_HEIGHT = (#skills_table + 1)*20+35
-- Create the window
--WindowCreate (win, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_POSITION, 0, WINDOW_BACKGROUND_COLOUR) -- create window
WindowCreate (win, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_POSITION, 4, 0x000010)
-- define the fonts
WindowFont (win, "f1", FONT_NAME1, FONT_SIZE_12)
WindowFont (win, "f2", FONT_NAME2, FONT_SIZE_11)
WindowFont (win, "f3", FONT_NAME1, FONT_SIZE_12, true)
WindowFont (win, "f4", FONT_NAME3, FONT_SIZE_11, true)
-- work out how high the font is
font_height = WindowFontInfo (win, "f1", 1) -- height of the font
-- draw the border of the whole box
--WindowCircleOp (win, 2, 0, 0, 0, 0, BOX_COLOUR, 6, EDGE_WIDTH, 0x000000, 1)
WindowCircleOp (win, miniwin.circle_round_rectangle, 0, 2, WINDOW_WIDTH-2, WINDOW_HEIGHT, 0xc0c0c0, 0, 1,0, 0, 9, 9)
-- ensure window visible
local head_width = (WINDOW_WIDTH - WindowTextWidth (win, "f1", "领悟技能列表"))/2
local head_width1 = (WindowTextWidth (win, "f1", "(")) + 5
local head_width2 = (WindowTextWidth (win, "f1", "( 为领悟中,")) + 5
WindowText (win, "f1",
"技能列表", -- text
head_width, 5, 0, 0, -- rectangle
ColourNameToRGB ("green"), -- colour
false) -- not Unicode
WindowText (win, "f1",
"( 为领悟中, 为练习中)", -- text
5, 25, 0, 0, -- rectangle
ColourNameToRGB ("green"), -- colour
false) -- not Unicode
WindowText (win, "f1",
"红色", -- text
head_width1, 25, 0, 0, -- rectangle
ColourNameToRGB ("red"), -- colour
false) -- not Unicode
WindowText (win, "f1",
"蓝色", -- text
head_width2, 25, 0, 0, -- rectangle
ColourNameToRGB ("blue"), -- colour
false) -- not Unicode
for i = 1,#skills_table do
if _skills_ch == "" or _skills_ch == nil then
_skills_ch = "数据丢失"
end
if skills_table == "" or skills_table == nil then
skills_table = "数据丢失"
end
if _skills_lev == "" or _skills_lev == nil then
_skills_lev = "数据丢失"
end
if skills_table == cur_lingwu_skill then
_colour = "red"
elseif skills_table == cur_lingwu_skill or skills_table == _lx_special then
_colour = "blue"
else
_colour = "green"
end
local txt2 = _skills_ch.."("..skills_table.."):".._skills_lev
local _high = i*20 + 25
WindowText (win, "f1",
txt2, -- text
5, _high, 0, 0, -- rectangle
ColourNameToRGB (_colour), -- colour
false) -- not Unicode
end
WindowShow (win, true)
end
北大侠客行MUD,中国最好的MUD 不能直接用getid后的值,要再加点字符才行。你可以看下论坛相关帖子 原帖由 labaz 于 2011-8-6 05:05 PM 发表 http://pkuxkx.com/forum/images/common/back.gif
不能直接用getid后的值,要再加点字符才行。你可以看下论坛相关帖子
哦,那是不是可以去掉那句话就可以了? win = littleknife..GetPluginID () -- get a unique name
回复 4楼 的帖子
完成!谢谢啦。。新的领悟模块已经完成,再也不用设置诸如basic skills,special skills ,weapon了。呵呵。一个#lingwu,完活。ttk_21
页:
[1]