What is Guistate and how do i use it.

Started by Lilmrmagoo on

Topic category: Help with MCreator software

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What is Guistate and how do i use it.

so i am trying to put a procedure on certain slots that will check if the item is the same as what's already in there or not when trying to add items to it and I'm wondering if I can get the slot id that is having items be put into it as I'm not sure what the GUI state dependency is I figured maybe that will have something to do with it. really i want to know what info guistate gives and what name i need to put like with command procedures

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There's a block in the…
Thu, 08/27/2020 - 03:55

There's a block in the procedure editor under "Slot & GUI procedures" that allows you to get the item in the different slots based on the ID of each slot. Then you can check if (item in slot) is equal to (item), do (something).

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can use something like …
Thu, 08/27/2020 - 03:57

You can use something like "on entity tick update" to check when the GUI is open as well, and only run that procedure whenever the GUI is open, ending it when it's closed. You can do this by setting a variable to true when the player opens the GUI, checking if the variable is true to run the commands you want to, then setting it back to false when the GUI is closed so it stops running and doesn't break anything.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i know about the get item…
Thu, 08/27/2020 - 04:30

i know about the get item from slot. i want to be able to get the id of the slot that the item is being removed or added into so i don't have to check every single slot.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also currently you can't do…
Thu, 08/27/2020 - 04:33

also currently you can't do the same thing as if you had a gui open/close procedure trigger as they would give certain data from the gui wich you wouldn't be able to access outside of it. luckily that is coming in the next version. sadly I can't use it right now though because there aren't any snapshots yet.

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can check every slot by…
Thu, 08/27/2020 - 04:47

You can check every slot by using the repeat function for how many slots their are, just adding one to a variable for each repetition, effectively iterating through each slot with just a couple blocks. Also, if your GUI is attached to an entity or a block, you can use the "raytrace" blocks to check if the player is looking at the entity or block, and if so, run the commands for the GUI in the player tick update event. When they aren't looking at them, disable it. It's a way to check if a GUI is opened/closed with what we have available right now.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hmm, that's a good idea i…
Thu, 08/27/2020 - 04:57

hmm, that's a good idea i never thought of doing it via raytracing though sadly it won't work for me as i need to access a text field in the GUI which requires the GUI state dependency. also yeah I decided to loop through each slot. but my point still stands that if we could get the slot id as a dependency it would be nice.

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The "text inside textfield"…
Thu, 08/27/2020 - 05:24

The "text inside textfield" block works without the GUI state dependency if that's what you mean, and can be utilized using the procedure ideas I mentioned. It only requires the entity dependency, I'm not sure why you thought it needed the GUI state. Also, there's really no point in getting the slot ID, as you can already access all of them based on their ID anyways. So unless you explain exactly what you're trying to do, I'm gonna be super lost.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I mean at this point I have…
Thu, 08/27/2020 - 05:57

I mean at this point I have found a workaround. but my original plan was to make a procedure that when you put something into the slot it would then check every other slot and tally up the total number of duplicate items. I just like not having to use many while loops as they a: can cause lag and b: hurt my brain when they don't work. so I prefer to have my procedures have a variable that would change depending on the event wich triggered it without loops. 

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also are you sure the get…
Thu, 08/27/2020 - 05:58

also are you sure the get text from text field doesn't require the guistate dependency  because it adds it to a procedure when its added.

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What trigger are you using…
Thu, 08/27/2020 - 06:00

What trigger are you using for the procedure? And yes, I’m sure. It works without it and doesn’t require it. I tested it before replying. I always test my answers before responding to make sure they work.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
on player tick update and…
Thu, 08/27/2020 - 06:11

on player tick update and did you actually add the block to something that was connected because it doesn't add a dependency otherwise

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What do you mean “add the…
Thu, 08/27/2020 - 06:28

What do you mean “add the block to something that was connected”? I tested it with a custom made GUI and procedure. As well as a text field within the GUI. I can access the GUI, textfield, and modify the text field from within the player tick update event. It all works as expected.