lediv Posted February 11, 2021 Share Posted February 11, 2021 (edited) Hey I was finally able to test this msgheck script for dbl: if not g_game.isOnline() then return end local messageToDetect = {"msgheck", "bot"} local lastMessage = g_game.lastTalkMessage().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.lastTalkMessage().message = "" for i = 1, 5 do playSound("alarm.wav") sleep(1000) end end end auto(50) Edited February 14, 2021 by lediv Link to comment Share on other sites More sharing options...
Zelek Posted February 11, 2021 Share Posted February 11, 2021 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. Link to comment Share on other sites More sharing options...
lediv Posted February 11, 2021 Author Share Posted February 11, 2021 (edited) 9 minutes ago, Zelek said: 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. 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? Edited February 11, 2021 by lediv Link to comment Share on other sites More sharing options...
Zelek Posted February 11, 2021 Share Posted February 11, 2021 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. Link to comment Share on other sites More sharing options...
lediv Posted February 11, 2021 Author Share Posted February 11, 2021 (edited) On 2/11/2021 at 1:08 PM, Zelek said: 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 April is checking if you are using a bot. Please answer him on msgheck chat, on default chat or by private message. 35: : [Polish] GM April 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. Edited February 14, 2021 by lediv Link to comment Share on other sites More sharing options...
Zelek Posted February 11, 2021 Share Posted February 11, 2021 @lediv you can easily change the color of any message, it isn't an indicator of anything. 1 Link to comment Share on other sites More sharing options...
lediv Posted February 11, 2021 Author Share Posted February 11, 2021 (edited) 5 minutes ago, Zelek said: @lediv you can easily change the color of any message, it isn't an indicator of anything. ehh. But the bot has always been respodning to any messages and when banner checked me it did not so I dont know why is that - it's pretty weird then. A situtation when he didn't respond never happened to me before because I copied this script a few times so it responds to various messages from other players. That's why I thought it must be a system message but if it's not then well, sad, seems like it just doesnt work because it does not. dunno. Edited February 11, 2021 by lediv Link to comment Share on other sites More sharing options...
Zelek Posted February 11, 2021 Share Posted February 11, 2021 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 Link to comment Share on other sites More sharing options...
lediv Posted February 11, 2021 Author Share Posted February 11, 2021 Just now, Zelek said: 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. I'll let you know as soon as a banner checks me if it works Link to comment Share on other sites More sharing options...
Zelek Posted February 15, 2021 Share Posted February 15, 2021 @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 Link to comment Share on other sites More sharing options...
Zelek Posted February 16, 2021 Share Posted February 16, 2021 auto(100) if not g_game.isOnline() then return end local messagesToDetect = {"[English]", "msgheck", "bot"} -- which words should it look for? local respondToMessage = false -- should it respond if trigger word is found? local messageToRespond = "im here" -- what should it respond? local pauseBot = false -- should it pause the bot? local playAlarm = true -- should it play alarm? connect("g_game", "onTalkMessage", checkBotMessage) function checkBotMessage(name, level, mode, message, channelId, creaturePos) for _, messageToDetect in pairs(messagesToDetect) do if string.find(message, messageToDetect, 1, true) then if respondToMessage then g_game.talk(messageToRespond) end if pauseBot then setOption("Global/BotPaused", "true") end if playAlarm then for i = 1, 5 do playSound("alarm.wav") sleep(1000) end end return end end end 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts