Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how unformat works with guis using shape #42

Closed
Fusezion opened this issue Jul 22, 2021 · 7 comments
Closed

Change how unformat works with guis using shape #42

Fusezion opened this issue Jul 22, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@Fusezion
Copy link
Contributor

Description

So I've decided to mess with shapes in guis recently and I've started to grow on them
however, I do have an issue with them and it's the way unformat gui slot "string" works with it

Example code I'm going off of

command /example:
	trigger:
		create a gui with virtual chest inventory with 1 row named "" with shape "XX11111XX":
			format gui slot "X" with black glass pane named " "
			unformat gui slot "1"
			format next gui slot with stone named "Example Item 1"
			format gui slot 3 with dirt named "Example Item 2"
		open last gui to player

When you first glance as this code you'd think that after unformatting the value "1" it would clear it from
the shape but sadly that isn't how it works. Instead if you unformat "1" it does set it to air
however, if I was to format next gui slot or format gui slot 3 after instead of only that slot change
it's all slots with a value of "1"

Now I don't believe this is a bug as if I remember correctly this is how it works in TuSKe too
so what I'm asking for is when you unformat a string in a shape gui that it removes that value
instead of keeping it since using shape for a shop or any other gui is much easier but sadly we can't
if that's how it works

@Fusezion Fusezion added the enhancement New feature or request label Jul 22, 2021
@APickledWalrus
Copy link
Owner

I recommend in this case to just change the GUI's shape after unformatting the slots.

@Fusezion
Copy link
Contributor Author

I recommend in this case to just change the GUI's shape after unformatting the slots.

okay well just something I think would be good

@APickledWalrus
Copy link
Owner

I don't think I'm really in favor of changing the behavior here. I would say I could add an option to clear the character from the shape, but I don't think that is really necessary when you can just change the shape after.

@Fusezion
Copy link
Contributor Author

I don't think I'm really in favor of changing the behavior here. I would say I could add an option to clear the character from the shape, but I don't think that is really necessary when you can just change the shape after.

I mostly find it repetitive to do that as you're still limited to a set amount of strings and using format next gui slot without needing to do more steps just seems better

@APickledWalrus
Copy link
Owner

I suppose I could add it as an option, but do you have any specific examples of where you think this is needed?

@Fusezion
Copy link
Contributor Author

I suppose I could add it as an option, but do you have any specific examples of where you think this is needed?

overall there are areas this will always be useful for but adding borders to guis is my primary since if unformat gui slot was to work correctly (#41) you'd currently need to do

command /example:
  trigger:
    loop 21 times:
      add stone named "##%loop-value%" to {_values::*}
    create a gui with virtual chest inventory with 5 rows named "Example":
      format gui slot (integers from 0 to 44) with black glass pane named " "
      # Example 1
      loop (integers from 10 to 16):
        unformat gui slot (loop-value)
        unformat gui slot (loop-value)+9
        unformat gui slot (loop-value)+18
      # Example 2
      unformat gui slot (integers from 10 to 16 and integers from 19 to 25 and integers from 28 to 34)
      # With more ways just to do that same thing
      loop {_values::*}:
        format next gui slot with loop-value
    open last gui to player

Not only does this take longer than doing unformat gui slot "a" it's more wasted time

for me personally this is where I'd use it from the top of my head and I could bet other creators using this addon
would find more usages for this

Side Note: along with adding the ability to clear a single shape value I'd say also maybe making reset gui-shape remove all shape data but keep the items in place as while I was testing I noticed even if I reset and I use next gui slot it still filled all gui slots with the slot's original value

Example with the ability to clear a select slot

command /example:
  trigger:
    loop 21 times:
      add stone named "##%loop-value%" to {_values::*}
    create a gui with virtual chest inventory with 5 rows named "Example" with shape "BBBBBBBBB", "BbbbbbbbB", "BbbbbbbbB", "BbbbbbbbB" and "BBBBBBBBB"
      format gui slot "B" with black glass pane named " "
      unformat gui slot "b"
      loop {_values::*}:
        format next gui slot with loop-value
    open last gui to player

@APickledWalrus
Copy link
Owner

Things like unformat gui slot "a" where "a" is the border slots should work fine - I will look into the issue you mentioned though about issues with unformatting slots. Also, resetting the gui shape is actually implemented and should be possible in the next alpha release :D

I think in your cases, you are better off just changing the shape or resetting it. Because of that, I am going to close this issue as I don't see this enhancement really being necessary. If you have any additional comments to make here, feel free to continue sharing them 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants