Toggle Auto Loot function

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Toggle Auto Loot function

#1 Post by Bill D Cat » Sun Nov 23, 2014 9:11 pm

While working on my waypoint file for Sascilia Steppes, I came across a short series of quests involving Fuquash and his henchmen. Now normally I use LootIt to limit the items that I loot from mobs, mostly "$Quest Item" and a range of Green to Orange items. This was going to cause a problem with this series of quests, as you must loot EVERYTHING off these mobs to allow them to de-spawn and for Fuquash to allow you to complete the quest.

So rather than telling LootIt to just loot everything off the dead mobs, I came up with a simple function that will take care of this for me. What it does is reads the current setting of Auto Loot from your preferences and remembers it so that it can make sure Auto Loot is on for these quests, and turns it back off only if you originally had it turned off.

Code: Select all

		<!-- This function turns on autoloot regarless of looting add-ons, and resets the original condition when finished. -->
		local aLoot
		function toggleLoot(_set)
			if string.lower(_set) == "set" then
				aLoot = RoMScript("IsAutoTakeLoot()")
				if aLoot == false then
					RoMScript("SetAutoTakeLoot(true)")
				end
			else
				if aLoot == false then
					RoMScript("SetAutoTakeLoot(false)")
				end
			end
		end
Edit: Fixed the placement of the "local aLoot" line.
Last edited by Bill D Cat on Sun Nov 23, 2014 10:09 pm, edited 1 time in total.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Toggle Auto Loot function

#2 Post by rock5 » Sun Nov 23, 2014 9:17 pm

Your code logic looks faulty.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Re: Toggle Auto Loot function

#3 Post by Bill D Cat » Sun Nov 23, 2014 9:25 pm

How so?

Code: Select all

Declare local variable to the function.
If the argument "set" is passed then 
    Find out original condition of the in-game Auto Loot setting
    If that original setting is off then turn it on, otherwise do nothing as it is already on.
Else if the argument is not "set"
    If the original setting was off then turn it back off, otherwise do nothing because it was on to begin with.
End

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Toggle Auto Loot function

#4 Post by rock5 » Sun Nov 23, 2014 10:00 pm

So aLoot is supposed to remember the setting? You've declared it local so every time the function is run it starts off by equaling nil

Code: Select all

local aLoot
I think this means it would not restore the autoloot if it started as enabled. It will always end up disabled. You probably need to put it outside the function.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Re: Toggle Auto Loot function

#5 Post by Bill D Cat » Sun Nov 23, 2014 10:05 pm

I see what you mean. Okay, I'll move it out into the main portion of the <onload> section.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest