is bow equiped? (not bot releated)

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

is bow equiped? (not bot releated)

#1 Post 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?
Life is a journey, not destination :D
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: is bow equiped? (not bot releated)

#2 Post 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
  • 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
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: is bow equiped? (not bot releated)

#3 Post 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 :D
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
Life is a journey, not destination :D
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: is bow equiped? (not bot releated)

#4 Post 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
  • 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
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: is bow equiped? (not bot releated)

#5 Post by lolita »

yes , ill use it as a part of addon, and just use macro

Code: Select all

/script arrow_knife()
i think code you posted, is to long for macro
Life is a journey, not destination :D
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: is bow equiped? (not bot releated)

#6 Post 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.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Post Reply