What you are doing is trying to use the magic pouch after every stone use. That might work but it's a bit messy. You should do one step at a time. First use the stones until you have a pouch or run out of stones. Then use the pouch if you got one.
You don't need to do inventory:update() before an itemTotalCount because it is done in itemTotalCount.
'=' means assign a value to. '==' means compare 2 values.
Also if you are going to put the code in a waypoint so it runs whenever it reaches that waypoint, why limit it to only run when you have more than 6? I would just run it anyway each time. Also you have it looping back to the same waypoint which means if it didn't have enough Stones to complete the quest then it would get stuck in a loop. It should instead go and kill more Stone Protectors. So the 'stonemore' tag should be at a waypoint that would take you around again to kill more mobs and get more stones.
There are certain rules about how you can split lines. I'm not sure but I don't think you can change
to
So, thinking it though, I would use stones until I get a pouch or run out of stones, use the pouch if I have one. If the quest is complete then continue to the 'stonedone' tag. Otherwise repeat until the stones are used up then go kill more mobs.
I was going to give you my complete version but you sound like you're enjoying doing it so I'll just give you the break down.
Code: Select all
repeat
-- Use stones until you get a pounch or run out
-- If I have a pouch, use it
-- if quest is finished then set waypoint to tag 'stonedone' and 'return' to exit waypoint
until inventory:getItemCount("Energy Stone") == 0
-- At this point quest not done and out of stones. Set tag 'stonemore' and go get some.