Jump to content

Bot still doesn't see system messages


lediv

Recommended Posts

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 by lediv
Link to comment
Share on other sites

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

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 by lediv
Link to comment
Share on other sites

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

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 by lediv
Link to comment
Share on other sites

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 by lediv
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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

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

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

×
×
  • Create New...