| 本帖最后由 weyl 于 2011-3-23 23:53 编辑 
 需要修改源码的部分:
 
 kys_event.pas:实现部分的uses添加kys_script;增添50 60指令的解释。
 kys_main.pas:接口部分的uses删除原来的脚本系统,增添lua,在run增加脚本初始化和释放,在quit增加脚本释放。复制代码
     60: //Call scripts.
      begin
        e2 := e_getvalue(0, e1, e2);
        e3 := e_getvalue(1, e1, e3);
        execscript(pchar(inttostr(e2) + '.lua'), pchar('f' + inttostr(e3)));
      end;
在CommonScrollMenu最前添加:
 举例:复制代码
  if max + 1 < maxshow then
    maxshow := max + 1;
读取所有物品并制成菜单:
 复制代码
function f2()
  s = {};
  n = 0;
  for i=0,199 do
    x, y = getitemlist(i);        
        if y <= 0 then
          break;
        end;
        --showstring(100,100,"sdfdss");
        n = n + 1;
        s[i+1] = string.format("%s%5d", getnameasstring(1, x), y);
  end;
  a = menu(n, 100, 100, 170, s);
end
复制代码  talk(16, 1, "下面你可以在5秒鐘之內移動鼠標,將會即時顯示鼠標的位置。*如果想中間退出的話,按任意的鍵即可。");
  t = gettime();
  clearbutton();
  while gettime() - t <= 5 do
   x, y = getmouseposition();
   clear();    
   showstring(100, 70, x..", "..y);
    if checkbutton() > 0 then
      pause();
      break;
    end;  
  end;
  clearbutton();
  talk(17, 5, "演示完畢,給錢。");
 |