Page 22 of 39

Re: Rock5's Mail Mods

Posted: Sat May 25, 2013 12:26 am
by rock5
Good work. I should have remembered about the find issue, we've come across it before. Another way to deal with the '-' is to replace it with '.' which means "any character". This is something all users who have hyphens in their language need to be aware of. If you are using a userfunction or command and it doesn't recognise the non-alpha characters in your string, try replacing them with '.'

If we want to really make it universal we should probably leave the find command as it was because I was just checking some other languages and Polish eggs seem to be named "Egg <something> Pet" so with the pattern matching enabled they could use

Code: Select all

textInAllEggNames = "Jajo .* Zwierzątka"
I couldn't find a language string for just "Egg Pet" but we could add multilanguage support like this.

Code: Select all

local lang = bot.ClientLanguage
local textInAllEggNames 
if lang == "EN" then
    textInAllEggNames = "Egg Pet"
elseif lang == "DE" then
    textInAllEggNames = "Begleiter.Ei"
elseif lang == "PL" then
    textInAllEggNames = "Jajo .* Zwierzątka"
etc.

Re: Rock5's Mail Mods

Posted: Sat May 25, 2013 1:07 am
by rock5
Another way to make it multilingual is to consider that there are only 6 egg pet name. We could get the local names and compare against all of them.

Code: Select all

local eggnames = {
    [1] = getIdName(204476), -- Wild Pet Egg
    [2] = getIdName(204482), -- Natural Pet Egg
    [3] = getIdName(204488), -- Amazing Pet Egg
    [4] = getIdName(204494), -- Magical Pet Egg
    [5] = getIdName(204500), -- Holy Pet Egg
    [6] = getIdName(204506), -- Rune Pet Egg
}

local function IsPetEgg(name)
    for k,v in pairs(eggnames) do
        if v == name then
            return true
        end
    end
    return false
end

function sendEggsByLevel(_recipient, lowest, highest)
	local sendlist          = {}   -- Make table of items to send

	for item = 61, 240, 1 do -- for each inventory
		local slotitem = inventory.BagSlot[item];
		local eggLevel = memoryReadByte(getProc(), slotitem.Address + 0x2E)
		if IsPetEgg(slotitem.Name) and eggLevel >=lowest and highest >= eggLevel then
			-- Add to table
			table.insert(sendlist, slotitem.SlotNumber)
		end
	end
	UMM_SendInventoryItem(_recipient, sendlist)
end   
I might be getting a bit carried away now. :)

Re: Rock5's Mail Mods

Posted: Sat May 25, 2013 1:23 am
by Rickster
;)

nice work.
I prefer and will use the second solution with the table of local egg names, because that way nobody has to care about entering a search string.

But everybody can freely choose from the above :)

Re: Rock5's Mail Mods

Posted: Sat May 25, 2013 8:18 am
by lisa
untested I am guessing ;)
[1] = getIdName(204476), -- Wild Pet Egg
[2] = getIdName(204482), -- Natural Pet Egg
[3] = getIdName(204488), -- Amazing Pet Egg
[4] = getIdName(204494), -- Magical Pet Egg
[5] = getIdName(204500), -- Holy Pet Egg
[6] = getIdName(204506), -- Rune Pet Egg
should be GetIdName =)

Re: Rock5's Mail Mods

Posted: Sat May 25, 2013 8:31 am
by rock5
:oops: :D Yeah probably.

Re: Rock5's Mail Mods

Posted: Sat May 25, 2013 6:31 pm
by lisa
I only noticed because I needed to use the getidname function and just copied it from here and got the call global nil error lol

Set timeout when using UMM_TakeMail()

Posted: Sat Jun 08, 2013 4:35 am
by ratzuk
When using UMM_TakeMail() bot seems to hang if backpack is full. Is there anyway to set a timeout for this function, say 60sec, where it can just give up trying to take mail and resume?

Thanks

