Totoka 152 Report post Posted November 18, 2016 Script link Credits to @Sultan for being an inspiration =) note: It has items from 2.4, feel free to remove them if you are planning to use it on older versions 6 Quote Discord: andresc Share this post Link to post Share on other sites
Xoskis 2 Report post Posted May 19, 2018 Totoka, I'm using your script, however, when I'm going to combine, need 9x lv1 and only strip 8x lv1, how do I only need 8x and take 8x? Quote Share this post Link to post Share on other sites
JaR 7 Report post Posted July 4, 2021 @Xoskis change this line in HasStone and TakeStone function for i=1, bagSize do to for i=0, bagSize do so, it won't check 9 gems anymore Quote Share this post Link to post Share on other sites
wouter2004 11 Report post Posted September 27, 2021 (edited) Sorry for bumping up this old topic, but I need some help with this script. The script only return 1 count, while I have 8 gems with level 1 stacked in one inventory slot. Most likely the script below expect that each gem has their own inventory slot. Is there a function to check the level of stacked items? Also when I have more than 8 gems in one slot, for example 12 times a level 1 gem, the script removes 8 and converts all remaining gems into level 4. function HasStone(character, stoneID, stoneLv, stoneCount) local amount = CheckBagItem(character,stoneID) if amount < stoneCount then return LUA_FALSE end local bagSize = GetKbCap(character) local count = 0 for i=1, bagSize do local gem =GetChaItem(character, 2, i) if gem ~= nil then local id =GetItemID(gem) if id == stoneID then local lv = Get_StoneLv(gem) if lv == stoneLv then count = count + 1 end end if count >= stoneCount then return LUA_TRUE end end end return LUA_FALSE end I have now reversed the script and changed it into a check for the exact amount and exact level. Quick and dirty, but this new version works. function HasStone(character, stoneID, stoneLv, stoneCount) local amount = CheckBagItem(character,stoneID) if amount ~= stoneCount then SystemNotice(character,"You need exactly "..stoneCount.." gems in your inventory. Amount = "..amount) return LUA_FALSE end local bagSize = GetKbCap(character) for i=0, bagSize do local gem =GetChaItem(character, 2, i) if gem ~= nil then local id =GetItemID(gem) if id == stoneID then local lv = Get_StoneLv(gem) if lv ~= stoneLv then SystemNotice(character,"Found gem level = "..lv) SystemNotice(character,"Remove the high level gems from your inventory") return LUA_FALSE end end end end SystemNotice(character,"Succesful! "..amount.." gems of level "..stoneLv.." detected.") return LUA_TRUE end If anyone has a better solution for the stacked items, level check I am open for suggestions. Edited September 27, 2021 by wouter2004 Quote Share this post Link to post Share on other sites
JaR 7 Report post Posted September 27, 2021 @wouter2004 there is a function in Corsairs files that is GetItemStackSize() you can use it local itemCount = GetItemStackSize(gem) if (itemCount >= stoneCount) then return LUA_TRUE end 1 Quote Share this post Link to post Share on other sites
wouter2004 11 Report post Posted October 2, 2021 On 9/28/2021 at 12:32 AM, JaR said: @wouter2004 there is a function in Corsairs files that is GetItemStackSize() you can use it local itemCount = GetItemStackSize(gem) if (itemCount >= stoneCount) then return LUA_TRUE end many thanks this will help a lot. using the counter and multiplying with the GetItemStackSize, will indeed with the right results Quote Share this post Link to post Share on other sites