Solved Save Argument in a list

  • 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.

Anne Schepers

Member
Jul 9, 2017
3
0
1
25
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?
 

Attachments

  • WL_Main_Rideop_Engineer.sk
    16 KB · Views: 218
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?
Turn an argument into a variable? Doing this:
code_language.skript:
command /enginer [<string>] [<string>]:
    trigger:
        arg 1 is "create":
            arg 2 is set:
                if {enginer.names::*} does not contain arg 2:
                    add arg 2 to {enginer.names::*}
                    message "&aAdded."
                    #the rest...
                else:
                    message "&cThat name already exist!"
                    stop
        arg 1 is "edit":
            arg 2 is set:
                if {enginer.names::*} contains arg 2:
                 
                    open chest with 6 rows named "&6%arg 2% Engineer Menu" to player
                    wait 2 ticks
                    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%"]
                    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%"]
                else:
                    send "&cThat name doesn't exist!"
                    stop
I have not tried it, but I think it works.
 
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?
This is working for me:
Code:
command /engineer <text> <text>:
    trigger:
        if arg-1 is "create":
            if arg-2 is set:
                if {YourVariable::list::%arg-2%} is not set:
                    set {YourVariable::list::%arg-2%} to true
                    send "&aDone."
                else:
                    send "&cThat variable already exists."
        if arg-1 is "edit":
            if {YourVariable::list::%arg-2%} is set:
                send "&aEditing %arg-2%"
            else:
                send "&cThat variable doesn't exist."
 
Status
Not open for further replies.