Stop a macro run when out of needed item

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
sirkitesalot
Posts: 4
Joined: Fri Jul 13, 2012 8:21 pm

Stop a macro run when out of needed item

#1 Post by sirkitesalot » Fri Jul 13, 2012 8:34 pm

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.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Stop a macro run when out of needed item

#2 Post by lisa » Fri Jul 13, 2012 9:32 pm

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

sirkitesalot
Posts: 4
Joined: Fri Jul 13, 2012 8:21 pm

Re: Stop a macro run when out of needed item

#3 Post by sirkitesalot » Sun Jul 15, 2012 8:12 pm

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>

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Stop a macro run when out of needed item

#4 Post by lisa » Sun Jul 15, 2012 9:04 pm

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)
So let's just say the potion you use is called "Big Pot"

Code: Select all

if 5 >= inventory:itemTotalCount("Big Pot") then
--go do something else, out of pots
end
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

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest