Everyone who has never used our Bots before, can test each one for 2 days without any limitation.
The trial is given automatically when you login on the Bot, but in some cases it wouldn't work (security reasons).
If this happens, send me a private message and i will be checking the failed trials manually and adding it for those who didn't get it.
We are looking for resellers who may accept payment methods different from ours, including classictibia's cash, realesta's cash, mastercores' cash, etc. Interested? Click here at anytime.



Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
npc message
#1
hello, i need a script that verifies the message that npc sent me, if it is the correct message it will advance to a label. Obs, I tested the scripts you have on the forum and none worked
Reply

#2
Hello.

Use getnewmessages() on a loop. This function returns the new messages on the current selected channel since last run, the first run will always return empty. Also if you change channels the first run will return empty as well.
So if you are going to say something to npc and check for its answer then you must call getnewmessages() BEFORE you speak.

Example:
local NPC_NAME = 'Dove'
local MSG_CHECK = 'Be greeted, noble ' .. name() .. '.'

getnewmessages() -- calling it now to make sure you get only fresh messages after speaking to npc.

say('hi')
wait(800, 1200)

local NPC_REPLIED_BACK = false
NPC_NAME = NPC_NAME:lower()
local msgs = getnewmessages()
for _, msg in ipairs(msgs) do
    if msg.sender:lower() == NPC_NAME and msg.content == MSG_CHECK then
        NPC_REPLIED_BACK = true
        break
    end
end

if NPC_REPLIED_BACK then
    say('buy parcel')
    wait(500, 800)
    say('yes')
    wait(500, 800)
end
Reply

#3
not work =\
Reply

#4
Hello.

Yes, it works. But you must selected default channel and the msg should be EXACTLY the same.
Reply

#5
i try to figure out how it work im trying something for postman quest and i need to said hi measurements yes yes yes to the npc until i got this message "Olrik: Ok, here we go ... 6! You have won! How lucky you are! So listen ...<tells you what you need to know>" but it can take several time to get it thank you
Reply

#6
|Only Registered members can see download links. | Click here to buy subscription or here to register.

Same way script above does, but use create a loop to say those words and check for npc's answer. If correct message found then exit loop.
Reply



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016