how do the loop arg 1 times

  • 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.
Jan 2, 2020
3
0
1
23
Code:
command /dupetest [<text>]:
    trigger:
        if arg 1 is not set:
            give player's tool to player
        if arg 1 is set:
            loop arg 1 times:
                give player's tool to player
i want to do this but it just screeches at me
 
try this
Code:
command /example [<text>]
      trigger:
           if argument 1 is not set:
                 give player’s tool to player
           if argument 1 is set:
                 loop 1 time:
                    give player’s tool to player
 
try this
Code:
command /example [<text>]
      trigger:
           if argument 1 is not set:
                 give player’s tool to player
           if argument 1 is set:
                 loop 1 time:
                    give player’s tool to player
Wouldnt that just dupe the item once though? I want it to dupe the amount of times specified, so for example i do /dupe 6, it would loop 6 times without my code being huge, like it is right now.
 
try this
Code:
command /example [<text>]
      trigger:
           if argument 1 is not set:
                 give player’s tool to player
           if argument 1 is set:
                 loop %arg-1% time:
                    give player’s tool to player
 
I don't know what skript's function is, but if you're going to use that format in the loop, you can't put the argument as a text. The correct way would be something like this:

code_language.skript:
command /dupetest [<int>]:
    trigger:
        if arg 1 isn't set:
            give player's tool to player
        else:
            loop arg 1 times:
                give player's tool to player
[doublepost=1578044524,1578044241][/doublepost]
try this
Code:
command /example [<text>]
      trigger:
           if argument 1 is not set:
                 give player’s tool to player
           if argument 1 is set:
                 loop %arg-1% time:
                    give player’s tool to player
The percentage cannot go that way. The correction would be:
code_language.skript:
loop arg 1 times:
Or
code_language.skript:
set {_num} to "%arg 1%" parsed as integer
loop {_num} times
its same.
 
Code:
command /dupe [<integer>]:
    trigger:
        if arg 1 is not set:
            give player's tool to player
        if arg 1 is set:
            loop arg-1 times:
                player can hold player's tool
                give player's tool to player
 
Status
Not open for further replies.