You should do the table like this?
Code: Select all
itemTable ={
speed = {potID = 207200, buffName = "Unbridled Enthusiasm", castTime = 0},
frog = {potID = 207201, buffName = "Princely Look", castTime = 1000},
luck = {potID = 207203, buffName = "Turn of Luck Powder Dust", castTime = 0},
clearThought = {potID = 207202, buffName = "Clear Thought", castTime = 0},
crazyBreakout = {potID = 207205, buffName = "", castTime = 1000},
fullness = {potID = 207199, buffName = "Fullness", castTime = 0},
gallopingGale = {potID = 207204, buffName = "Galloping Gale", castTime = 0},
MeatsauceBurrito = {potID = 207213, buffName = "Spicy Meatsauce Burrito", castTime = 0},
caviarSandwich = {potID = 207211, buffName = "Caviar Sandwich", castTime = 0},
saltedFish = {potID = 207209, buffName = "Salted Fish with Sauce", castTime = 0},
deliciousSwampMix = {potID = 207214, buffName = "Delicious Swamp Mix", castTime = 0},
unimaginableSalad = {potID = 207215, buffName = "Unimaginable Salad", castTime = 0},
cheeseFishcake = {potID = 207215, buffName = "Cheese Fishcake", castTime = 0}
}
That way you don't have to search for the values.
Code: Select all
function useHousemaidPotions(_potionName)
local option = itemTable[_cName]
if option and inventory:itemTotalCount(option.potID) >= 1 and not player:hasBuff(option.buffName) then
inventory:useItem(option.potID);
if option.castTime > 0 then
yrest(option.castTime);
end
inventory:update();
yrest(750);
end
end