Ok, let me explain how game rendering typically works - it runs in an endless loop that looks like this:
- update the game state
- render the result to screen
- update the game state
- render the result to screen
...
The frequency of those updates depends on hardware. If the game runs in fullscreen with vertical synchronization (vsync) enabled, it usually renders 60 frames per second (because the refresh rate of most LCD displays is 60Hz).
That means the game state (animations, scripts etc.) is updated 60 times per second (that's 16.67 milliseconds per update).
Soooo, if your script says "Sleep(1)", i.e. "wait for one millisecond", it has to wait for the next update, that is at least 16.67 milliseconds (if your game runs at 60 frames per second). In other words, using these tiny fractions of time while calling Sleep() is not a good idea. Change your logic to use larger time values (it's really not necessary to update the iventory position every millisecond anyway - even if the hardware was be able to display it, your eye wouldn't be able to see it
).