Function Error
Posted: Tue Aug 18, 2009 8:26 am
I want to add a function : GetInventoryItemDurable("player", index)
When i use that as a macro it works without problems :/
Try
It will show the current durability of your weapon.
I want to use that in MicroMacro.
So i did this :
In the functions.lua i added this.
Actually im not very good in lua and this code is maybe improvable but it doesn´t work.
I get this error : scripts\rom\functions.lua attempt to call global "GetInventoryItemDurable" <a nil value>
When i use that as a macro it works without problems :/
Try
Code: Select all
/script curD,maxD,itemName,curDfull,maxDfull = GetInventoryItemDurable("player", 15)
/script DEFAULT_CHAT_FRAME:AddMessage(curD)
I want to use that in MicroMacro.
So i did this :
Code: Select all
<!-- # 1 --><waypoint x="-11675" z="-2596">
GetDurability()
</waypoint>
Code: Select all
function GetDurability()
local curD,maxD,itemName,curDfull,maxDfull = GetInventoryItemDurable("player", 15)
local percentD = math.ceil((curD/maxD)*1000)/10
printf("Wapon 1 Durability = ");
printf(percentD);
if( percentD <= 50 ) then
load_paths( "repair.xml");
end
end;
I get this error : scripts\rom\functions.lua attempt to call global "GetInventoryItemDurable" <a nil value>