Very strange things happen when working with GUI procedures.

Started by StellaeLux on Fri, 09/20/2019 - 14:05

Topic category: Bugs and solutions

Last seen on 12:10, 18. Oct 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Very strange things happen when working with GUI procedures.
Fri, 09/20/2019 - 14:05

The GUI is simple:

One input slot (0), One button, One output slot (1).

When a player places in an item (say diamonds) inside of the input slot and press the button, the same amount of another item (say dirt?) appears in the output slot and the input slots gets cleared.

The button has the following procedure attached:

------------------------------------------------------------------------

if Get number of items from slot 0 of inventory [nameOfInventory] >= 1 AND Get item from slot 0 of inventory [nameOfInvetory] = [Diamond] 
//If there's 1 or more diamonds in slot 0

do Set Get number of items from slot 0 of inventory [nameOfInventory] [Dirt] in slot 1 of inventory [nameOfInventory] 
//Place that amount of dirt in slot 1

do Remove Get number of items from slot 0 of inventory [nameOfInventory] items from slot 0 of inventory [nameOfInventory] 
//Remove that amount of diamonds from slot 0

------------------------------------------------------------------------

What I was expecting is that upon pressing the button, slot 0 would become empty. Slot 1 would have Dirt and you'd simply drag that dirt into your inventory.

But this is what happened:

1. When pressing the button, the Dirt appears, but when you press it, it disappears and the Diamonds are back in slot 0...

2. When pressing the button, the Dirt appears. When Shift Clicking the Dirt, you make it jump into your inventory. Upon closing your inventory, your Dirt will disappear, leaving you with neither diamonds nor dirt.

3. When pressing the button, the Dirt appears. When Shift Clicking the Dirt, you make it jump into your inventory. If you now press the dirt, it will disappear and your diamonds (that were previously gone) will now be back inside of input slot 0.

4. When leaving your diamonds inside of input slot 0 and closing the GUI (with e), the diamonds will be dropped automatically, but cannot be picked up (not even by a hopper).

Are these behaviours bugs? 

Last seen on 03:25, 18. Oct 2019
Joined Jan 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
can i have a screenshot of…
Fri, 09/20/2019 - 14:11

can i have a screenshot of the procedure and the gui? If so i could help resolve this issue hopefully.

Last seen on 03:25, 18. Oct 2019
Joined Jan 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I would make it so its "If"…
Fri, 09/20/2019 - 14:39

I would make it so its "If" item in slot 0 is diamond AND "get number of items from slot 0" is > or = 1 AND item in slot 3 is air OR item in slot 3 is Dirt
"Do" Set items in slot 3 to "Get number of items in slot 3" +1

Last seen on 12:10, 18. Oct 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Still the same issue. It may…
Fri, 09/20/2019 - 14:59

Still the same issue. It may be related to the Mac version? (1.9.0)

 

I discovered that when you:

1. Press the + button --> Shift click the Dirt into your inventory --> reopening GUI will make the dirt disappear out of Your inventory... but..

2. Press the + button --> Shift click the Dirt into your inventory --> Switching a random item around in your inventory --> reopening GUI will no longer make the dirt disappear. (Dragging from the 3rd slot still doesn't work).

Even if you do step 1 for a second time, the dirt you did in step 2 will stay in your inventory and only the dirt that has been there without any switching around will disappear when reopening the GUI.

Very strange.

 

 

Last seen on 03:25, 18. Oct 2019
Joined Jan 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Maybe, this is an issue…
Fri, 09/20/2019 - 15:03

Maybe, this is an issue outside of what i can do... Maybe remove the need for the + button by using the "Update Tick" event on the block the inventory is attached to? This may fix the issue

Last seen on 12:10, 18. Oct 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
A video for visualisation:…
Fri, 09/20/2019 - 15:28

A video for visualisation:

https://youtu.be/sYmPup2EGTQ

 

---

I originally did it without the + button and did it on input slot call, which is where the issue started. I fear the worst for Update Tick. It would also be less efficient code to have the state of slot 1 checked so many times.

 

Last seen on 03:25, 18. Oct 2019
Joined Jan 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I get home in about 5 hours,…
Fri, 09/20/2019 - 15:33

I get home in about 5 hours, once i do i can make you a procedure, if you'd like i can make a model and texture for your trader as well

Last seen on 12:10, 18. Oct 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
The texture of the model is…
Fri, 09/20/2019 - 15:50

The texture of the model is a test placeholder I slammed on for testing.

I am planning on creating a specific texture related to this mod & dimension for this mob later once the environment is finished.

I hope the procedures work for you, because I am bazzled at why the things happen the way they do in the video xD