|
-- robot script (login)登陆
robotVer = "11"
robotInterval = 2000
-- set random seed to time
math.randomseed(os.time())
function Hello()
print("Lua: Hello Robot version", robotVer)
LuaI.HelloWorld()
end
function EnterMap(map, character)
-- force to do move action after enter map
--print("Lua EnterMap:")
end
function MapAction(map, character)
--print("Lua MapAction", map, character)
if map == nil or character == nil then
print("Lua MapAction Error: nil map or character")
return
end
--[[ local r = math.random(0, 99)
if r < 3 then
DoCommand("disconnect")
return
end]]
end
function DoCommand(cmd)
--print(string.format("Lui Execute: %s", cmd))
LuaI.Execute(cmd)
end
function AccountAction()
--local r = math.random(0, 99)
local cmd = nil
-- 50%: login
--if r < 50 then
cmd = "login"
--end
if cmd then DoCommand(cmd) end
end
上面是一个简单的登陆脚本,是用LUA写的,让所有模拟的机器人自动登陆,测试登陆服务器的压力问题 |
|