Page 1 of 1
is bow equiped? (not bot releated)
Posted: Thu Jan 31, 2013 3:23 pm
by lolita
im making function for my Rogue/Scout to swap beetwin bow and arrows and projectiles,
i found only this API on romwiki
Code: Select all
API:GetEquipSlotInfo
/script DEFAULT_CHAT_FRAME:AddMessage(GetEquipSlotInfo(11))
if bow or crossbow is equiped this return "interface\CharacterFrame\Equipment-RangedSlot", else nil
i tryed
Code: Select all
function arrow_knife()
local bow = GetEquipSlotInfo(11)
if bow == "interface\CharacterFrame\Equipment-RangedSlot" then
EquipItem(11) -- unequip bow
UseItemByName("Stone") -- equip projectiles
SendSystemMsg("|H|h|cff00FF00PROJECTILES EQUIPED|h")
else
EquipItem(10) -- unequip projectiles
UseItemByName("Rune War Bow") -- equip bow
UseItemByName("Obsidian Arrow") -- equip arrows
SendSystemMsg("|H|h|cff00FF00RANGED WEAPON EQUIPED|h")
end
end
but dont want to swap,
any idea?
Re: is bow equiped? (not bot releated)
Posted: Fri Feb 01, 2013 1:44 am
by rock5
They are in game functions so you need to use RoMScripts. This should work.
Code: Select all
function arrow_knife()
local bow = RoMScript("GetEquipSlotInfo(11)")
if bow == "interface\\CharacterFrame\\Equipment-RangedSlot" then
RoMScript("EquipItem(11)") -- unequip bow
RoMScript('UseItemByName("Stone")') -- equip projectiles
RoMScript('SendSystemMsg("|H|h|cff00FF00PROJECTILES EQUIPED|h")')
else
RoMScript('UseItemByName("Obsidian Arrow")') -- equip arrows
RoMScript('UseItemByName("Rune War Bow")') -- equip bow
RoMScript('SendSystemMsg("|H|h|cff00FF00RANGED WEAPON EQUIPED|h")')
end
end
Note: you don't need to unequip the Stones if yo equip the arrows before the bow.
I would do a few things differently, though. I would use variables for the bow, arrows and knives so you would have less issues with special characters in the names such as '. And I would have the function accept a variable to make sure it equips the right items. Something like
Code: Select all
function arrow_knife(choice)
local bow = "Rune War Bow"
local arrows = "Obsidian Arrow"
local knife = "Stone"
local bowslot = RoMScript("GetEquipSlotInfo(11)")
if bowslot == "interface\\CharacterFrame\\Equipment-RangedSlot" then
if choice == "arrow" then -- Already equiped
return
end
RoMScript("EquipItem(11)") -- unequip bow
RoMScript('UseItemByName("'..knife..'")') -- equip projectiles
RoMScript('SendSystemMsg("|H|h|cff00FF00PROJECTILES EQUIPED|h")')
else
if choice == "knife" then -- Already equiped
return
end
RoMScript('UseItemByName("'..arrows..'")') -- equip arrows
RoMScript('UseItemByName("'..bow..'")') -- equip bow
RoMScript('SendSystemMsg("|H|h|cff00FF00RANGED WEAPON EQUIPED|h")')
end
end
Re: is bow equiped? (not bot releated)
Posted: Fri Feb 01, 2013 6:27 am
by lolita
yes rock, i know it's in game functions, cose i want to use it in game while manualy playing, not with bot.
i should write that to, my bad

but you helped my anyway.
i was useing bowslot == "interface\CharacterFrame\Equipment-RangedSlot"
but it should be bowslot == "interface\\CharacterFrame\\Equipment-RangedSlot"
here is code, if anyone need it
Code: Select all
function arrow_knife()
local bow = "Rune War Bow" -- change name of ranged weapon
local arrows = "Obsidian Arrow" -- change name of arrows
local knife = "Stone" -- change name of projectiles
local bowslot = GetEquipSlotInfo(11)
if bowslot == "interface\\CharacterFrame\\Equipment-RangedSlot" then
EquipItem(11) -- unequip bow
UseItemByName(knife) -- equip projectiles
SendSystemMsg("|H|h|cff00FF00PROJECTILES EQUIPED|h")
else
UseItemByName(arrows)-- equip arrows
UseItemByName(bow) -- equip bow
SendSystemMsg("|H|h|cff00FF00RANGED WEAPON EQUIPED|h")
end
end
Re: is bow equiped? (not bot releated)
Posted: Fri Feb 01, 2013 7:27 am
by rock5
Hm... how would you use it as a function in game? Put it in an addon? Maybe you should mention that for those who haven't got a clue.
Also you should be able to just put it in a macro like this,
Code: Select all
local bow = "Rune War Bow" -- change name of ranged weapon
local arrows = "Obsidian Arrow" -- change name of arrows
local knife = "Stone" -- change name of projectiles
local bowslot = GetEquipSlotInfo(11)
if bowslot == "interface\\CharacterFrame\\Equipment-RangedSlot" then
EquipItem(11) -- unequip bow
UseItemByName(knife) -- equip projectiles
SendSystemMsg("|H|h|cff00FF00PROJECTILES EQUIPED|h")
else
UseItemByName(arrows)-- equip arrows
UseItemByName(bow) -- equip bow
SendSystemMsg("|H|h|cff00FF00RANGED WEAPON EQUIPED|h")
end
Re: is bow equiped? (not bot releated)
Posted: Fri Feb 01, 2013 9:17 am
by lolita
yes , ill use it as a part of addon, and just use macro
i think code you posted, is to long for macro
Re: is bow equiped? (not bot releated)
Posted: Fri Feb 01, 2013 9:29 am
by lisa
this is 250 characters, 255 is max.
Code: Select all
/script if GetEquipSlotInfo(11) == "interface\\CharacterFrame\\Equipment-RangedSlot" then EquipItem(11) UseItemByName("Stone") SendSystemMsg("PROJECTILES") else UseItemByName("Obsidian Arrow") UseItemByName("Rune War Bow”) SendSystemMsg("RANGED") end
If you took out the SendSystemMsg prints you could fit in more code.