Sign Execute command

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

GToTheG

Member
Jan 26, 2017
35
0
8
23
Hello. Now when the docs is down i need some help.

How do you execute a console or player command, when rightclicking on a sign, with a speciel text on it?

Like if the signs says
Line1: &aHello

It will execute a command.

Thanks :emoji_slight_smile:
 
code_language.skript:
on rightclick on sign:
    if line 1 is "&aHello":
         execute console command "say Hello"
         send "Hello" all players
 
Untested but it should work.

code_language.skript:
On right click on a sign:
    If line 1 of event-block is "&aHello":
        Execute console command "/CMD"
 
You also can do something like that:

code_language.skript:
on rightclick on a sign:
    if line 1 of event-block is "&1[Command]":
        if line 2 of event-block is not empty:
            if line 3 of event-block is not empty:
                execute console command "/%line 2 of event-block% %line 3 of event-block%"
                stop
            else:
                execute console command "/%line 2 of event-block%"
                stop
        else:
            stop
    else:
        stop

So the sign looks like this:

Line 1: &1[Command]
Line 2: name-of-the-command (/say --> say)
Line 3: first-argument (/say hello --> hello)
Line 4: empty

This will execute a console command. You also can change this to an player argument.

Hope this makes it more easy to change the command in-game and not everytime in script.
[doublepost=1485718041,1485433934][/doublepost]So is this the solution you would have or isn't it ? If you ask for something you should say if it is right or wrong :emoji_slight_smile:
 
You also can do something like that:

code_language.skript:
on rightclick on a sign:
    if line 1 of event-block is "&1[Command]":
        if line 2 of event-block is not empty:
            if line 3 of event-block is not empty:
                execute console command "/%line 2 of event-block% %line 3 of event-block%"
                stop
            else:
                execute console command "/%line 2 of event-block%"
                stop
        else:
            stop
    else:
        stop

So the sign looks like this:

Line 1: &1[Command]
Line 2: name-of-the-command (/say --> say)
Line 3: first-argument (/say hello --> hello)
Line 4: empty

This will execute a console command. You also can change this to an player argument.

Hope this makes it more easy to change the command in-game and not everytime in script.
[doublepost=1485718041,1485433934][/doublepost]So is this the solution you would have or isn't it ? If you ask for something you should say if it is right or wrong :emoji_slight_smile:
You use way too many extra "stop" effects. You don't need to use stop unless there is code that is being executed AFTER the stop effect. For example:
code_language.skript:
if "%player%" is "lol":
    send "You are lol."
    stop
send "You are not lol."

However, since there is nothing being executed after the stop effects or even for the inverse of the if values, there is no need to use stop at all.
code_language.skript:
on rightclick on a sign:
    if line 1 of event-block is "&1[Command]":
        if line 2 of event-block is not empty:
            if line 3 of event-block is not empty:
                execute console command "/%line 2 of event-block% %line 3 of event-block%"
            else:
                execute console command "/%line 2 of event-block%"
 
Status
Not open for further replies.