Page 1 of 1

How can i feed the pet?

Posted: Tue Nov 23, 2010 11:02 am
by wil32
How can i feed the pet?

Re: How can i feed the pet?

Posted: Tue Nov 23, 2010 6:40 pm
by jduartedj
wil32 wrote:How can i feed the pet?
C'MON!

there's a Meat symbol next to summon and release pet buttons!!

Re: How can i feed the pet?

Posted: Tue Nov 23, 2010 7:24 pm
by wil32
C'MON!!

WITH THE BOT!!

Re: How can i feed the pet?

Posted: Tue Nov 23, 2010 8:08 pm
by Alkaiser
I created my own custom function for pet feeding.

Code: Select all

function findItemBagSlot(itemNameOrId)
	inventory:update()
	for slot,item in pairs(inventory.BagSlot) do
		if item.Id == itemNameOrId or item.Name == itemNameOrId then
			return slot
		end
	end
end

function feedPet(_petslot, _time)
	_petslot = _petslot or 1
	local feedtime = os.difftime(os.time(), _time)
	if( feedtime < 1200 ) then
		return false
	end
	local foodslot = findItemBagSlot("Miller\'s Special Cake")
	if( foodslot == nil ) then
		return false
	else
		RoMScript("ReturnPet('".._petslot.."')")
		yrest(500)
		RoMScript("ClearPetFeedItem()")
		yrest(500)
		RoMScript("PickupBagItem(GetBagItemInfo('"..foodslot.."'))")
		yrest(500)
		RoMScript("ClickPetFeedItem()")
		yrest(500)
		feedtime = feedtime / 1200
		feedtime = math.floor(feedtime,0.5)
		printf("Feed pet %s cakes\n",feedtime)
		for i = 1, feedtime do
			RoMScript("FeedPet('".._petslot.."')")
			yrest(500)
		end
		RoMScript("ClearPetFeedItem()")
		yrest(500)
		RoMScript("SummonPet('".._petslot.."')")
		yrest(8000)
		return true
	end
end
In your waypoint file you would have something like this:

Code: Select all

<onLoad>
	timer = os.time()

	if( feedPet(1,timer) ) then
		timer = os.time()
	end
</onLoad>
OR place it at the waypoint where the feeding should take place (hopefully a safe place).

If at least 20 minutes have past, the pet in slot 1 is unsummoned, fed a Miller's Cake (one for every 20 minutes elapsed time, so if the pet was out for 40 minutes the script would feed the pet twice), and then re-summoned.
I don't consider myself to be an expert so there may be better ways to do it... but it works.

Re: How can i feed the pet?

Posted: Tue Nov 23, 2010 10:57 pm
by wil32
where do you save the function?

EDIT: must be in userfunctions.lua in the root rombot directory i think?

Re: How can i feed the pet?

Posted: Wed Nov 24, 2010 12:53 am
by Administrator
You can also create a new file in the 'userfunctions' folder named addon_whatever.lua (where 'whatever' is obviously whatever you want to name it). Paste the code there and save it.

Re: How can i feed the pet?

Posted: Wed Nov 24, 2010 7:40 pm
by wil32
it doesnt work. im a noob...

i got addon_feedPet.lua in the userfunctions folder and added this code on top of my waypoint so the first few lines look lke this

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
   timer = os.time()

   if( feedPet(1,timer) ) then
      timer = os.time()
   end
</onLoad>
	<!-- #  1 --><waypoint x="

Re: How can i feed the pet?

Posted: Thu Nov 25, 2010 8:55 am
by rock5
wil32 wrote:it doesnt work. im a noob...

i got addon_feedPet.lua in the userfunctions folder and added this code on top of my waypoint so the first few lines look lke this

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
   timer = os.time()

   if( feedPet(1,timer) ) then
      timer = os.time()
   end
</onLoad>
	<!-- #  1 --><waypoint x="
I can't see that working, as the feedpet function is run immediately after setting the timer so not enough time has passed for it to trigger. I think the way it is supposed to be set up is in the onload event you first set the timer then the rest of the code goes into a safe waypoint where it would be safe to feed the pet.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
   timer = os.time()

