View Single Post
09-21-06, 11:04 PM   #82
halwa
A Kobold Labourer
Join Date: Sep 2006
Posts: 1
Trinket Priority Queues

Posted on ItemRack file comments as well.

Thanks
Halwa.

--- post copy ----
I saw a post on the Itemrack - Events this AM which described a script to prioritize trinkets and switch to them based on ITEMRACK_NOTIFY and ITEMRACK_ITEMUSED events (Thanks Ansum, sorry if I got the nick wrong).

The caveat with that script was that the notify portion would work only if the cooldown was complete, i.e. if ITEMRACK_NOTIFY triggered 30 sec ahead of the cooldown ending it wouldnt get equipped. A little bit of tinkering got the NOTIFY portion working.

People trying to get a priority queue going heres how to do it. Make two events, copying the "Insignia" and "Insignia Used" events from default ItemRack configuration. Now in both these new events, remove the code from the text box below the "Delay" column in the ItemRack UI. Add the following LUA script.

local trinketslot, _ = GetInventorySlotInfo("Trinket1Slot");
local trinkets = {
"Insignia of the Horde",
"Barov Peasant Caller",
"Defiler's Talisman",
"Blackhand's Breadth"
};
for _, t in ipairs(trinkets) do
local inv,bag,slot = Rack.FindItem(nil, t);
local s, d, e, c;
local ignore=false;
if inv == trinketslot then
s, d, e = GetInventoryItemCooldown("player", inv);
elseif bag and slot then
s, d, e = GetContainerItemCooldown(bag,slot);
else
ignore=true;
end
c = GetTime();
if ( not ignore and (s + d - c <= 30 )) then
if not inv and bag and slot then
if UnitAffectingCombat("player") or Rack.IsPlayerReallyDead() then
local _,itemID = Rack.GetItemInfo(bag, slot)
Rack.AddToCombatQueue(trinketslot ,itemID)
else
PickupContainerItem(bag,slot);
PickupInventoryItem(trinketslot);
end;
end;
break;
end;
end;

The script walks a list of items, calculates the cooldown associated with them and equips the first one that doesnt have a cooldown or whose cooldown is at most 30 sec. I am not LUA programmer so there might be errors in the script (I havent taken care of negative values during substraction for one, though it doesnt seem to matter in my testing). I havent yet tested this script in combat.

In the meanwhile I would like to map whatever my current trinket slot 1 holds to a single icon on my toolbar (and hence a single keypress). The idea being to use the same keypress to trigger my trinket based cooldowns. It would be great if the LUA experts on the board can help me with this.

Thanks
Halwa
  Reply With Quote