Re: Rock5's Mail Mods

Posted: Sat Jun 08, 2013 5:44 am
by rock5
I could but what would be the point? If I make it time out what are you going to make the bot do with a full backpack after taking the mail?

Re: Rock5's Mail Mods

Posted: Sat Jun 08, 2013 10:39 am
by Alleexx
I would like to check if my characters have over 100 phirius tokens, that's easy, but then I want the bot to either write the charname to a separate file or to my belt/fusion stone sending files.

This is the waypoint I use for sending:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
      player.free_counter1 = 1;
</onLoad>
<!-- #  1 --><!--waypoint x="-5056" z="6778" y="86">	</waypoint-->
	<!-- #  1 --><waypoint x="2742" z="-1632" y="78">

     
     local tobuy = 10; 
      local beltname = RoMScript("TEXT('Sys202999_name')") -- Stones
      repeat
         local beltcount = inventory:getItemCount(202999) -- Number of stones you already have
         if beltcount >= tobuy then break end
         player:openStore("Prole");
         inventory:storeBuyItem(beltname, tobuy - beltcount)
         yrest(3000)
      until false
     
     sendMacro("CloseAllWindows()");
      inventory:update();
	  player:clearTarget()
     sendMacro("OpenMail()");  yrest(1000);
	 nameTable = {
"name",
"name"
"name"
"name"
"end"
         }
		 if nameTable[player.free_counter1] == player.Name then
    player.free_counter1 = player.free_counter1 + 1
    if player.free_counter1 > #nameTable then
        player.free_counter1 = 1
    end
