Tuke-Nuke / TuSKe

TuSKe is a Skript addons which brings some new cool things and some simple plugins hook.
18 stars 36 forks source link

Advanced GUI with variable list #19

Closed weberlepecheur closed 7 years ago

weberlepecheur commented 7 years ago

Hi, i have a litte problem with that :

set {_slot} to 0
create a gui with virtual chest with 1 rows named "Ecc avr var":
    loop {ecc::*}:
        make gui slot {_slot} with player's skull named "%{ecc::%loop-value%::title}%" with lore "&r ||%{ecc::%loop-value%::lore}%":
            send "%{_slot}% §7- §r%{ecc::%loop-value%::loc}%"
        add 1 to {_slot}
    open last gui to player

He returns a < none > for the variable %{ecc::%loop-value%::loc}%

Spigot 1.12.2 Skript 2.2-dev31c TuSke 1.8.2-dev6

Blueyescat commented 7 years ago

Please check the system with debug messages. It doesn't look like a TuSKe issue. It depends on content of {ecc::*} list variable as it is {ecc::%loop-value%::loc}, so just do this:

loop {ecc::*}:
    send "{ecc::%loop-value%::loc}"   #there are no missing percent signs

And see if output variable is what you want or not.


Oh, maybe you need loop-index instead of loop-value? I think yes. For example if you do set {ecc::test} to 1, then loop-value is 1 and loop-index is "test".

Note: Do not put open last gui to player in create gui codeblock

weberlepecheur commented 7 years ago

Okay i tried that and he answer me this:

[20:37:19] [Server thread/INFO]: [Skript] send "%0% §7- §r{ecc::%< none >%::loc}" to [player:WeBer_Le_Pecheur [location:(world:176.2135620981712,123.0,258.1550533327291|yaw=-16.019093/pitch=12.650196)]]

My code (updated with your note):

set {_slot} to 0
create a gui with virtual chest with 1 rows named "Ecc avr var":
    loop {ecc::*}:
        make gui slot {_slot} with player's skull named "%{ecc::%loop-value%::title}%" with lore "&r ||%{ecc::%loop-value%::lore}%":
            send "%{_slot}% §7- §r{ecc::%loop-value%::loc}"
        add 1 to {_slot}
        # make gui slot 8 with oak door item named "Close":
            # close player's inventory
open last gui to player

For your question, loop-index doesn't work because i use offline player name instead. ecc::weber_le_pecheur::loc, string, 800A726567696F6E74657374

Complete debug log:

[20:37:17] [Server thread/INFO]: [Skript] create gui [20:37:17] [Server thread/INFO]: [Skript] loop [WeBer_Le_Pecheur] [20:37:17] [Server thread/INFO]: [Skript] -make a gui slot 0 of gui with lore [20:37:17] [Server thread/INFO]: [Skript] add [[long:1]] to 1 [20:37:17] [Server thread/INFO]: [Skript] -loop [WeBer_Le_Pecheur] [20:37:17] [Server thread/INFO]: [Skript] $ end section [20:37:17] [Server thread/INFO]: [Skript] open last gui to the player [20:37:17] [Server thread/INFO]: [Skript] # chest took 2.326413 milliseconds [20:37:19] [Server thread/INFO]: [Skript] make a gui slot 0 of gui with lore [20:37:19] [Server thread/INFO]: [Skript] send "%0% §7- §r{ecc::%< none >%::loc}" to [player:WeBer_Le_Pecheur [location:(world:176.2135620981712,123.0,258.1550533327291|yaw=-16.019093/pitch=12.650196)]]

[20:37:19] [Server thread/INFO]: [Skript] == org.bukkit.event.inventory.InventoryClickEvent == [20:37:19] [Server thread/INFO]: [Skript] -x- was cancelled

After your edit post, i tried loop-index but its the same result.

Blueyescat commented 7 years ago

What? How can

send "%{_slot}% §7- §r{ecc::%loop-value%::loc}"

return

 send "%0% §7- §r{ecc::%< none >%::loc}" to [player:WeBer_Le_Pecheur [location:(world:176.2135620981712,123.0,258.1550533327291|yaw=-16.019093/pitch=12.650196)]]

? And the "complete debug log".... Are you sure about what are you doing? Please try it with Skript 2.2-dev29 and Spigot 1.12

