
1.Bot sleep until received mail and then go to mailbox
2.For example we have determined the password with somebody..My bot wait received whisper,when he whispered me e.g"moneysend" bot open portable mail box and send money


Code: Select all
this.Enter = function(self)
local number = UMMSettings:NewMail();
if (number ~= nil) then
if (number > 0) then
GameTooltip:ClearLines();
GameTooltip:ClearAllAnchors();
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT", 0, 0);
GameTooltip:AddLine("|cff"..UMMColor.Header..UMM_NOTIFY_TOOLTIP_TITLE.."|r");
if (number == 1) then
GameTooltip:AddLine("|cff"..UMMColor.Bright..UMM_NOTIFY_TOOLTIP_NEWMAIL.."|r");
else
GameTooltip:AddLine("|cff"..UMMColor.Bright..string.format(UMM_NOTIFY_TOOLTIP_NEWMAILS, number).."|r");
end
GameTooltip:AddLine("|cff"..UMMColor.Dark..UMM_NOTIFY_TOOLTIP_MOVETIP.."|r");
GameTooltip:Show();
end
end
end;
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
local mypassword = "rightpassword"
EventMonitorStart("WhisperNotify", "CHAT_MSG_WHISPER");
repeat
yrest(1000)
-- Check for whisper
local time, moreToCome, name, msg = EventMonitorCheck("Whisper", "4,1")
if moreToCome ~= nil then
local password, command, value = string.match(msg,"(%w) (%s):(%w)")
if password == mypassword then
if command == "sendmoney" then
UMM_SendMoney(name, tonumber(value))
-- elseif command == "othercommand" then
-- do other action
end
end
end
-- Check for new mail
local newmail = RoMScript("UMMSettings:NewMail()")
if newmail and newmail > 0 then
UMM_TakeMail()
end
until false
</onload>
</waypoints>
rock5 wrote:Try this to receive whisper commands.If someone whispers to this character "rightpassword sendmoney:200000", it will send 200000 gold to them. Note: untested. Can be used to send other commands that do other actions too.Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints> <onload> local mypassword = "rightpassword" EventMonitorStart("WhisperNotify", "CHAT_MSG_WHISPER"); repeat yrest(1000) -- Check for whisper local time, moreToCome, name, msg = EventMonitorCheck("Whisper", "4,1") if moreToCome ~= nil then local password, command, value = string.match(msg,"(%w) (%s):(%w)") if password == mypassword then if command == "sendmoney" then UMM_SendMoney(name, tonumber(value)) -- elseif command == "othercommand" then -- do other action end end end -- Check for new mail local newmail = RoMScript("UMMSettings:NewMail()") if newmail and newmail > 0 then UMM_TakeMail() end until false </onload> </waypoints>
Will also take mail when new mail is received.
If you want these functions for separate bots then just split the 2 functions into separate repeat loops in separate files.
Code: Select all
<onload>
repeat
local newmail = RoMScript("UMMSettings:NewMail()")
if newmail and newmail > 0 then
loadPaths("tier");
else
player:sleep();
end
until false
</onload>
rock5 wrote:You might want to put a yrest in there to lower it's cpu use.
I don't think you want it to go to sleep. It will go to sleep as soon as you start it then wont wake up until you press the resume key.
Edit: Also, for the loaded file to run I think this file has to finish. So, it has to exit this onload. You can do that by adding a "return" just after loading the new file.
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
repeat
local newmail = RoMScript("UMMSettings:NewMail()")
if newmail and newmail > 0 then
yrest(5000);
loadPaths("tier");
return;
else
yrest(500);
end
until false
</onload>
</waypoints>
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
local mypassword = "1"
EventMonitorStart("WhisperNotify", "CHAT_MSG_WHISPER");
repeat
yrest(1000)
-- Check for whisper
local time, moreToCome, name, msg = EventMonitorCheck("Whisper", "4,1")
if moreToCome ~= nil then
local password, command = string.match(msg,"(%w) (%s)")
if password == "mypassword" then
if command == "2" then
player:target_Object("Mailbox",1000)
UMM_SendMoney(name, 10000)
end
end
end
until false
</onload>
</waypoints>
Code: Select all
local password, command = string.match(msg,"(%w*) (%w*)")
Code: Select all
if password == mypassword then
thanks master ill try it ^_^ i am patching now..rock5 wrote:When you start the monitor event you called it "WhisperNotify" but then you check event "Whisper". The names don't match.
The pattern, used to get the command, uses %s which only allows letters for commands. If you want to use numbers as commands use %w which allows letters or numbers or %d that allows only numbers. Also I made a mistake previously, %w or %s only represents 1 character. It needs to be followed by a * to mean any number of characters, eg.The idea of the variable mypassword is that you can conveniently change your password at the top of the file. You don't compare the password to this variable though, you compare it to a string "mypassword". It's supposed to beCode: Select all
local password, command = string.match(msg,"(%w*) (%w*)")
And when you whisper, you should use the value you gave mypassword at the top of the file as the password.Code: Select all
if password == mypassword then
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
local mypassword = "mypass"
EventMonitorStart("WhisperNotify", "CHAT_MSG_WHISPER");
repeat
yrest(1000)
-- Check for whisper
local time, moreToCome, name, msg = EventMonitorCheck("WhisperNotify", "4,1")
if moreToCome ~= nil then
local password= string.match(msg,"(%w*)")
if password == mypassword then
UMM_SendMoney(name, 10000)
end
end
until false
</onload>
</waypoints>
Code: Select all
<onload>
repeat
local newmail = RoMScript("UMMSettings:NewMail()")
if newmail and newmail > 0 then
yrest(500);
loadPaths("Alisveris");
return;
else
loadProfile()
end
until false
</onload>
Code: Select all
<onload>
repeat
local newmail = RoMScript("UMMSettings:NewMail()")
yrest(500);
if newmail and newmail > 0 then
loadPaths("Alisveris");
return;
else
print("Still waiting...")
end
until false
</onload>
Okey..this code loads Bekleme.xmlrock5 wrote:Is this the repeat that doesn't repeat? I wouldn't use loadProfile() to see if it's working. Use a print message.You should probably also show me the code that loads this file.Code: Select all
<onload> repeat local newmail = RoMScript("UMMSettings:NewMail()") yrest(500); if newmail and newmail > 0 then loadPaths("Alisveris"); return; else print("Still waiting...") end until false </onload>
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
local mypassword = "Sendburo"
EventMonitorStart("WhisperNotify", "CHAT_MSG_WHISPER");
repeat
yrest(1000)
-- Check for whisper
local time, moreToCome, name, msg = EventMonitorCheck("WhisperNotify", "4,1")
if moreToCome ~= nil then
local password= string.match(msg,"(%w*)")
if password == mypassword then
RoMScript("/run OpenMail();")
UMM_SendByNameOrId(name,{"Mana Stone"})
UMM_SendByNameOrId(name,{"Recall Belt"})
UMM_SendByNameOrId(name,{"Random Fusion Stone"})
UMM_SendMoney(name, 20000)
RoMScript("MailFrame:Hide()");
loadPaths("Bekleme");
end
end
until false
</onload>
</waypoints>
Code: Select all
loadPaths("Bekleme");
return
Damn you said before.i forgot.Thanks master.i am going to tryrock5 wrote:I don't see an exit to the loop. Try adding a returnThat will exit the onload and allow Bekleme to run.Code: Select all
loadPaths("Bekleme"); return
rock5 wrote:You might want to put a yrest in there to lower it's cpu use.
I don't think you want it to go to sleep. It will go to sleep as soon as you start it then wont wake up until you press the resume key.
Edit: Also, for the loaded file to run I think this file has to finish. So, it has to exit this onload. You can do that by adding a "return" just after loading the new file.
Users browsing this forum: No registered users and 9 guests