Law Plugin - Struggling With Variables

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

aliano99

Member
Feb 17, 2017
4
0
0
30
Hey guys!
I'm coding a simple law plugin, here's the code so far. I'm struggling a bit

code_language.skript:
variables:
    {var} = 0
command /createlaw [<text>]:
    trigger:
        argument 1 is set:
            add {var} to {laws::*}
            send "Your law number is %{var}%"
            set {lawtext:%{var}%} to argument 1
            add 1 to {var}
            send "Law Created!"

command /law <text>:
    trigger:
        if "%{laws::*}%" contains "%argument 1%":
            send "%{lawtext:argument 1}%"
Using the example,

" /createlaw Law to Increase Tax" returns a number tagged along with the law, 0, to keep track of the law. Lawtext:0 is set to the string in the command /createlaw, so Lawtext:0 should return "Law to Increase Tax". However, when I use the command /law 0 it returns <none>.

I'm not sure why this is. Thanks!
 
Hey guys!
I'm coding a simple law plugin, here's the code so far. I'm struggling a bit

code_language.skript:
variables:
    {var} = 0
command /createlaw [<text>]:
    trigger:
        argument 1 is set:
            add {var} to {laws::*}
            send "Your law number is %{var}%"
            set {lawtext:%{var}%} to argument 1
            add 1 to {var}
            send "Law Created!"

command /law <text>:
    trigger:
        if "%{laws::*}%" contains "%argument 1%":
            send "%{lawtext:argument 1}%"
Using the example,

" /createlaw Law to Increase Tax" returns a number tagged along with the law, 0, to keep track of the law. Lawtext:0 is set to the string in the command /createlaw, so Lawtext:0 should return "Law to Increase Tax". However, when I use the command /law 0 it returns <none>.

I'm not sure why this is. Thanks!

You need to put %'s around the argument 1 when messaging it, like
Code:
send "%{lawtext::%argument 1%}%"
 
  • Like
Reactions: aliano99
Status
Not open for further replies.