jhzg 发表于 2018-8-9 23:18:41

把渡枫的mini窗口插件,改为脚本后,提示找不到hp_window,求教

本帖最后由 jhzg 于 2018-8-9 03:20 PM 编辑

北大侠客行MUD,中国最好的MUD

jhzg 发表于 2018-8-23 21:18:35

function OnPluginSaveState()
        --Note("OnPluginSaveState")
   -- save window current location for next time
   SetVariable("enabled", tostring (GetPluginInfo (GetPluginID(), 17)))
   movewindow.save_state(hp_win)
   movewindow.save_state(skill_win)
   
   --SetVariable("actorname", actorname)
end --OnPluginSaveState

问题应该出在这里,我不引用这个函数,HP窗口能显示,需要执行安装函数就出来了

windury 发表于 2018-8-23 22:20:32

这个是窗口初始化函数,你可以把它放到你的脚本的最前面来初始化

windury 发表于 2018-8-23 22:22:04

mush的插件是会针对每个插件保留状态信息的
脚本里如何保留这些信息我没有研究过

jhzg 发表于 2018-8-24 19:57:55

应该是找到问题了,把这段代码中的局部变量改成全局变量,问题解决了function OnPluginInstall ()
        --Note("OnPluginInstall")
       
        WindowCreate (hp_win, 0, 0, hp_win_width, hp_win_height, miniwin.pos_bottom_left, 0, 0x000010)
local hp_win_info = movewindow.install (hp_win, miniwin.pos_bottom_left, miniwin.create_absolute_location, true)
        WindowCreate(hp_win, hp_win_info.window_left, hp_win_info.window_top, hp_win_width, hp_win_height, hp_win_info.window_mode, hp_win_info.window_flags, 0x000010)
        movewindow.add_drag_handler (hp_win, 0, 0, hp_win_width, 30)
        WindowFont (hp_win, FONT_NAME, "Arial", FONT_SIZE)
       
        WindowCreate (skill_win, 0, 0, skill_win_width, skill_win_height, miniwin.pos_top_left, 0, 0x000010)
local skill_win_info = movewindow.install (skill_win, miniwin.pos_top_left, miniwin.create_absolute_location, true)
        WindowCreate(skill_win, skill_win_info.window_left, skill_win_info.window_top, hp_win_width, hp_win_height, skill_win_info.window_mode, skill_win_info.window_flags, 0x000010)
        movewindow.add_drag_handler (skill_win, 0, 0, skill_win_width, 30)
        WindowFont (skill_win, FONT_NAME, "Arial", FONT_SIZE)
       
end

jhzg 发表于 2018-8-25 12:24:10

本帖最后由 jhzg 于 2018-8-25 03:33 PM 编辑

研究了一下movewindows.lua,觉得是不是把这个临时变量存成mush的变量,效果会不会更好?
SetVariable("hp_win_info",hp_win_info)
SetVariable("skill_win_info",skill_win_info)
这样改了不行,不能用{:7_287:}

jhzg 发表于 2018-8-25 23:35:26

在考虑只是开窗口,那就把触发这一块拿出来,单独弄个脚本,开窗的那部分还用插件形式,不知道这样行不行,找时间试试
页: [1]
查看完整版本: 把渡枫的mini窗口插件,改为脚本后,提示找不到hp_window,求教