Version 1.1 - crash bug fix and more advanced bot

This commit is contained in:
OTCv8
2019-11-03 19:20:48 +01:00
parent e65bdb534a
commit 6b5edaf6c8
12 changed files with 191 additions and 15 deletions

View File

@@ -94,6 +94,33 @@ context.onContainerUpdateItem = function(callback)
return context.callback("onContainerUpdateItem", callback)
end
-- onMissle -- callback = function(missle)
context.onMissle = function(callback)
return context.callback("onMissle", callback)
end
-- onChannelList -- callback = function(channels)
context.onChannelList = function(callback)
return context.callback("onChannelList", callback)
end
-- onOpenChannel -- callback = function(channelId, name)
context.onOpenChannel = function(callback)
return context.callback("onOpenChannel", callback)
end
-- onCloseChannel -- callback = function(channelId)
context.onCloseChannel = function(callback)
return context.callback("onCloseChannel", callback)
end
-- onChannelEvent -- callback = function(channelId, name, event)
context.onChannelEvent = function(callback)
return context.callback("onChannelEvent", callback)
end
-- CUSTOM CALLBACKS
-- listen(name, callback) -- callback = function(text, channelId, pos)

View File

@@ -58,8 +58,26 @@ context.walk = function(dir) return modules.game_walking.walk(dir) end
context.turn = function(dir) return g_game.turn(dir) end
-- game releated
context.getChannels = function()
-- return { channelId = channelName }
return modules.game_console.channels
end
context.getChannelId = function(name)
for id, channel in pairs(context.getChannels()) do
if name:lower() == channel:lower() then
return id
end
end
return nil
end
context.say = g_game.talk
context.talk = g_game.talk
context.yell = function(text) g_game.talkChannel(3, 0, text) end
context.talkChannel = function(channel, text) g_game.talkChannel(7, channel, text) end
context.sayChannel = context.talkChannel
context.talkPrivate = function(receiver, text) g_game.talkPrivate(5, receiver, text) end
context.sayPrivate = g_game.talkPrivate
context.saySpell = function(text, lastSpellTimeout)
if context.lastSpell == nil then
@@ -80,8 +98,6 @@ context.setSpellTimeout = function()
context.lastSpell = context.now
end
context.talkPrivate = g_game.talkPrivate
context.sayPrivate = g_game.talkPrivate
context.use = g_game.useInventoryItem
context.usewith = g_game.useInventoryItemWith
context.useWith = g_game.useInventoryItemWith
@@ -94,4 +110,5 @@ context.cancelFollow = g_game.cancelFollow
context.cancelAttackAndFollow = g_game.cancelAttackAndFollow
context.logout = g_game.forceLogout
context.ping = g_game.getPing
context.ping = g_game.getPing