Remove selected item from inventory

Hello helpful people!

My game includes a mechanic of flushing things down the toilet (becomes useful for a drug side-plot).

The toilet randomly clogs when flushing.


1616372879064.png



I have everything working, except the removal of the selected item.

1616372922842.png



Is there a syntax thing that I'm missing here?


1616372978273.png




Thanks for all of your help so far! This community is amazing!!
To reference variable 59 as an item ID:
$dataItems[$gameVariables.value(59)]
To reference variable 59 as an item ID:
$dataItems[$gameVariables.value(59)]
Hey! That did it!

I changed the script to the following:


$gameParty.loseItem($dataItems[$gameVariables.value(59)], 1)

Thanks so much!

Original thread: https://forums.rpgmakerweb.com/threads/remove-selected-item-from-inventory.134633/