How can i feed the pet?
Posted: Tue Nov 23, 2010 11:02 am
How can i feed the pet?
C'MON!wil32 wrote:How can i feed the pet?
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
Code: Select all
<onLoad>
timer = os.time()
if( feedPet(1,timer) ) then
timer = os.time()
end
</onLoad>
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.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 thisCode: 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="
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>
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>
Code: Select all
<onLoad>
if( player.free_counter2 == 0 ) then
player.free_counter2 = os.time();
end
</onLoad>
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
rock5 wrote: or else I would put it in the onLeaveCombat.
Isn't that what I said?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?
Code: Select all
<onLoad>
timer = os.time()
</onLoad>
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>
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>
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