Wow, you didn't make it easy.
and replacing the current active scroll, moving that scroll back into the inventory.
Where exactly is this code that should move the previous scroll back into the inventory? Perhaps it should work like this:
1. Check if there's an item in the Active Slot. If true - re-add it to the inventory, then destroy the item in the Active Spell slot.
2. Move the clicked item to the Active Spell slot.
.
But to be honest, I don't like that the item is essentially removed from the inventory when it goes to the active slot. What happens if you pick up another copy of the same scroll - should it go to the active spell slot, increasing its quantity, or to the main inventory? How do you swap items in the active slot when the inventory is full?
It will be a lot easier if the item assigned to the active slot stayed in the inventory. Just use a global variable, say ActiveSpell="invisibility". On right-click find the invisibility spell in the inventory, reduce its quantity by 1. If none left, remove invisibility spell from the inventory, reset the ActiveSpell variable to "". This is how it's done in most rpg games.