Solved I don't know what the problem is

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

KarimAKL

Active Member
Apr 20, 2018
50
2
0
29
Okay so i just created a script and it works fine but one little thing doesn't change and i don't know how to fix it and i don't know what the problem is really.. :/
Here is the code with the problem:
code_language.skript:
Command /command [<text>] [<integer>]:
    Permission: skript.command
    Permission message: &cYou do not have permission to use this command!
    Description: Test
    Usage: /command <text> [integer]
    Aliases: /cmd
    Trigger:
        if player is in world "world":
            if arg-1 is not set:
                message "&cArgument 1 needed!"
            else:
                if arg-1 is "Test1":
                    if arg-2 is not set:
                        message "&aTest1 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            message "&cTest1 with argument 2 works"
                else if arg-1 is "Test2":
                    if arg-2 is not set:
                        message "&aTest2 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            set {variable} to arg-2
                            message "&aTest2 with argument 2 works"
                else if arg-1 is "Test3":
                    if arg-2 is not set:
                        message "&aTest3 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            set {variable} to arg-2
                            message "&aTest3 with argument 2 works"
                else if arg-1 is "Test4":
                    if arg-2 is not set:
                        message "&aTest4 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            set {variable} to arg-2
                            message "&aTest4 with argument 2 works"
                else:
                    message "&cThis test does not exist!"
        else:
            message "&cThis command is only for world!"
The problem is if i execute this command "/command (test1, test2, test3 or test4) 20.5" (the 20.5 is just an example) then it'll tell me "&cThis test does not exist!" even tho i did use argument 2 and i have tried changing it to this:
code_language.skript:
else:
    if arg-2 is not set:
        message "&cThis test does not exist!"
    else:
        message "&cArgument 2 needs to be a number"
And i've also tried using this line:
code_language.skript:
if arg-2 is not integer:
But it didn't change anything, my guess is that it doesn't register arg-2 as set because it isn't an integer but how would i change that? Maybe changing the command from
code_language.skript:
Command /command [<text>] [<integer>]:
to
code_language.skript:
Command /command [<text>] [<text>]:
and then use the line:
code_language.skript:
if arg-2 is not integer:
to check if it's an integer. That's one way i think will work but is there an easier way? :7
Thank you for reading my problem. :emoji_slight_smile:
 
Are you sure you're not just typing it wrong? String comparisons are generally case-sensitive so if you're checking for "Test1" but entering "test1" it probably won't work.
 
I think the problem is that skript will interpret the 20.5 as a text. because an integer can only take full numbers. if you just replace the word integer with number skript will know what to do :emoji_slight_smile:
 
I think the problem is that skript will interpret the 20.5 as a text. because an integer can only take full numbers. if you just replace the word integer with number skript will know what to do :emoji_slight_smile:
The thing is i don't want them to be able to do something.something i just want the message to be different if they write something.something, something like "You can only use full numbers for this". :emoji_stuck_out_tongue: It's not really that important but i just want it that way and it would help me with scripts in the future if i knew how to fix this.
 
just trick the system :emoji_stuck_out_tongue:
code_language.skript:
Command /command [<text>] [<integer>]:
    Permission: skript.command
    Permission message: &cYou do not have permission to use this command!
    Description: Test
    Usage: /command <text> [integer]
    Aliases: /cmd
    Trigger:
        if player is in world "world":
            if arg-1 is not set:
                message "&cArgument 1 needed!"
            else:
                if arg-1 is "Test1":
                    if arg-2 is not set:
                        message "&aTest1 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            message "&cTest1 with argument 2 works"
                else if arg-1 is "Test2":
                    if arg-2 is not set:
                        message "&aTest2 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            set {variable} to arg-2
                            message "&aTest2 with argument 2 works"
                else if arg-1 is "Test3":
                    if arg-2 is not set:
                        message "&aTest3 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            set {variable} to arg-2
                            message "&aTest3 with argument 2 works"
                else if arg-1 is "Test4":
                    if arg-2 is not set:
                        message "&aTest4 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            set {variable} to arg-2
                            message "&aTest4 with argument 2 works"
                else:
                    if arg 1 contains " " or ".":
                        message "only full numbers :p"
                    else:
                        message "&cThis test does not exist!"
        else:
            message "&cThis command is only for world!"
 
just trick the system :emoji_stuck_out_tongue:
code_language.skript:
Command /command [<text>] [<integer>]:
    Permission: skript.command
    Permission message: &cYou do not have permission to use this command!
    Description: Test
    Usage: /command <text> [integer]
    Aliases: /cmd
    Trigger:
        if player is in world "world":
            if arg-1 is not set:
                message "&cArgument 1 needed!"
            else:
                if arg-1 is "Test1":
                    if arg-2 is not set:
                        message "&aTest1 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            message "&cTest1 with argument 2 works"
                else if arg-1 is "Test2":
                    if arg-2 is not set:
                        message "&aTest2 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            set {variable} to arg-2
                            message "&aTest2 with argument 2 works"
                else if arg-1 is "Test3":
                    if arg-2 is not set:
                        message "&aTest3 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            set {variable} to arg-2
                            message "&aTest3 with argument 2 works"
                else if arg-1 is "Test4":
                    if arg-2 is not set:
                        message "&aTest4 works"
                    else:
                        if arg-2 is less than 0:
                            message "&cArgument 2 can't be lower than 0!"
                        else:
                            set {variable} to arg-2
                            message "&aTest4 with argument 2 works"
                else:
                    if arg 1 contains " " or ".":
                        message "only full numbers :p"
                    else:
                        message "&cThis test does not exist!"
        else:
            message "&cThis command is only for world!"
If i remember correctly i tried this already, probably not the exact way but something along the lines, anyway i'll try this now and i'll get back to you. :emoji_slight_smile:
EDIT: Works, thank you. :emoji_slight_smile: Now that i think about it, i think i tried this:
code_language.skript:
if arg-2 contains ".":
And then i think it said something about an entity so i gave up that way. :emoji_stuck_out_tongue: Thank you again for the help. :emoji_grinning:
[doublepost=1527793448,1527188557][/doublepost]I don't know if i should make a new thread or continue this(even tho it says "Solved" and was solved) so i'll ask here.
This worked before but now i updated my Skript version and then it doesn't work. :7 I don't have any idea why.
Current versions and addons:
Skript: 2.2-dev25
Minecraft: 1.8.8
Addons: SkQuery(3.21.4) skript-mirror(0.12.1)

Just wanna say: I haven't changed anything since it worked, i just updated Skript and downloaded skript-mirror to the versions above and then it stopped working like it did. (It still works but now it acts as if arg 2 is not set)

Please tell me if i should make a new thread instead.
 
Status
Not open for further replies.