Vox Kalam Posted August 26, 2007 Posted August 26, 2007 Won't compile. void main() { int nQuantity = GetScriptParameter( 1 ); int i; string sItem = GetScriptStringParameter(); if(nQuantity == 0) nQuantity = 1; object "hkarmor" = GetItemPossessedBy (GetPartyLeader(),"hkarmor"); if (GetIsObjectValid("hkarmor")) { int nStackSize = GetItemStackSize("hkarmor"); if(nQuantity < nStackSize) { nQuantity = nStackSize - nQuantity; SetItemStackSize("hkarmor", nQuantity); } else if(nQuantity > nStackSize || nQuantity == nStackSize) { DestroyObject("hkarmor"); } } } Something about string constant in line 9
stoffe Posted August 26, 2007 Posted August 26, 2007 Won't compile. Something about string constant in line 9 That's because you are using a string constant where you should be using an object variable name throughout the script: void main() { int nQuantity = GetScriptParameter( 1 ); int i; string sItem = GetScriptStringParameter(); if(nQuantity == 0) nQuantity = 1; object hkarmor = GetItemPossessedBy(GetFirstPC(), "hkarmor"); if (GetIsObjectValid(hkarmor)) { int nStackSize = GetItemStackSize(hkarmor); if(nQuantity < nStackSize) { nQuantity = nStackSize - nQuantity; SetItemStackSize(hkarmor, nQuantity); } else if(nQuantity > nStackSize || nQuantity == nStackSize) { DestroyObject(hkarmor); } } }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.