Page 1 of 1

[Solved]cancel_crafting error 'invalid crafting queqe index'

Posted: Wed Mar 20, 2019 2:12 pm
by WIZ4
I'm trying to undo the player craft using this command:

Code: Select all

/c for i, option  in pairs(game.player.crafting_queue) do game.player.cancel_crafting({index=1,count=option['count']}) end
Craft is canceled, but I get an error.
before:
Screenshot_12.jpg
Screenshot_12.jpg (131.26 KiB) Viewed 877 times
after:
Screenshot_13.jpg
Screenshot_13.jpg (309.4 KiB) Viewed 877 times
This is probably due to the fact that if the intermediate product is canceled(blue slot), the main product is also canceled, and as a result, the main product index becomes invalid.
If in the crafting queue no intermediate products, the error does not appear.
I also tried using these indexes.But the result is even worse:

Code: Select all

/c for i, option  in pairs(game.player.crafting_queue) do game.player.cancel_crafting({index=option['index'],count=option['count']}) end
/c for i, option  in pairs(game.player.crafting_queue) do game.player.cancel_crafting({index=i,count=option['count']}) end
Screenshot_12.jpg
Screenshot_12.jpg (169.67 KiB) Viewed 877 times
Screenshot_14.jpg
Screenshot_14.jpg (340.93 KiB) Viewed 877 times
What should I do?

Re: cancel_crafting error 'invalid crafting queqe index'

Posted: Wed Mar 20, 2019 2:28 pm
by DaveMcW

Code: Select all

/c
while game.player.crafting_queue do
  game.player.cancel_crafting{index=1, count=game.player.crafting_queue[1].count}
end

Re: cancel_crafting error 'invalid crafting queqe index'

Posted: Thu Mar 21, 2019 11:40 am
by WIZ4
Nice that worked! Thanks for your help