Jump to content

Recommended Posts

Today I proudly presents : /use 10, use /13 aaaaand use /14 !!!
 
Okay, RunMacroText("/use 14") will work also, so why should you use a script ?

  • I want to use "use 10" if it's ready to use
  • I want it in fight only
  • I dont want to change timers

At first: If you are not rogue, ...

  • ... change idSinisterStrike=1752 to another spell that represents your fight range. I use it only to be sure, that I am near enough to fight. Sinister Strike are a level 1 spell with a range of 5y.
  • ... remove / change GetComboPoints to another check to be sure, you have the right target and you are in combat

What do I do?
At first I check if I am not in stealth, I have a target, the target is a bad guy, the fight has started and the range for a fight is good.
After this I check my slots, if there are usable items in 10,13 or 14. If they are ready to use, I will use it.
 
I made 3 sections (spells), because I want to be able to disable them once by once. Its also possible to make a loop to check/cast them once.
 
/use 14

    <FightClassSpell>
      <SpellName>--use 14 (second trinket)</SpellName>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>
			local slot="Trinket1Slot"
			local idSinisterStrike=1752
			local ssname=GetSpellInfo(idSinisterStrike)
			if not IsStealthed() and UnitExists("target") and not UnitIsFriend("player", "target") and (GetComboPoints("player") &gt; 0) and (UnitHealth("target")&gt;0) and (IsSpellInRange(ssname,"target")==1) then
--[[			RunMacroText("/use 14")  ]]
				local slotId, texture, checkRelic = GetInventorySlotInfo(slot)
				local itemId = GetInventoryItemID("player", slotId)
				local start, duration, enable = GetItemCooldown(itemId)
				if (duration==0) then
					UseInventoryItem( slotId );
--[[ print("use "..slotId)	]]					
					result=true
				end
			end
			</LuaScript>
            <VarRet>result</VarRet>
            <ValueRet>true</ValueRet>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <Priority>4</Priority>
      <CheckIfKnowUsableDistance>false</CheckIfKnowUsableDistance>
      <AddToSettings>true</AddToSettings>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
      <DescriptionSpell>/use 14</DescriptionSpell>
    </FightClassSpell>

/use 13




    <FightClassSpell>
      <SpellName>--use 13 (first trinket)</SpellName>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>
			local slot="Trinket0Slot"
			local idSinisterStrike=1752
			local ssname=GetSpellInfo(idSinisterStrike)
			if not IsStealthed() and UnitExists("target") and not UnitIsFriend("player", "target") and (GetComboPoints("player") &gt; 0) and (UnitHealth("target")&gt;0) and (IsSpellInRange(ssname,"target")==1) then
--[[			RunMacroText("/use 13")  ]]
				local slotId, texture, checkRelic = GetInventorySlotInfo(slot)
				local itemId = GetInventoryItemID("player", slotId)
				local start, duration, enable = GetItemCooldown(itemId)
				if (duration==0) then
					UseInventoryItem( slotId );
--[[ print("use "..slotId)	]]					
					result=true
				end
			end
			</LuaScript>
            <VarRet>result</VarRet>
            <ValueRet>true</ValueRet>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <Priority>3</Priority>
      <CheckIfKnowUsableDistance>false</CheckIfKnowUsableDistance>
      <AddToSettings>true</AddToSettings>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
      <DescriptionSpell>/use 13</DescriptionSpell>
    </FightClassSpell>

/use 10




    <FightClassSpell>
      <SpellName>--use 10 (Engineer Gloves)</SpellName>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>
			local slot="HandsSlot"
			local idSinisterStrike=1752
			local ssname=GetSpellInfo(idSinisterStrike)
			if not IsStealthed() and UnitExists("target") and not UnitIsFriend("player", "target") and (GetComboPoints("player") &gt; 0) and (UnitHealth("target")&gt;0) and (IsSpellInRange(ssname,"target")==1) then
--[[			RunMacroText("/use 10")  ]]
				local slotId, texture, checkRelic = GetInventorySlotInfo(slot)
				local itemId = GetInventoryItemID("player", slotId)
				local start, duration, enable = GetItemCooldown(itemId)
				if (duration==0) then
					UseInventoryItem( slotId );
--[[ print("use "..slotId) ]]						
					result=true
				end
			end
			</LuaScript>
            <VarRet>result</VarRet>
            <ValueRet>true</ValueRet>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <Priority>2</Priority>
      <CheckIfKnowUsableDistance>false</CheckIfKnowUsableDistance>
      <AddToSettings>true</AddToSettings>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
      <DescriptionSpell>/use 10 (good Engineers only)</DescriptionSpell>
    </FightClassSpell>

based on WoW 5.4.2.

 

Link to comment
https://wrobot.eu/forums/topic/1195-use-101314-a-solution/
Share on other sites

  • 7 years later...
function UseItemInSlow(slotId)
    local SlotCoolDown = select(2, GetInventoryItemCooldown("player", slotId));
    local ItemEquipedName = select(1, GetItemInfo(GetInventoryItemID("player", slotId)));
    if SlotCoolDown == 0 then
        UseItemByName(ItemEquipedName)
    end
end

 

Link to comment
https://wrobot.eu/forums/topic/1195-use-101314-a-solution/#findComment-61663
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...