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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

Solved Save Argument in a list

Discussion in 'Skript' started by Anne Schepers, Jun 7, 2020.

Thread Status:
Not open for further replies.
  1. Anne Schepers

    Anne Schepers Member

    Joined:
    Jul 9, 2017
    Messages:
    3
    Likes Received:
    0
    hello, how do I turn an argument into a variable, and then put it in a list, and how can I load that argument back from that list?
    as an example:
    I've entered an argument, /engineer create name. I save it in a list. Then I type /engineer edit name, and if I enter the same name as what I saved, it runs something.
    Do you guys know how I make this?
     

    Attached Files:

  2. Best Answer:
    Post #2 by couger44, Jun 8, 2020
  3. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    Turn an argument into a variable? Doing this:
    Code (Skript):
    1.  
    2. command /enginer [<string>] [<string>]:
    3.     trigger:
    4.         arg 1 is "create":
    5.             arg 2 is set:
    6.                 if {enginer.names::*} does not contain arg 2:
    7.                     add arg 2 to {enginer.names::*}
    8.                     message "&aAdded."
    9.                     #the rest...
    10.                 else:
    11.                     message "&cThat name already exist!"
    12.                     stop
    13.         arg 1 is "edit":
    14.             arg 2 is set:
    15.                 if {enginer.names::*} contains arg 2:
    16.                  
    17.                     open chest with 6 rows named "&6%arg 2% Engineer Menu" to player
    18.                     wait 2 ticks
    19.                     format slot 2 of player with red concrete named "&3Set On/Off" with lore "&aClick Here" to run [make player execute "/engineer2 setmenu onoff %arg 2%"]
    20.                     format slot 2 of player with red concrete named "&3Set Crew/VIP" with lore "&aClick Here" to run [make player execute "/engineer2 setmenu crewvip %arg 2%"]
    21.                 else:
    22.                     send "&cThat name doesn't exist!"
    23.                     stop
    I have not tried it, but I think it works.
     
  4. PuchiGFX

    PuchiGFX Member

    Joined:
    Jan 26, 2017
    Messages:
    246
    Likes Received:
    5
    This is working for me:
    Code (Text):
    1. command /engineer <text> <text>:
    2.     trigger:
    3.         if arg-1 is "create":
    4.             if arg-2 is set:
    5.                 if {YourVariable::list::%arg-2%} is not set:
    6.                     set {YourVariable::list::%arg-2%} to true
    7.                     send "&aDone."
    8.                 else:
    9.                     send "&cThat variable already exists."
    10.         if arg-1 is "edit":
    11.             if {YourVariable::list::%arg-2%} is set:
    12.                 send "&aEditing %arg-2%"
    13.             else:
    14.                 send "&cThat variable doesn't exist."
     
Thread Status:
Not open for further replies.

Share This Page

Loading...