</onLoad>
	<!-- #  1 --><waypoint x="1" z="1">
	   if( feedPet(1,timer) ) then
	      timer = os.time()
	   end
	</waypoint>
This way every time it reaches waypoint 1, if 20 minutes has passed, it feeds the pet and resets the timer.

Re: How can i feed the pet?

Posted: Thu Nov 25, 2010 9:48 am
by Alkaiser
Oops! If I have multiple waypoint files, I handle it with this:

Code: Select all

<onLoad>
	if( player.free_counter2 == 0 ) then
		player.free_counter2 = os.time();
	end
	if( feedPet(1,player.free_counter2) ) then
		player.free_counter2 = os.time();
	end
</onLoad>
The timer value survives the transition from one waypoint file to another. In this case, the pet would be fed when this waypoint file is loaded and 20 minutes have passed since the timer was set/reset. I usually include:

Code: Select all

<onLoad>
	if( player.free_counter2 == 0 ) then
		player.free_counter2 = os.time();
	end
</onLoad>
in every waypoint file.

Re: How can i feed the pet?

Posted: Thu Nov 25, 2010 11:39 am
by wil32
I am not sure im getting your last part.

like the difference between those 2.

Re: How can i feed the pet?

Posted: Thu Nov 25, 2010 6:37 pm
by rock5
I think what he is saying is he has it feed the pet only when he is loading a waypoint file, if 20 minutes has passed.

It might work well for him as he probably has waypoint files stringed together that don't individually last very long.

For everyone else who uses just 1 waypoint file or waypoint files that last a long time, this would not work well.

As an all round solution this is how I would do it.

First I would change the feedpet function so all the timing is done in the function, like this.

Code: Select all

function findItemBagSlot(itemNameOrId)
	inventory:update()
	for slot,item in pairs(inventory.BagSlot) do
		if item.Id == itemNameOrId or item.Name == itemNameOrId then
			return slot
		end
	end
end

function feedPet(_petslot)
	time = time or os.time()
	_petslot = _petslot or 1
	local feedtime = os.difftime(os.time(), time)
	if( feedtime < 1200 ) then
		return false
	else
		time = os.time()
	end
	local foodslot = findItemBagSlot("Miller\'s Special Cake")
	if( foodslot == nil ) then
		return false
	else
		RoMScript("ReturnPet('".._petslot.."')")
		yrest(500)
		RoMScript("ClearPetFeedItem()")
		yrest(500)
		RoMScript("PickupBagItem(GetBagItemInfo('"..foodslot.."'))")
		yrest(500)
		RoMScript("ClickPetFeedItem()")
		yrest(500)
		feedtime = feedtime / 1200
		feedtime = math.floor(feedtime,0.5)
		printf("Feed pet %s cakes\n",feedtime)
		for i = 1, feedtime do
			RoMScript("FeedPet('".._petslot.."')")
			yrest(500)
		end
		RoMScript("ClearPetFeedItem()")
		yrest(500)
		RoMScript("SummonPet('".._petslot.."')")
		yrest(8000)
		return true
	end
end
If feeding the pet should only be done in safe places then I would put 'feedPet(1)' in as many safe waypoints as I like or else I would put it in the onLeaveCombat.

Re: How can i feed the pet?

Posted: Thu Nov 25, 2010 7:34 pm
by jduartedj
rock5 wrote: or else I would put it in the onLeaveCombat.

Just one small note....

If he's in a safe place he probably isn't fighting! so putting it under onLeaveCombat would actually put him on an UNSAFE place! ... because he was just fighting.

A specific waypoint would be safer, don't you agree?

Re: How can i feed the pet?

Posted: Thu Nov 25, 2010 7:43 pm
by rock5
jduartedj wrote:
rock5 wrote: or else I would put it in the onLeaveCombat.

Just one small note....

If he's in a safe place he probably isn't fighting! so putting it under onLeaveCombat would actually put him on an UNSAFE place! ... because he was just fighting.

A specific waypoint would be safer, don't you agree?
Isn't that what I said?

If you want to do it in a safe place put it in a safe waypoint

or else..

put it in onleavecombat.