Pikachu920 commented 7 years ago

don't you want loop-index not loop-value

weberlepecheur commented 7 years ago

Skript: config.sk - line 109 - verbosity : debug

For debug log you prefer this ? https://pastebin.com/raw/Ta6G33dA I will go test with dev29

Edit: Same results with dev29 and 1.12.0

@Pikachu920 I tried loop-index and loop-value, the two gives me the same result

Blueyescat commented 7 years ago

:slightly_frowning_face: Disable verbosity (set it to normal) and install dev29 and 1.12, and use this code:


set {_slot} to 0
create a gui with virtual chest with 1 rows named "Ecc avr var":
    loop {ecc::*}:
        send "&a{ecc::%loop-value%::loc}"
        send "&c{ecc::%loop-index%::loc}"
        make gui slot {_slot} with player's skull named "%{ecc::%loop-value%::title}%" with lore "&r ||%{ecc::%loop-value%::lore}%":
            send "%{_slot}% §7- §r%{ecc::%loop-value%::loc}%"
        add 1 to {_slot}
open last gui to player```
weberlepecheur commented 7 years ago

@Blueyescat I disable verbosity, paste your code and this : 2017-10-17_21 36 21

Blueyescat commented 7 years ago

Then, looks like there is no any problem. {ecc::weber_le_pecheur::loc} variable is not set.

weberlepecheur commented 7 years ago

variable is set, since the beginning.

https://pastebin.com/Q58XNp3X

Blueyescat commented 7 years ago

Run this code and type the command :thinking:

weberlepecheur commented 7 years ago

2017-10-17_21 53 32

Blueyescat commented 7 years ago

Sorry, try this: https://hastebin.com/eguwugoyig.vbs

weberlepecheur commented 7 years ago

2017-10-17_21 56 31

Blueyescat commented 7 years ago

Doesn't it send the "0 - <none>" message after you click on item in gui?

weberlepecheur commented 7 years ago

Yes, of course

weberlepecheur commented 7 years ago

Before 2017-10-17_22 00 35

After click (and close gui manually) 2017-10-17_22 00 45

Blueyescat commented 7 years ago

Then try this: https://hastebin.com/ecihoworiw.vbs

weberlepecheur commented 7 years ago

Error with : send "&a{ecc::%loop-value%::loc}" to gui-player

[22:03:38] [Server thread/ERROR]: You can't use 'gui-player' outside of a 'make gui', 'format gui slot' or 'run when close' section. (test.sk, line 36: send "&a{ecc::%loop-value%::loc}" to gui-player') [22:03:38] [Server thread/ERROR]: You can't use 'gui-player' outside of a 'make gui', 'format gui slot' or 'run when close' section. (test.sk, line 37: send "&c{ecc::%loop-index%::loc}" to gui-player')

correct in : send "&a{ecc::%loop-value%::loc}" to player

and results : 2017-10-17_22 06 31

Blueyescat commented 7 years ago

Interesting, then looks like a TuSKe problem... image These codes are the same, but returns none in create gui part. (The two lines that gives error aren't important) We should wait @Tuke-Nuke...

weberlepecheur commented 7 years ago

All right, thank you for your time @Blueyescat despite the difficulties to communicate my problem at the beginning ^^

Tuke-Nuke commented 7 years ago

Hey, it is easy fixable by just seting a variable before make gui slot effect

loop {eec::*}:
    set {_value} to loop-value
    set {_index} to loop-index
    make gui slot {_slot} with player's skul....:
        send "%{_index}%: %{_value}%"

Why it happens? Well, because this current system is not properly supported by Skript, so there is some workaround to make it work. But, in Skript, loops works a bit different, the expression loop-index/value only store the value while it is looping, so in the end of that, it will have the last loop index/value because when the gui action is executed, the loop is already finished. So it is more a Skript "limitation", but it can be easily fixed with variables.

Let me know if afther that, it still not working. Thank's for reporting it.

weberlepecheur commented 7 years ago

@Tuke-Nuke it works as I wanted. Thanks you very much !

HYPExMon5ter commented 7 years ago

Shouldn’t this be closed @Tuke-Nuke ?

Tuke-Nuke commented 7 years ago

@HYPExMon5ter Sure, thank's.