View Single Post
04-05-07, 06:24 PM   #116
battleliquor
A Kobold Labourer
Join Date: Apr 2007
Posts: 1
I tried out this script and it seems to work OK substituting various trinkets for those listed. However, I have questions on how i can change this a little.


Originally Posted by halwa
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
First, when I use a trinket and the next priority trinket is also available, item rack immediately switches trinkets without incorporating the delay for the actual buff the trinket provides. I.E. I use "Xi'ri's Gift" and am granted 150 spell damage for 15 seconds. Instead of waiting for the effect to expire, the trinket is immediately swapped and the effect is removed when the trinket is.
Second, is it possible to delay the swapping of trinkets if you are casting at the time it would swap? What script change could possibly allow for that?
Third, what would i have to change in the script for it to only swap trinkets in and out of my first trinket slot in order to keep a specific trinket always in the second slot?
  Reply With Quote