In other words, if you are not scared of the monsters around you, you can put it in onleavecombat. That's assuming that being attacked doesn't interrupt your feeding.

No wait! I see it could be understood the way you read it. Sorry. And I always try to be so clear. :x

Re: How can i feed the pet?

Posted: Fri Nov 26, 2010 8:37 am
by wil32
my waypoint is more then 20 minutes so i went like this

Code: Select all

<onLoad>
   timer = os.time()
</onLoad>
and at the end of my waypoint, approx 22-23 minutes i went like this

Code: Select all

	<!-- # 52 --><waypoint x="yourmom" z="butthole">
      if( feedPet(1,timer) ) then
         timer = os.time()
      end	
	if( player.Fights-player.free_counter1 > 250 ) then
		player.free_counter1 = player.Fights;
		load_paths("why_dont_you_repair_my_thangs");  ' This mount a mount... for faster repair TRAVEL time
	end
</waypoint>

Re: How can i feed the pet?

Posted: Fri Nov 26, 2010 2:02 pm
by swietlowka
as i see the feed function, i suppose someone allready made similiar function to supply crafting tools, reload them get crafts and such, or am i wrong?

Re: How can i feed the pet?

Posted: Sun Apr 03, 2011 7:59 pm
by graveangel
Has anybody got this working... this is what i have so far...

In my waypoint file which is a good 15-20 min run.. I have

Code: Select all

<waypoints>
	<onLoad>
   		timer = os.time()
	</onLoad>
	<!-- #  1 --><waypoint x="xxx" z="xxx">      
		if( feedPet(1,timer) ) then
         	timer = os.time()
      	end	
		if( player.Fights-player.free_counter1 > 300 ) then
		player.free_counter1 = player.Fights;
		load_paths("somewhere");
	end
	</waypoint>
And in in the pet function I have

Code: Select all

function findItemBagSlot(itemNameOrId)
   inventory:update()
   for slot,item in pairs(inventory.BagSlot) do
      if item.Id == itemNameOrId or item.Name == itemNameOrId then
         return slot
      end
   end
end

function feedPet(_petslot)
   time = time or os.time()
   _petslot = _petslot or 1
   local feedtime = os.difftime(os.time(), time)
   if( feedtime < 1200 ) then
      return false
   else
      time = os.time()
   end
   local foodslot = findItemBagSlot("Miller\'s Special Cake")
   if( foodslot == nil ) then
      return false
   else
      RoMScript("ReturnPet('".._petslot.."')")
      yrest(500)
      RoMScript("ClearPetFeedItem()")
      yrest(500)
      RoMScript("PickupBagItem(GetBagItemInfo('"..foodslot.."'))")
      yrest(500)
      RoMScript("ClickPetFeedItem()")
      yrest(500)
      feedtime = feedtime / 1200
      feedtime = math.floor(feedtime,0.5)
      printf("Feed pet %s cakes\n",feedtime)
      for i = 1, feedtime do
         RoMScript("FeedPet('".._petslot.."')")
         yrest(500)
      end
      RoMScript("ClearPetFeedItem()")
      yrest(500)
      RoMScript("SummonPet('".._petslot.."')")
      yrest(8000)
      return true
   end
end
This is not working for me.. the only thing it does is unsummons the pet and 2 seconds after resummons the pet.. but it does not feed the pet... anyone has any idea what am i doing wrong..

Re: How can i feed the pet?

Posted: Sun Apr 03, 2011 8:18 pm
by rock5
This post is way out of date. There is an eggpet class now and settings you can set in your profile.

Checkout the EggPet settings under Profile Options in the wiki.
http://www.solarstrike.net/wiki/index.p ... _-_Options

Re: How can i feed the pet?

Posted: Sun Apr 03, 2011 10:13 pm
by graveangel
Sorry for been such a noob but I dont see an option to feed.. i do see to craft and others...

Re: How can i feed the pet?

Posted: Sun Apr 03, 2011 11:19 pm
by rock5
If you have food and an 'assist' pet it will automatically keep it fed.

Re: How can i feed the pet?

Posted: Wed Apr 06, 2011 9:57 pm
by graveangel
Working like a charm... Thank you..