北大侠客行MUD论坛

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

根据DDID的插件改写的HP mini_windows 无法显示中文,请教DDID

[复制链接]
发表于 2009-12-28 23:40:47 | 显示全部楼层
do_prompt的脚本呢?一并发上来看看吧。
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2009-12-29 00:03:31 | 显示全部楼层
那個哦..
  1. function do_prompt (name, line, wildcards)

  2.   local hpString = wildcards [1];
  3.   local hp , max_hp = tonumber (wildcards [2]), tonumber (wildcards [3])
  4.   local ginString = wildcards [4];
  5.   local gin , max_gin = tonumber (wildcards [5]), tonumber (wildcards [6])
  6.   local keeString = wildcards [7];
  7.   local kee , max_kee = tonumber (wildcards [8]), tonumber (wildcards [9])
  8.   local senString = wildcards [10];
  9.   local sen , max_sen = tonumber (wildcards [11]), tonumber (wildcards [12])
  10.   local foodString = wildcards [13];
  11.   local food , max_food = tonumber (wildcards [14]), tonumber (wildcards [15])
  12.   local waterString = wildcards [16];
  13.   local water , max_water = tonumber (wildcards [17]), tonumber (wildcards [18])
  14.   local tireString = wildcards [19];
  15.   local tire , max_tire = tonumber (wildcards [20]), tonumber (wildcards [21])

  16.   if max_kee == 0 then max_kee = 9999999 end
  17.   local hp_th = tonumber (GetVariable ("hp_threshold"))
  18.   local gin_th = tonumber (GetVariable("gin_threshold"))
  19.   local kee_th = tonumber (GetVariable("kee_threshold"))
  20.   local sen_th = tonumber (GetVariable("sen_threshold"))

  21.   --Note(hp_th .. " " .. gin_th .. " " .. kee_th .. " " .. sen_th)

  22.   if hp_th == nil then hp_th = max_hp end
  23.   if gin_th == nil then gin_th = max_gin end
  24.   if kee_th == nil then kee_th = max_kee end
  25.   if sen_th == nil then sen_th = max_sen end

  26.   local hp_percent = hp / hp_th
  27.   local hp_max_percent = max_hp / hp_th
  28.   local gin_percent = gin / gin_th
  29.   local gin_max_percent = max_gin / gin_th
  30.   local kee_percent = kee / kee_th
  31.   local kee_max_percent = max_kee / kee_th
  32.   local sen_percent = sen / sen_th
  33.   local sen_max_percent = max_sen / sen_th
  34.   local food_percent = food / max_food
  35.   if max_food == 0 then food_percent = 1 end
  36.   local water_percent = water / max_water
  37.   local tire_percent = tire / 100



  38.   -- fill entire box to clear it
  39.   check (WindowRectOp (win, 2, 0, 0, 0, 0, BACKGROUND_COLOUR))  -- fill entire box

  40.   -- Edge around box rectangle
  41.   check (WindowCircleOp (win, 3, 0, 0, 0, 0, BORDER_COLOUR, 0, 2, 0, 1))

  42.   vertical = 0  -- pixel to start at

  43.   DoGauge (string.format("%s%12s",hpString .. ": " , "<" .. hp .. "/ " .. max_hp .. ">") , hp_percent, hp_max_percent,  HP_COLOUR ,HP_COLOUR2)
  44.   DoGauge (string.format("%s%12s",ginString.."  : " , "<" .. gin .. "/ " .. max_gin.. ">") , gin_percent ,gin_max_percent, GIN_COLOUR , GIN_COLOUR2)
  45.   DoGauge (string.format("%s%12s",keeString.."  : " , "<" .. kee .. "/ " .. max_kee.. ">") , kee_percent ,kee_max_percent, KEE_COLOUR, KEE_COLOUR2)
  46.   DoGauge (string.format("%s%12s",senString.."  : " , "<" .. sen .. "/ " .. max_sen.. ">") , sen_percent ,sen_max_percent, SEN_COLOUR,SEN_COLOUR2)
  47.   DoGauge (string.format("%s%12s",foodString..": " , "<" .. food .. "/ " .. max_food.. ">") , food_percent ,1, FOOD_COLOUR, FOOD_COLOUR2)
  48.   DoGauge (string.format("%s%12s",waterString..": " , "<" .. water .. "/ " .. max_water.. ">") , water_percent ,1, WATER_COLOUR, WATER_COLOUR2)
  49.   DoGauge (string.format("%s%12s",tireString..": " , "<" .. tire .. "/ 100>") , tire_percent ,1, TIRE_COLOUR , TIRE_COLOUR2)

  50.   WindowShow (win, true)

  51. end -- draw_bar
复制代码
其實我不會用Lua. 這些全是改自Nick 在4.40 裏的.. 我連function 名字都沒改.

[ 本帖最后由 vase 于 2009-12-29 12:04 AM 编辑 ]
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2009-12-29 00:07:41 | 显示全部楼层
local hp_th = tonumber (GetVariable ("hp_threshold"))
  local gin_th = tonumber (GetVariable("gin_threshold"))
  local kee_th = tonumber (GetVariable("kee_threshold"))
  local sen_th = tonumber (GetVariable("sen_threshold"))

