Actually, after updating it works now, I tested it and made a new topic with the final* modified program.
I had trouble with it clicking the ok button to reduce the item, I guess it was lag since it worked fine outside the game, I tried a few different things but ended up making it drag for 5 or so pixels across the button which made it click every time.
If you want the program then check that topic.
Can someone close this one?
*might not be final, but it is doing what it's supposed to for now