Solved How to use arg-1 for the next paragraph?

  • 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.
code_language.skript:
command /test  <text>:
    trigger:
        open an anvil gui named "Test" to player with default text "Write what you want!"
        
on close anvil gui named "Test":
    broadcast "%arg-1%  %event-text%!"
 
easy peasy

so set a variable from your arg, and broadcast your variable instead

code_language.skript:
command /test  <text>:
    trigger:
        open an anvil gui named "Test" to player with default text "Write what you want!"
        set {text::text} to arg-1
      
on close anvil gui named "Test":
    broadcast "%{text::text}%  %event-text%!"
    clear {text::text}
 
  • Like
Reactions: Galacticstar123
this is the basic of what you are looking for

in your command (the one that opens the anvil gui) set a variable to your argument
then in your event that has no arg, use the variable instead

code_language.skript:
command /anvil <player>:
    trigger:
        set {command::arg} to arg-1

on event:
    #do something
    #where you would want to use your argument, use {command::arg} instead
    #because {command::arg} is now set to whatever you had in the original argument

    #after you are done with your argument, clear it
    clear {command::arg}
Ty I’ll try it as soon as I get home :emoji_grinning:
[doublepost=1528934094,1528933309][/doublepost]
easy peasy

so set a variable from your arg, and broadcast your variable instead

code_language.skript:
command /test  <text>:
    trigger:
        open an anvil gui named "Test" to player with default text "Write what you want!"
        set {text::text} to arg-1
     
on close anvil gui named "Test":
    broadcast "%{text::text}%  %event-text%!"
    clear {text::text}
Just asking 1 more question, because I am using the variable in a command, is that possible?
 
Ty I’ll try it as soon as I get home :emoji_grinning:
[doublepost=1528934094,1528933309][/doublepost]
Just asking 1 more question, because I am using the variable in a command, is that possible?
Based on your code you sent you aren’t using a variable in your command. You are just setting it.
But yes, you are able to use a variable in a command. Well... I guess it would depend on exactly how you’re using it
 
  • Like
Reactions: Galacticstar123
this is the basic of what you are looking for

in your command (the one that opens the anvil gui) set a variable to your argument
then in your event that has no arg, use the variable instead

code_language.skript:
command /anvil <player>:
    trigger:
        set {command::arg} to arg-1

on event:
    #do something
    #where you would want to use your argument, use {command::arg} instead
    #because {command::arg} is now set to whatever you had in the original argument

    #after you are done with your argument, clear it
    clear {command::arg}
Thank you so much, it worked :emoji_grinning:
 
Status
Not open for further replies.