Author Topic: Changing Inventory Slots [Solved]  (Read 518 times)

I have two variables. $NumInvSlots and $CurrInvSlot. There is a function, scrollTools(%num). It makes you scroll your inventory up/down by %num. I need a way to calculate %num to always go to slot 0, and another calculation to make it always go to slot 1, and another calculation to always go to slot 2, ect, all the way until slot 9.
« Last Edit: March 28, 2014, 12:00:09 PM by jes00 »

Assuming it doesn't wrap around, and your intended inventory slot is %n, then the formula would be:
%n - $currinvslot

If you want the most efficient way to get to the intended slot, then that's an entirely different thing.

Assuming it doesn't wrap around, and your intended inventory slot is %n, then the formula would be:
%n - $currinvslot

If you want the most efficient way to get to the intended slot, then that's an entirely different thing.
Wow. I was overcomplicating things.
« Last Edit: March 28, 2014, 11:58:58 AM by jes00 »

Are you certain? Because if your current slot is 5, then the result would be -5.
5 + (-5) == 0

Are you certain? Because if your current slot is 5, then the result would be -5.
5 + (-5) == 0
I made a mistake in the code. I put a % instead of $.

Thanks for the help Ipquarx.