end
     UMM_SendByNameOrId(nameTable[player.free_counter1], {202999},10);  yrest(1000); 
	    player.free_counter1 = player.free_counter1 + 1;
   
   if (player.free_counter1 > #nameTable) then
      player.free_counter1 = 1;
   end
     sendMacro("CloseAllWindows()");inventory:update();
     
-- Changing channel
     repeat parallelID = RoMScript("GetCurrentParallelID()"); yrest(500) until parallelID
      if (parallelID == 2) then
         sendMacro("ChangeParallelID(1);");
      else
         sendMacro("ChangeParallelID(2);");
      end
      player:rest(25); 
	     if nameTable[player.free_counter1] == "end" then
      -- Last character
      print("Last player finished.")
      player:sleep()
   end
   </waypoint>
</waypoints>
So I need to save the names in that format or I will have to copy it all separate and add "". The reason I need this is because I don't run all my characters every day so i only want to send it to those that have at least 100 tokens.
Even better would be if it could also check if the char have 200, 300, 400 tokens in which it would add the name more than once.

Re: Rock5's Mail Mods

Posted: Sat Jun 08, 2013 12:47 pm
by ratzuk
rock5 wrote:I could but what would be the point? If I make it time out what are you going to make the bot do with a full backpack after taking the mail?
The bot is the first on an account that does dailies for tokens. Each char on the account does dailies and then buys mana stones and logs on next char using the autologon function. All junk that can make T4 and above is sent to it from other accounts (Anything from 0 to 100+ items). I then tier manually using fusion.

Changing Line 198 of the mail userfunction to:

Code: Select all

until RoMScript("UMMMailManager.priv_AutoRunning") == nil or os.clock() - starttimer > 60000
Should do what I want - not had time to test yet

Re: Rock5's Mail Mods

Posted: Sat Jun 08, 2013 1:06 pm
by rock5
If the last thing you are going to bot with the character is take the mail then you fuse manually, you could just as easily take your mail manually then do your fusing.

Now if you were going to bot the fusing as well you still would want to make sure you keep enough space in your bags. You would make sure you have at least 30 spaces then collect the mail once, do the fusing, send mana stones of the correct level to the next character, make sure you still have 30 spaces then collect more mail.

I just can't see a situation while botting, where it would be ok to fill your bag with mail unless, like in your situation, you intend to stop the bot. So what I'm saying is it's usually good if the bot stops if your bags become unexpectedly full otherwise it might end up running around trying to do stuff and accomplishing nothing. On the other hand they could check whether their inventory is full after checking their mail.

I don't know. I may still do it. Let me think on it a bit more.

Re: Rock5's Mail Mods

Posted: Sat Jun 08, 2013 10:48 pm
by McGuffin
ratzuk wrote:
rock5 wrote:I could but what would be the point? If I make it time out what are you going to make the bot do with a full backpack after taking the mail?
The bot is the first on an account that does dailies for tokens. Each char on the account does dailies and then buys mana stones and logs on next char using the autologon function. All junk that can make T4 and above is sent to it from other accounts (Anything from 0 to 100+ items). I then tier manually using fusion.
Just as an aside, T5 is pretty much the min now I think. At least on the "official" servers. All of the drops in Syrbal make T5 and the drop rates are pretty insane. 6 bags of T5 stuffs in about 100 minutes. The instances drop clean greens that make clean T5s.

As for your problem, you could add a check before getting mail like lisa'a bagckeck function in the <onload> section...

Code: Select all

	function bagcheck()
		if 31 >= inventory:itemTotalCount(0) then
			skip over getting mail with __WPL:setWaypointIndex(__WPL:findWaypointTag());
			or start using Rock's fusion control userfunction.
		end
	end
Call bagcheck() before you get the mail. I used 31 because if you fill your bag exactly then the empty mails will not be deleted by the addon (not the mod).

Re: Rock5's Mail Mods

Posted: Mon Jun 17, 2013 10:16 am
by delay84
Hi there,

i edited the userfunction to send Tier 5 Items.

Code: Select all

                        -- Calculate tier level
			local tier = 1
			if level >= 20 and level <= 39 then
				tier = 2
			elseif level >= 40 and level <= 59  then
				tier = 3
			elseif level >= 60 and level <= 79  then
				tier = 4
			elseif level >= 80 and level <= 99  then
				tier = 5
			end


Now I can send the items with:

Code: Select all

UMM_SendAdvanced("recipient", nil, 1, 74, nil, nil, nil, nil,20,nil,5)

Re: Rock5's Mail Mods

Posted: Mon Jun 17, 2013 10:55 am
by rock5
Ok, I'll add it to my next update.

Re: Rock5's Mail Mods

Posted: Wed Jun 19, 2013 3:25 am
by gloover
Hey rock.

Code: Select all

local eggLevel = memoryReadByte(getProc(), slotitem.Address + 0x2E)
is to detect the egg-level. Wich address is to detect the egg element (wind, darkness...)

thx in advance

Re: Rock5's Mail Mods

Posted: Wed Jun 19, 2013 4:33 am
by rock5
Looks like 0x2D

Code: Select all

eggElement = memoryReadByte(getProc(), slotitem.Address + 0x2D)
The values I can confirm are
0 = Earth
3 = Wind
4 = Light

You can work out the rest.

Re: Rock5's Mail Mods

Posted: Wed Jun 19, 2013 5:06 am
by gloover
great, that is it - 10q very much!

Re: Rock5's Mail Mods

Posted: Sat Jun 22, 2013 5:10 am
by Rickster
Hi,

the postbox at Hyern In Syrbalpass can not be found by the userfunction.
Something wrong at my side or can we solve this?

Thanx,
Ric

Re: Rock5's Mail Mods

Posted: Sat Jun 22, 2013 7:31 am
by rock5
All mailboxes have the floating mail icon above them with the same id. That's how the userfunction finds the mail box. But the one in Hyern doesn't have it so it doesn't find the mailbox. I'll have to add an exception for it. Easy enough. Are there any other mailboxes in Syrbal Pass?

Re: Rock5's Mail Mods

Posted: Sat Jun 22, 2013 5:06 pm
by Rickster
No, I think this is the only mailbox there.