I am looking to stop a macro when you run out of ammo, potions, or food that is needed for the bot.
When the trigger is found then the bot either retreats to a "safeplace" waypoint or recalls and then camps out. I have the recall and camp out part down but would love to not trigger the recall rather to retreat to a "safe place" and then camp as long as there is no ago if agro kill the attacker(s) and then camp.
any pointers would be greatly appricated.
Stop a macro run when out of needed item
Re: Stop a macro run when out of needed item
I would say to add code to onleavecombat for checking the items you require, since it will be in the profile then you can specify the actual items instead of trying to allow for all potions.
Then just create a WP to go to your "safe" place and then log out when you get there.
Then just create a WP to go to your "safe" place and then log out when you get there.
Remember no matter you do in life to always have a little fun while you are at it 
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
-
sirkitesalot
- Posts: 4
- Joined: Fri Jul 13, 2012 8:21 pm
Re: Stop a macro run when out of needed item
Thank you for the point in the right direction here is what I am working with
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
startGMDetect()
-- 0 = white / 1 = green / 2 = blue / 3 = purple / 4 = orange / 5 = gold
changeProfileOption("INV_AUTOSELL_ENABLE",true)
changeProfileOption("AUTO_ELITE_FACTOR", 8)
function CleanBagS()
for i, item in pairs(inventory.BagSlot) do
if item.SlotNumber >= settings.profile.options.INV_AUTOSELL_FROMSLOT + 60 and
settings.profile.options.INV_AUTOSELL_TOSLOT + 60 >= item.SlotNumber then
if item:isType("Runes") then
item:delete()
end
if ( item:isType("Weapons") or item:isType("Armor") ) and (1000 > item.Worth and 3 > item.Quality)then
item:delete()
end
if item:isType("Potions") and (45 > item.RequiredLvl and item.RequiredLvl > 10) then
item:delete()
end
if item:isType("Arrow") and (45 > item.RequiredLvl and item.RequiredLvl > 10) then
item:delete()
end
if item.Name == "Item2" then
item:delete()
end
if item.Name == "Item1" then
item:delete()
end
end
end
end
oldOnLeaveCombat = settings.profile.events.onLeaveCombat;
settings.profile.events.onLeaveCombat = function()
--add code here
--This is where I am lost I am not sure of a good way to look for a potion that could be anyplace in a bag or check for ammo in ammo slot or in a bag or quiver in bag someplace.
-- envisioned logic
-- If ammo slot = 0 and bag slot 30 to 180 no ammo bag then load waypoint and quit else continue below.
CleanBagS()
loadPaths("Path2");
--call profile on leave combat
if (oldOnLeaveCombat and (type(oldOnLeaveCombat)=='function')) then
oldOnLeaveCombat();
end;
end
</onLoad>
<!-- # 1 --><waypoint x="" z="" y=""> </waypoint>
<!-- # 2 --><waypoint x="" z="" y=""> </waypoint>
</waypoints>
Re: Stop a macro run when out of needed item
sirkitesalot wrote:This is where I am lost I am not sure of a good way to look for a potion that could be anyplace
Code: Select all
inventory:itemTotalCount(itemNameOrId, range)Code: Select all
if 5 >= inventory:itemTotalCount("Big Pot") then
--go do something else, out of pots
endRemember no matter you do in life to always have a little fun while you are at it 
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Who is online
Users browsing this forum: No registered users and 1 guest