Page 1 of 1
"Projectile or Arrow" rom API function
Posted: Tue Dec 18, 2012 9:42 am
by kkulesza
How do i check if an item is a Projectile or an Arrow with RoM API (ingame macro)?
Re: "Projectile or Arrow" rom API function
Posted: Tue Jan 01, 2013 8:22 am
by Rintintin
The only idea i have is to put all available ammo items in a table and check against this table wheter an item is an arrow or something knifelike.
here is a very short example, of wehat i mean:
Code: Select all
function getAmmoType(_itemid)
ammotype={}
table.insert(ammotype,210295,"thrown");
table.insert(ammotype,210306,"arrow");
if type(_itemid) == "number" then
return ammotype[_itemid];
end
end
the digits are the itemids
hope that helps.
Re: "Projectile or Arrow" rom API function
Posted: Tue Jan 01, 2013 8:27 am
by Rintintin
kkulesza wrote:RoM API (ingame macro)?
ahh i just noticed, you don't want to use rombot. So this solution is useless for you
Re: "Projectile or Arrow" rom API function
Posted: Fri Jan 04, 2013 10:51 am
by Jandrana
There is no Rom API function for this, as far as I know.
But if you like to use it in a macro you can use something like this:
Code: Select all
function isAmmo(bagIndex)
return
string.find(GetBagItemLink(GetBagItemInfo(bagIndex)),"Arrow") > 0
or
string.find(GetBagItemLink(GetBagItemInfo(bagIndex)),"Projectile") > 0
end;
SendChatMessage(tostring(isAmmo(1)),"SAY")
It is not perfect. If an item should have "Arrow" or "Projectile" in its regular name, it will also return true.
For a perfect solution, you need to parse the ItemLink. Look into the source of Lootomatic for this.
Use IGSC to define the function. Then you can use it in a macro with: /igs Script1
http://rom.curseforge.com/addons/ingamescripts/