Page 1 of 1

wait mail & send whisperer

Posted: Fri Oct 25, 2013 8:38 am
by rido_knight
Hi i want to ask a strange 2 question :D

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 :D...How to do that..i didnt find anything for wait received mail or whisper :/ actually whisperer found in auto answer script but wait mail ?I only know that much English sorry for that :D thanks.good forums

Re: wait mail & send whisperer

Posted: Sat Oct 26, 2013 3:46 am
by rido_knight

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;

i found this code in UMM..how to compile for rombot ?

Re: wait mail & send whisperer

Posted: Sun Oct 27, 2013 4:52 am
by rido_knight
nobody knows :(

Re: wait mail & send whisperer

Posted: Sun Oct 27, 2013 6:29 am
by rock5
Try this to receive whisper commands.

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>
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.

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.

Re: wait mail & send whisperer

Posted: Mon Oct 28, 2013 4:36 am
by rido_knight
rock5 wrote:Try this to receive whisper commands.

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>
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.

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.

Master u are awesome thank you so much ^_^ yes i seperate this function...i change code like


-- Check for new mail

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>
but into an infinite loop :D i ll try later password mail this code so important

Re: wait mail & send whisperer

Posted: Mon Oct 28, 2013 5:03 am
by rock5
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.

Re: wait mail & send whisperer

Posted: Mon Oct 28, 2013 6:37 am
by rido_knight
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.

Yehho master it works PERFECTLY :lol: :lol: :lol: :lol: :lol: :lol: :lol:

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>

Re: wait mail & send whisperer

Posted: Mon Oct 28, 2013 6:53 am
by rock5
Yep, that should do it. :)

Re: wait mail & send whisperer

Posted: Tue Oct 29, 2013 8:08 am
by rido_knight
Hi master its me again.Today i am trying to run this code..It doesnt give compile error etc.Find whisperer name on rombot but into infinity loop.didnt send anything.I think i wrote wrong message so i changed password command still didnt send :/ Please make a magic touch on this code and begin to work :mrgreen: :mrgreen: :mrgreen: thanks

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>

Re: wait mail & send whisperer

Posted: Tue Oct 29, 2013 8:49 am
by rock5
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.

Code: Select all

         local password, command = string.match(msg,"(%w*) (%w*)")
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 be

Code: Select all

         if password == mypassword then
And when you whisper, you should use the value you gave mypassword at the top of the file as the password.

Re: wait mail & send whisperer

Posted: Wed Oct 30, 2013 10:17 am
by rido_knight
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.

Code: Select all

         local password, command = string.match(msg,"(%w*) (%w*)")
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 be

Code: Select all

         if password == mypassword then
And when you whisper, you should use the value you gave mypassword at the top of the file as the password.
thanks master ill try it ^_^ i am patching now..

Re: wait mail & send whisperer

Posted: Wed Oct 30, 2013 2:06 pm
by rido_knight
Voho :mrgreen: finaly understand :D

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>
change whispernotify line it works.I was trying to work for 3 hours.I asked a lot of question :D u bored my question so i wanted to understand how to work.change a lot things this 18 line code xD xD xD finally it works thanks master :D

Re: wait mail & send whisperer

Posted: Sat Nov 30, 2013 4:10 pm
by rido_knight
master i have problem..im using a.xml and add loadpaths("b") and b waypoint has repeat function..when goes to b from waypoint a repeat doesnt work just wait..For example i try this function again again loadpofile first time if loop come second time didnt work;

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>
      
Wait there...(i added loadprofile function to try its work or not)
Image

Re: wait mail & send whisperer

Posted: Sat Nov 30, 2013 10:08 pm
by rock5
Is this the repeat that doesn't repeat? I wouldn't use loadProfile() to see if it's working. Use a print message.

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>
You should probably also show me the code that loads this file.

Re: wait mail & send whisperer

Posted: Sun Dec 01, 2013 5:33 am
by rido_knight
rock5 wrote:Is this the repeat that doesn't repeat? I wouldn't use loadProfile() to see if it's working. Use a print message.

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>
You should probably also show me the code that loads this file.
Okey..this code loads Bekleme.xml

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>

Re: wait mail & send whisperer

Posted: Sun Dec 01, 2013 5:41 am
by rock5
I don't see an exit to the loop. Try adding a return

Code: Select all

loadPaths("Bekleme");
return
That will exit the onload and allow Bekleme to run.

Re: wait mail & send whisperer

Posted: Sun Dec 01, 2013 6:05 am
by rido_knight
rock5 wrote:I don't see an exit to the loop. Try adding a return

Code: Select all

loadPaths("Bekleme");
return
That will exit the onload and allow Bekleme to run.
Damn you said before.i forgot.Thanks master.i am going to try


EDIT:IT WORKS.THANKS A LOT !!! :mrgreen: :mrgreen: :mrgreen: :mrgreen:
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.