1. 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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[SOLVED] loop do not create command associated to an item

Discussion in 'General' started by iKOKOi, Dec 30, 2020.

Tags:
  1. iKOKOi

    iKOKOi Member

    Joined:
    Dec 30, 2020
    Messages:
    2
    Likes Received:
    0
    (Translated from google)

    My problem is that I cannot make a GUI with a custom command when clicking on it, let me explain:

    Each loop makes a custom command to the item to click, well, it does nothing. It does not create any command associated with the item.

    The portion of code with the mentioned error:

    BUG ON LINE 22 (to run [console command "/insignia show %{_player}% %{_id}%"])
    PD: Compiler don't launch any error btw, "all is correct". It loads correctly, but it does nothing.

    Pls help :emoji_slight_smile:


    EDIT 1: It creates the item correctly, but when you click... it does not run any command.
    EDIT 2: The command i want to run exists, i can run it on chat and works. So...??


    Code (Text):
    1.  
    2. command /insignia [<text>] [<player>] [<integer=1>]:
    3.     aliases: ins
    4.     permission: admin.mode
    5.     trigger:
    6.  
    7.         # GUI de insignias
    8.         if arg-1 is "see":
    9.             open chest with 6 row named "&8[ &eInsignias: &f&l%arg-2%&8 ]" to player
    10.             play sound "block.tripwire.click_on" with volume 100 and pitch 1.5 at player for player
    11.             wait 2 ticks
    12.  
    13.             # Muestra las insignias desbloqueadas del jugador
    14.             set {_player} to "iKOKOi"
    15.             set {_loop} to 54-8
    16.             set {_total} to size of {insignia.iKOKOi::*}
    17.             set {_paginacion} to size of {insignia.iKOKOi::*} / (54-8)
    18.             loop {_loop} times:
    19.                 set {_val} to {_loop}-1
    20.                 set {_id} to (((arg-3)-1)*(54-8) + {_val})
    21.                 if {insignia.%{_player}%::%{_id}%} is set:
    22.                     format slot {_val} of player with {insignia.%{_player}%::%{_id}%} named {insignia.%{_player}%::%{_id}%} to run [console command "/insignia show %{_player}% %{_id}%"]
    23.                 else:
    24.                     if {_id} is less than {_total}:
    25.                         format slot {_val} of player with barrier named "&7&lInsignia desconocida" with lore "&8???" to be unstealable
    26.                     else:
    27.                         format slot {_val} of player with air to be unstealable
    28.                 remove 1 from {_loop}
    29.  
    --- Double Post Merged, Dec 31, 2020, Original Post Date: Dec 30, 2020 ---
    SOLUTION:
    I have just added a listener to the skript and use that value as id of the item to call it custom command


    Code (Text):
    1.  
    2. on inventory click:
    3.     if name of current inventory is "&8[ &eInsignias: &f&l%{insignia.tmp.%player%::0}%&8 ]":
    4.         set {_slot} to the clicked slot
    5.         set {_id} to ({_slot} + ((54-8)*{insignia.tmp.%player%::1}))
    6.         force player run cmd "/insignia show %{insignia.tmp.%player%::0}% %{_id}%" as op
    7.         force player run cmd "/insignia see %{insignia.tmp.%player%::0}%" as op
    8.  
     

Share This Page

Loading...