Is it possible to shorten this?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

DOGGYR3MIX

Member
Jan 17, 2021
3
0
1
24
I've only been learning skript for around a week and learnt to do meta data tag to open a gui. Yesterday I learnt of 'open chest with _ rows named "_" to player and format gui slot. If I make a while to count up to 53 and then set slot to the variable counting upwards it sets all the slots to the item. As you can see I need it so if player has permission it shows hopper if they don't it shows barrier. I I tried doing:

if player has permission "%{Test::%{_count}%}%.permission":

but this sets the slots to nothing?

Below is the meta data tag inventory slots I set up which as you can see would be 4 lines per slot meaning a double chest would have 216 lines. Also below is the way I tried to set the variable to count upwards and set the slots depending on what number the variable is set to at the time.

Original meta data slots
if player has permission "%{Test::1}%.permission":
set slot 1 of metadata tag "Test" of player to hopper named "&f1. Test"
if player doesn't have permission "%{_Test::1}%.permission":
set slot 1 of metadata tag "Tag59" of player to barrier named "&f1. Test"

New attempted slots
open chest with 6 rows named "Test" to player
set {_i} to 1
while {_i} is less than 54:
set {_ii} to {_i}
add 1 to {_i}
if player has permission "%{Test::%{_ii}%}%.permission":
format gui slot {_ii} of player with hopper named "&f1. Test"
else:
format gui slot {_ii} of player with barrier named "&f1. Test"

If I remove the if and else and barrier line it will set all the needed slots to the hopper, when I add needed permissions it no longer works.

I apologise for the lack of structure to this post, I'm not sure how to set it up more neatly. I appreciate any help I can get.
 
I've only been learning skript for around a week and learnt to do meta data tag to open a gui. Yesterday I learnt of 'open chest with _ rows named "_" to player and format gui slot. If I make a while to count up to 53 and then set slot to the variable counting upwards it sets all the slots to the item. As you can see I need it so if player has permission it shows hopper if they don't it shows barrier. I I tried doing:

if player has permission "%{Test::%{_count}%}%.permission":

but this sets the slots to nothing?

Below is the meta data tag inventory slots I set up which as you can see would be 4 lines per slot meaning a double chest would have 216 lines. Also below is the way I tried to set the variable to count upwards and set the slots depending on what number the variable is set to at the time.

Original meta data slots
if player has permission "%{Test::1}%.permission":
set slot 1 of metadata tag "Test" of player to hopper named "&f1. Test"
if player doesn't have permission "%{_Test::1}%.permission":
set slot 1 of metadata tag "Tag59" of player to barrier named "&f1. Test"

New attempted slots
open chest with 6 rows named "Test" to player
set {_i} to 1
while {_i} is less than 54:
set {_ii} to {_i}
add 1 to {_i}
if player has permission "%{Test::%{_ii}%}%.permission":
format gui slot {_ii} of player with hopper named "&f1. Test"
else:
format gui slot {_ii} of player with barrier named "&f1. Test"

If I remove the if and else and barrier line it will set all the needed slots to the hopper, when I add needed permissions it no longer works.

I apologise for the lack of structure to this post, I'm not sure how to set it up more neatly. I appreciate any help I can get.


First, at the top were you post a thread, thee is a [+] just go ahead and click that and press code. Then, enter your code there!

This is surprising to me. A week and you're already able to do all this? I mean I knew Skript was easier than people think, but I did not know it was THAT easy!

Honestly I didn't look look at the code, I just glanced, but I don't see anything wrong.

I do not think there is a way to shorten this. I could, in fact, be wrong!
 
I've only been learning skript for around a week and learnt to do meta data tag to open a gui. Yesterday I learnt of 'open chest with _ rows named "_" to player and format gui slot. If I make a while to count up to 53 and then set slot to the variable counting upwards it sets all the slots to the item. As you can see I need it so if player has permission it shows hopper if they don't it shows barrier. I I tried doing:

if player has permission "%{Test::%{_count}%}%.permission":

but this sets the slots to nothing?

Below is the meta data tag inventory slots I set up which as you can see would be 4 lines per slot meaning a double chest would have 216 lines. Also below is the way I tried to set the variable to count upwards and set the slots depending on what number the variable is set to at the time.

Original meta data slots
if player has permission "%{Test::1}%.permission":
set slot 1 of metadata tag "Test" of player to hopper named "&f1. Test"
if player doesn't have permission "%{_Test::1}%.permission":
set slot 1 of metadata tag "Tag59" of player to barrier named "&f1. Test"

New attempted slots
open chest with 6 rows named "Test" to player
set {_i} to 1
while {_i} is less than 54:
set {_ii} to {_i}
add 1 to {_i}
if player has permission "%{Test::%{_ii}%}%.permission":
format gui slot {_ii} of player with hopper named "&f1. Test"
else:
format gui slot {_ii} of player with barrier named "&f1. Test"

If I remove the if and else and barrier line it will set all the needed slots to the hopper, when I add needed permissions it no longer works.

I apologise for the lack of structure to this post, I'm not sure how to set it up more neatly. I appreciate any help I can get.
i dont understand anything of your code, please use what TehCheetah told you to.
 
Status
Not open for further replies.