Multiple Types in One Argument...?

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

Eggie

New Member
Feb 27, 2019
8
0
0
20
I don't know how to explain this, but I would like to know if there is a way an argument can be multiple types. For example (this doesn't work...):

Code:
command /test [<text or player>]:
    trigger:
       #does something....

I doubt this is possible but if there is a way, plez welp… Thanks!
 
There is no way that I know of where you can do this. My suggestion to you is to make it a text. With a text you can parse it as a player if needed and do whatever you need to do.
 
My suggestion to you is to make it a text.
As he said, you could make it into a text type and parsed it as a player when it's needed.

This is my example in order to do so.
Code:
command /test <text>:
    trigger:
        if arg is "version":
            send "This skript is on version 1.1"
        else if arg parsed as offlineplayer is online:
            send "%arg% is currently online! owo uwu owo"
        else:
            send "&cYou must enter a valid player name."
        stop
 
Yes, I have been doing that. It sucks that you can’t use tab to quickly get a player’s name.

And I’ve tried this after requesting for help:
Code:
command /test [[<player>] [<text>]]:
    #arg 1 player
    # arg 2 text

It works... kind of. If they only type in a player’s name, arg 1 is set but arg 2 isn’t. If they only type in a player’s name, but it’s incorrect, it becomes a text instead of a player argument. The problem is if the command needs to have more than 2 arguments, the order of the types are player, text, and your other arguments. So I don’t know, maybe if I take away “< >” from the text argument, it might work the way I want, but probably not.

Thanks anyways!
 
There is also the On Tab Complete event from several addons. IF you really want to add tabbing for player names, you can use that event and make it to where you can tab player names for specific commands/arguments.
 
Status
Not open for further replies.