這幾個值是按score 時觸發得到的..

北俠裏應該也一樣..
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2009-12-29 00:18:22 | 显示全部楼层
oh

呵呵,还以为是perl的……

这样子的话,写在脚本里应该不会有什么问题,不过导出成插件好像就不行了,不过这个没有真正测试过,还不能完全确定。

[ 本帖最后由 ddid 于 2009-12-29 12:21 AM 编辑 ]
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2009-12-29 00:23:51 | 显示全部楼层
我這個是插件版的

這樣弄沒有問題
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2009-12-29 00:30:23 | 显示全部楼层
呵呵. 我只有這一個插件是lua 版的..

其它的全是perl 版的了.

因為全是自己寫的.. 用起來比較爽
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2009-12-29 00:42:29 | 显示全部楼层
对perl呢,我是门外汉,一无所知,只是好奇,想看看;

对lua呢,基本上是现学现用,学到那算哪,也算不上精通……

对这个LUA的脚本,有点奇怪,DoGauge()是怎么实现的?
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2009-12-29 00:48:23 | 显示全部楼层
  1. function DoGauge (sPrompt, Percent, Percent2 , Colour, Colour2)
  2.   local Fraction = tonumber (Percent)  
  3.   local Fraction2 = tonumber (Percent2)

  4.   if Fraction > 1 then Fraction = 1 end  
  5.   if Fraction < 0 then Fraction = 0 end  
  6.   if Fraction2 > 1 then Fraction2 = 1 end  
  7.   if Fraction2 < 0 then Fraction2 = 0 end

  8.   local width = WindowTextWidth (win, font_id, sPrompt);
  9.   local orgVertical = vertical;


  10.   WindowText (win, font_id, sPrompt, GAUGE_LEFT - width, vertical, 0, 0, FONT_COLOUR)
  11.   vertical = orgVertical + (font_height - GAUGE_HEIGHT) / 2; -- adjust entire box
  12.   WindowRectOp (win, 2, GAUGE_LEFT, vertical, WINDOW_WIDTH - 5, vertical + GAUGE_HEIGHT,  BACKGROUND_COLOUR)  -- fill entire box

  13.   local gauge_width = (WINDOW_WIDTH - GAUGE_LEFT - 5) * Fraction
  14.   -- box size must be > 0 or WindowGradient fills the whole thing
  15.   if math.floor (gauge_width) > 0 then
  16.     -- top half   
  17.     WindowGradient (win, GAUGE_LEFT, vertical, GAUGE_LEFT + gauge_width,
  18.                     vertical + GAUGE_HEIGHT / 2, 0x000000, Colour, 2)
  19.     -- bottom half   
  20.     WindowGradient (win, GAUGE_LEFT, vertical + GAUGE_HEIGHT / 2,
  21.                     GAUGE_LEFT + gauge_width, vertical +  GAUGE_HEIGHT, Colour, 0x000000, 2)
  22.   end -- non-zero
  23.   local gauge_width2 = (WINDOW_WIDTH - GAUGE_LEFT - 5) * Fraction2
  24.   -- box size must be > 0 or WindowGradient fills the whole thing  
  25.   if math.floor (gauge_width2) > 0 then
  26.     -- top half   
  27.     WindowGradient (win, GAUGE_LEFT + gauge_width, vertical, GAUGE_LEFT + gauge_width2,
  28.                     vertical + GAUGE_HEIGHT / 2, 0x000000, Colour2, 2)
  29.     -- bottom half
  30.     WindowGradient (win, GAUGE_LEFT + gauge_width, vertical + GAUGE_HEIGHT / 2,
  31.                     GAUGE_LEFT + gauge_width2, vertical +  GAUGE_HEIGHT, Colour2, 0x000000, 2)
  32.   end -- non-zero

  33.   -- show ticks  local ticks_at = (WINDOW_WIDTH - GAUGE_LEFT - 5) / (NUMBER_OF_TICKS + 1)
  34.   -- ticks  
  35.   for i = 1, NUMBER_OF_TICKS do   
  36.     WindowLine (win, GAUGE_LEFT + (i * ticks_at), vertical,
  37.                 GAUGE_LEFT + (i * ticks_at), vertical + GAUGE_HEIGHT, ColourNameToRGB ("silver"), 0, 1)
  38.   end -- for
  39.   -- draw a box around it  
  40.   check (WindowRectOp (win, 1, GAUGE_LEFT, vertical, WINDOW_WIDTH - 5, vertical + GAUGE_HEIGHT,
  41.          ColourNameToRGB ("lightgrey")))  -- frame entire box
  42.   vertical = orgVertical + font_height + 2
  43. end -- function
复制代码

[ 本帖最后由 vase 于 2009-12-29 12:58 AM 编辑 ]
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2009-12-29 01:02:58 | 显示全部楼层
傳個完整的吧..

本帖子中包含更多资源

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

x
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2009-12-29 01:05:29 | 显示全部楼层
WindowText (win, font_id, sPrompt, GAUGE_LEFT - width, vertical, 0, 0, FONT_COLOUR)


没有对是否使用UTF-8做设定,默认的话应该是false。
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-24 07:36 PM , Processed in 0.011050 second(s), 13 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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