Zelek
-
Posts
669 -
Joined
-
Last visited
-
Days Won
75
Posts posted by Zelek
-
-
You can download it here: OTClientBot-v2.0.0-beta15b
Also please remember to install Visual C++ Redistributable for Visual Studio 2015 - 2019 x86 if you haven't already.
Added in beta 15b:
- added possibility to change process name to look for while selecting the client
- optimization improvements for targeting
- updated lua version to 5.4.1
Known issues:
-
creatures and containers aren't read properly-- fixed in beta 15a -
onTalkMessage and onTextMessage events can cause the application to crash-- fixed in beta 15b -
"Check only targeting creatures" also counts creatures that are disabled-- fixed in beta 15b
List of changes:
- fixed a bug that occasionally caused targeting and cavebot to crash the application
- fixed a bug that prevented reading text and talk messages that contains special characters
- fixed a bug that prevented reading creature names that contains special characters
- removed TalkMessage and TextMessage userdata from lua interface (all of the scripts that you have used with those will stop to work)
-
added two game events (usage example in the next point):
- g_game.onTextMessage(number mode, string message)
- g_game.onTalkMessage(string name, number level, number mode, string message, number channelId, Position creaturePos)
-
added new lua functions:
-
connect(string class, string event, function callback) -- connects specific event to the lua callback function:
-
auto(100) connect("g_game", "onTextMessage", onTextMessage) function onTextMessage(mode, message) print("mode: " .. mode .. ", message: " .. message) end
-
- disconnect(string class, string event) -- disconnects every callback from the specified event
-
connect(string class, string event, function callback) -- connects specific event to the lua callback function:
- updated "Anti Idle.lua" to respect above changes
-
@lediv I've found the issue. It seems like any message that contains special characters isn't read properly right now.
I'll try to fix it as soon as possible.
- 1
-
done
-
if not g_game.isOnline() then return end local messageToDetect = {"msgheck", "bot"} local lastMessage = g_game.lastTextMessage().message if not lastMessage then return end for v, k in pairs(messageToDetect) do if string.find(lastMessage, k, 1, true) then g_game.talk("im here") -- message to talk in default chat setOption("Global/BotPaused", "true") g_game.lastTextMessage().message = "" for i = 1, 5 do playSound("alarm.wav") sleep(1000) end end end auto(50)
It may be that they changed how things works, but I highly doubt that.
- 1
-
@lediv you can easily change the color of any message, it isn't an indicator of anything.
- 1
-
30 minutes ago, lediv said:
no the bot check in dbl is a system message (tho this system message that appers in red is caused when a banner uses specific command) but it's for sure not a normal massage. I'll try with this function you mentioned maybe it will work that way but where do I edit? which line?
I've already confirmed few months ago with a friend of one of the GMs at DBL that it is indeed a normal message, just without a name.
We have used this script to determine it:
print(#getTalkMessages()) for v, k in pairs(getTalkMessages()) do if k.mode ~= 43 then print(v .. ": " .. k.sender .. ": " ..k.text) end end
(Please mind that it's the previous api, but the internals didn't change)
And we got this as a result:
34: : [English] GM XXX is checking if you are using a bot. Please answer him on msgheck chat, on default chat or by private message. 35: : [Polish] GM XXX sprawdza czy uzywasz bota. Prosimy abys odpowiedzial mu na msgcheck chacie, na default chacie lub w prywatnej wiadomosci.
If it weren't a "talk message" it wouldn't appear in the logs.
-
As far as I know the bot check at DBL isn’t a system message, it’s normal message on a channel. If you want to check for system messages use g_game.lastTextMessage() instead. Maybe you were just unlucky and someone send a message on one of the open channels you had or you have sent a spell in the 50 millisecond window it takes it to refresh the script which would cause the last talk message to get overwritten.
-
16 hours ago, nowskivip said:
Instant bot crash after enabling this script 😐 read map tiles is on ;-; (tried on rots)
It works fine for me, however I've made some changes so let me know if it still crashes the bot for you with beta14
- 1
-
You can download it here: OTClientBot-v2.0.0-beta14b
Also please remember to install Visual C++ Redistributable for Visual Studio 2015 - 2019 x86 if you haven't already.
Known issues:
-
Application can crash while "open next BP", "eat food from corpses" or "open BP at login" is enabled.-- fixed in beta 14a - Application can crash while executing lua script with directly accessed Creatures/Items/Containers/Tiles iterator (for example: "for _, creature in pairs(g_game.getCreatures()) do" would trigger lua's garbage collector and could lead to a crash) -- it is your responsibility to avoid this type of usage
-
g_game.moveItem doesn't work on map items-- fixed in beta 14a -
lua scripts are getting prepended with 'require "libs/main"'-- fixed in beta 14a -
Local Player information could not be read correctly in some rare cases-- fixed in beta 14a -
Application can crash while loading lua scripts from a save file-- fixed in beta 14a -
Item healer doesn't work with items that can be used with a crosshair-- fixed in beta 14b
Added in beta 14b:
-
getOption and setOption functions can now set/get persistent and cavebot specific script enabled value by name. Example below:
-
if getOption("Scripts/Persistent/Change GPs/Enabled") == "true" then setOption("Scripts/Persistent/Change GPs/Enabled", "false") else setOption("Scripts/Persistent/Change GPs/Enabled", "true") end
-
List of changes:
- fixed a bug that sometimes prevented application from starting up correctly
- fixed a bug that sometimes caused lua scripts to crash the application
- fixed a bug that sometimes caused targeting to crash the application
-
added new lua functions:
- g_game.buyItem(number itemId, number count, [bool ignoreCapacity = false], [bool buyWithBackpack = false])
- g_game.sellItem(number itemId, number count, [bool ignoreEquipped = false])
-
added default libs that are automatically loaded with each script:
- main.lua -- responsible for loading other default libs
- table.lua -- contains various helper functions to work on tables
- position.lua -- contains various helper functions to work on Position object
- string.lua -- contains various helper functions to work on strings
- added ability to select specific floor to read tiles from (Info & options tab)
-
-
1 hour ago, nowskivip said:
Hey Zelek is this possible to create alert for item on screen? like if X item appears on screen bot will play alarm or something like this?
auto(100) local idsToFind = {3031, 3035} -- items ids to find local tiles = g_map.getTiles() for _, tile in pairs(tiles) do local topItem = tile:getTopItem() if topItem then for _, id in pairs(idsToFind) do if topItem:getId() == id then playSound("alarm.wav") sleep(1000) return end end end end
Remember to enable "Read map tiles" in Info & options tab.
- 1
-
21 hours ago, lediv said:
yeah that would do the job, but I lack scripting skills so if you'd have time to write something like that, I'd much appreciate. Hovever It'd have to work like that: where there are no monsters on screen the bot would only use item on dead bodies and pause cavebot, after after there are no bodies, he would turn on cavebot again. Is that possible? If that is too demanding to write that script or it's not possible than no problem it's not as necessary. It's just that on the ots I play it's a great way to earn money so it'd help
auto(100) local corpseIds = {296, 4133} -- ids of bodies local itemIdToUse = 3456 -- id of the item to use on bodies function table.find(t, value) for k,v in pairs(t) do if v == value then return k end end end local tiles = g_map.getTiles() local corpses = {} for _, tile in pairs(tiles) do if tile:getPosition():getDistance(g_game.getLocalPlayer():getPosition()) <= 1 then local topItem = tile:getTopItem() if topItem and table.find(corpseIds, topItem:getId()) then table.insert(corpses, topItem) end end end if #corpses > 0 then for _, corpse in pairs(corpses) do setOption("Cavebot/Enabled", "false") g_game.stop() g_game.useItemOnPosition(itemIdToUse, corpse:getPosition()) sleep(1000) end else setOption("Cavebot/Enabled", "true") end
Remember to enable "Read map tiles" in Info & options tab.
- 1
-
@ledivdoes the body disappear after using specific item on it?
-
21 hours ago, lediv said:
Is Script to use hotkey for example f12 on monster's dead body possible while standing 1sqm next to it?
Using hotkey at specified position is not supported.
However you can use for example "g_game.useItemOnPosition(itemId, position)"
-
7 hours ago, asktheages said:
Dear Zelek,
Could you tell me how to set the X Y Z properly? If i put a certain value it wont work as intended. I need a range - lets say X range 931 - 999 , Y - 700-750 (so the box goes around all the respawn where i cavebot). Thanks
function Position:isInRange(from, to) local zone = { nW = { x = (from.x < to.x and from.x or to.x), y = (from.y < to.y and from.y or to.y), z = (from.z < to.z and from.z or to.z) }, sE = { x = (to.x > from.x and to.x or from.x), y = (to.y > from.y and to.y or from.y), z = (to.z > from.z and to.z or from.z) } } if self.x >= zone.nW.x and self.x <= zone.sE.x and self.y >= zone.nW.y and self.y <= zone.sE.y and self.z >= zone.nW.z and self.z <= zone.sE.z then return true end return false end local fromPos = Position.new(123, 456, 7) -- top left corner local toPos = Position.new(321, 654, 7) -- bottom right corner local playerPos = g_game.getLocalPlayer():getPosition() if not playerPos:isInRange(fromPos, toPos) then playSound("alarm.wav") if getOption("Global/BotPaused") == "false" then setOption("Global/BotPaused", "true") sleep(300000) end if getOption("Global/BotPaused") == "true" then setOption("Global/BotPaused", "flase") end end auto(500)
-
13 hours ago, victinhods said:
I need this hotkey...
if idletiime => 20 seconds
gotolabel xxxx
if g_game.getIdleTime() >= 20000 then gotolabel("Waypoints", "label") -- edit this end
-
44 minutes ago, Gregorian said:
I can't search in forum scrypt for targeting on/off in hotkeys.
if getOption("Targeting/Enabled") == "true" then setOption("Targeting/Enabled", "false") else setOption("Targeting/Enabled", "true") end
Above script will make the bot non responding, please don't use getOption and setOption in hotkeys until I fix that.
-
It seems like it just doesn't work on that server then, I'll take a look at it though
-
@BlokuJrHave you tried setting walking method to arrow keys instead of map clicks?
-
I have no idea what WED Server is, could you link a website?
Also alerts work if you don't load settings from beta12, I'm working on fixing that tho.
-
-
1 minute ago, lediv said:
hmm It doesnt exactly work as I imagined, i forgot that targeting doesnt just switch off like that when the bot walks. Maybe there is a possibility to keep those walk delays but not with cavebot/targeting on/off but while we attack a monster and while we do not attack anything?
if g_game.isAttacking() then setOption("Cavebot/WalkDelay", "200") else setOption("Cavebot/WalkDelay", "25") end auto(100)
- 1
-
33 minutes ago, lediv said:
If targetting enable and cavebot enable set walk delay with arrow keys to 200 if targeting disabled set arrow keys walk to 25 is that possible? It would make the bot look much more human-like with the new lure mode wchich is extremaly good new function
if getOption("Targeting/Enabled") == "true" and getOption("Cavebot/Enabled") == "true" then setOption("Cavebot/WalkDelay", "200") elseif getOption("Targeting/Enabled") == "false" then setOption("Cavebot/WalkDelay", "25") end auto(100)
-
@ledivrestart both client and bot and it will be fine
- 1
-
@lediv I believe I've fixed the issue in beta13b, let me know if you still have problems
Bot still doesn't see system messages
in Bug Reports
Posted