I'm working on an inventory system.
The functions are to drop items into empty spaces, and if the space is occupied, the items are swapped if they don't have the same ID.
However, I'm having a problem when adding the sum.
I have two arrays, one called hotbar and the other INV.
I'm supposed to have keys so that each action function is executed. When the key is 0, it saves the information to the variables in G and clears the information from the INV array, or the same happens in the hotbar array.
When the key is 1, it loads the information from the variables in G into empty spaces, either in the INV or hotbar array.
The issue is that when the function is 1 and I compare the variables G_ID=DES_ID to apply the sum, if that's active, I get a strange error that I don't understand.
If I click on the item with the function set to 0, it should save the information, but instead, it sends that information to the hotbar array, which shouldn't happen.
But this only happens if the sum is active. which is inside the key of function 1, meaning function 1 is not activated if the data has not been loaded.
But if I deactivate the summing within function 1, everything works correctly again without performing summations.
Here's a video of the ones I've programmed.:
youtu.be/PPqjTRO5l9k
Here is a copy of the programming:
[click to take 3]
----+ Mouse: The cursor is over SLOT
----+ System: InvOpen is true
--------+ System: SLOT.ZONE = ZONE_INV
---------> System: Set DES_ID to Inv.En(SLOT.POSX,SLOT.POSY,Z_ID)
---------> System: Set DES_QTY to Inv.En(SLOT.POSX,SLOT.POSY,Z_QTY)
---------> System: Set DES_X to SLOT.POSX
---------> System: Set DES_Y to SLOT.POSY
---------> System: Set DES_ZONE to SLOT.ZONE
--------+ System: SLOT.ZONE = ZONE_INVBAR
---------> System: Set DES_ID to HotBar.En(SLOT.POSX, SLOT.POSY, Z_ID)
---------> System: Set DES_QTY to HotBar.En(SLOT.POSX, SLOT.POSY, Z_QTY)
---------> System: Set DES_X to SLOT.POSX
---------> System: Set DES_Y to SLOT.POSY
---------> System: Set DES_ZONE to SLOT.ZONE
----+ Mouse: [X] Cursor is over SLOT
----+ System: InvOpen is true
-----> System: Set DES_ID to 0
-----> System: Set DES_QTY to 0
-----> System: Set DES_X to 0
-----> System: Set DES_Y to 0
-----> System: Set DES_ZONE to 0
----+ Mouse: On Left Click on SLOT
----+ System: Is InvOpen true
--------+ System: G_DRAGacti = 0
------------+ System: SLOT.ZONE = ZONE_INV
------------+ System: DES_ID > 0
-------------> System: Set G_ID to Inv.En(SLOT.POSX,SLOT.POSY,Z_ID)
-------------> System: Set G_QTY to Inv.En(SLOT.POSX,SLOT.POSY,Z_QTY)
-------------> System: Set G_X to SLOT.POSX
-------------> System: Set G_Y to SLOT.POSY
-------------> System: Set G_IDSUMA to Inv.En(SLOT.POSX,SLOT.POSY,Z_ID)
-------------> System: Set G_QTYSUMA to Inv.En(SLOT.POSX, SLOT.POSY, Z_QTY)
-------------> System: Set G_XSUMA to SLOT.POSX
-------------> System: Set G_YSUMA to SLOT.POSY
-------------> System: Set G_ZONE to SLOT.ZONE
-------------> Inv: Set value in (G_X, G_Y, Z_ID) to 0
-------------> Inv: Set value in (G_X, G_Y, Z_QTY) to 0
-------------> System: Set G_STACKMAX to SLOT.MAXSTACK
-------------> System: Set G_STACKEABLE to SLOT.STACKEABLE
-------------> System: Set G_DRAGGING to True
-------------> System: Set G_DRAGacti to 1
-------------> System: Set UI_DIRTY to 1
------------+ System: SLOT.ZONE =ZONE_INVBAR
------------+ System: DES_ID > 0
-------------> System: Set G_ID to HotBar.En(SLOT.POSX,SLOT.POSY,Z_ID)
-------------> System: Set G_QTY to HotBar.En(SLOT.POSX,SLOT.POSY,Z_QTY)
-------------> System: Set G_X to SLOT.POSX
-------------> System: Set G_Y to SLOT.POSY
-------------> System: Set G_IDSUMA to HotBar.En(SLOT.POSX,SLOT.POSY,Z_ID)
-------------> System: Set G_QTYSUMA to HotBar.En(SLOT.POSX,SLOT.POSY,Z_QTY)
-------------> System: Set G_XSUMA to SLOT.POSX
-------------> System: Set G_YSUMA to SLOT.POSY
-------------> System: Set G_ZONE to SLOT.ZONE
-------------> HotBar: Set value in (G_X, 0, Z_ID) to 0
-------------> HotBar: Set value in (G_X, 0, Z_QTY) to 0
-------------> System: Set G_STACKMAX to SLOT.MAXSTACK
-------------> System: Set G_STACKEABLE to SLOT.STACKEABLE
-------------> System: Set G_DRAGGING to True
-------------> System: Set G_DRAGacti to 1
-------------> System: Set UI_DIRTY to 1
--------+ System: G_DRAGacti = 1
------------+ System: SLOT.ZONE = ZONE_INV
----------------+ System: DES_ZONE = G_ZONE
--------------------+ System: DES_ID = 0
--------------------+ System: G_DRAGacti = 1
---------------------> Inv: Set value in (DES_X, DES_Y, Z_ID) to G_ID
---------------------> Inv: Set value in (D