脚本范例:
脚本调用LUA
格式:CALLLUA 参数1 参数2
参数1:LUA文件名(文件必须放在Market_Def目录下,更新LUA文件重读NPC即可)
参数2:@调用LUA函数,向LUA脚本发送数据
注:向LUA发送数据用小写逗号,支持变量。保存LUA文件格式必须为(GB2312、ANSI)否则含有中文会乱码
示例一:
;==========================================
[@Main]
#IF
#ACT
;调用script.lua中的message函数
CallLua script @message
;==========================================
;LUA脚本示例
function message(player)
sendmsg(player,1,'{"Msg":"打印测试","FColor":255,"BColor":0,"Type":1,"Time":3,"SendName":"xxx","SendId":"123"}')
end
;==========================================
示例二:
;==========================================
[@Main]
#IF
#ACT
;调用script.lua中的message函数
MOV S$lua文件 script
MOV S$lua函数 message
MOV S$发送数据 1000
CallLua <$str(S$lua文件)> @<$str(S$lua函数)>,<$str(S$发送数据)>
;==========================================
;LUA脚本示例
function message(player,ss)
for i = 1, 100 do
ss = ss + 1
sendmsg(player,1,'{"Msg":"'..ss..'","FColor":255,"BColor":0,"Type":1,"Time":3,"SendName":"xxx","SendId":"123"}')
end
end