Tutorial/Advanced Usage
Advanced Usage
Effective as of CommandSigns v1.8.0
Allowing use of OP commands
If the command '/i diamond 1' is on a CommandSign, you may find that only operators and those with enough permission will be able to use the command. But if you want anyone to be able to use the command, you need to do one of the three following things.
There are 'meta-characters' that can go just after the forward slash '/' in your command. These meta-characters are '*', '^' and '#'. They're used like this.
1. /*acommand 2. /^anothercommand 3. /#yetanothercommand
This is what they do:
- '*' means that the user will have access to the '*' permission node (everything) whilst running the sign.
- '^' means that the user will be granted OP whilst running the sign.
- '#' means that the command will be run from the console, without any player data being sent along with it.
So as for the '/i' command, it would make sense to run it as an OP because by default, OPs can use it. '/*' will also work, whereas '/#' will not as the command does need player information to work.
1. /^i diamond 1
Sorted.
Variables
Variables are bits of text in your CommandSign that can change according to various conditions. An example is the name of the player that clicked the sign, or their location.
Variables are accessed like this:
/commandsigns line1 /dosomethingwith <variablename>
The variable can be one of the following:
- <x> - Player's x coordinate
- <y> - Player's y coordinate
- <z> - Player's z coordinate
- <world> - Player's current world
- <name> - Player's user name
- <display> - Player's display name
- <money> - Player's current money balance
- <formatted> - Player's current money balance formatted. (Ex. "10.00 dollars")
Here's a fun one for you:
/commandsigns line1 /nuke <name>
Restrictions and Permissions
It's all well and good if you just want to make a list of commands to run, but what if you only want some users to be able to use it, or have a delay between using it. This is a job for restrictions.
A restriction goes like this:
- {condition}
- /commands
- -
The {condition} part consists of a symbol, followed by text describing the condition. Here are the valid conditions you can use:
- `@groupname` - Restrict access to only that group.
- `&permission` - Require the specified permission node. This means you can make up your own permission nodes too!
- `$amount` - Make the CommandSign cost a certain amount to the player.
- `timeinseconds` - Restrict usage to once every ? seconds.
- `>>' - Restrict sign usage to right-clicking only.
- `%percent` - Restrict sign to work only a certain percentage of the time.
So now we can make a real example. Lets say only people in the group 'vip' can use the command `/get bacon`:
1. @vip 2. /get bacon 3. -
Nesting restrictions
But it doesn't stop there! You can also 'nest' restrictions inside each other. This means that the same '/get bacon' command above can only be used by VIPs and only once every 10 seconds for example.
1. @vip 2. ~10 3. /get bacon 4. --
Notice how I put two '-'s at the end of the restrictions? You don't have to do that, you could have just had the second one on line 4, but to save space, you can put several on the same line. They must be before any commands or conditions though. More on that in the Syntax section below.
Update
As of v1.8.3, you can now define multiple permission nodes and groups in the same condition; just separate them with a comma!
1. @vip,mod,admin 2. ~10 3. /get bacon 4. --
This also works for:
1. &permission.node,another.permission 2. ~10 3. /get bacon 4. --
Read commas as 'OR'.
Negating / using 'not' in conditions
What if you want everyone not in the VIP group to run a different command instead? Lets say they should run `/get coal`. That's easy too. There is another meta-character known to you and me as '!'. This is the 'not' operator. It can be used like this:
1. !@vip 2. /get coal 3. - 4. @vip 5. ~10 6. /get bacon 7. --
On its own line, the '!' character acts as an else, inverting the restrictions on the sign. The above code could also be accomplished like this, using else:
1. @vip 2. ~10 3. /get bacon 4. - 5. ! 6. /get coal 7. -
Optional conditions
Now we're starting to get something that looks cool. One final thing: if we run this, we'll get the error 'You are not in the required group to run this command' no matter who you are. You can fix this by using one last meta-character: '?'. This makes the condition an optional check. It shouldn't report to the user that they didn't match the condition.
1. ?!@vip 2. /get coal 3. - 4. ?@vip 5. ~10 6. /get bacon 7. --
Alternatively, with else:
1. ?@vip 2. ?~10 3. /get bacon 4. - 5. ! 6. /get coal 7. -
There we go. Now as a result of this, non-VIPs will be given coal, VIPs will be given bacon (but only once every 10 seconds), and nobody will get any errors along the way.
Additional commands
There is one other command that you can use alongside your normal ones. That is the delay command. It's simple to use, just type this:
1. \Waiting 5 seconds... 2. %5 3. \Finished!
That makes the current CommandSigns pause for 5 seconds. Don't worry, this doesn't lag your server at all!
Silent Commands
The '?' Operator also works on console commands, (1.7+) and on player commands. (1.8+) To run a player command silently, simply prefix the line with '?', for example:
1. ?/i diamondsword 1
Syntax
There are a few rules and shorthand ways of writing CommandSigns. You should already know from earlier that the '/commandsigns' command can also be accessed from '/cmdsigns' and '/cs', and you can use '5' instead of 'line5' (v1.8+), but there are also some tricks to make conditions and restrictions easier to remember.
The meta-characters '-', '?' and '!' can appear in any order provided they are before a condition or a command. Yes, that means you can put a '-' on the same line as another group condition and you can use multiple '-'s on the same line. That means the previous code could look like this:
1. !?@vip 2. /get coal 3. ?-@vip 4. ~10 5. /get bacon 6. --
And that will still be completely valid.
Remember that the '-' character will end the last condition that was opened.
Using CommandSigns with CommandHelper
If you need more advanced processing in signs, CommandHelper is a good plugin to work with. CommandSign commands will use CommandHelper aliases over registered commands if they're available, (1.8+) so it's a very good way to get extra programming functionality. To restrict an alias to just a sign, you can add an op requirement to the alias and run it as '/^alias'.
Batch Processing
By typing /cmds batch, (1.8+) you can enter batch processing mode. In this mode, read, enable, and remove operations can be done multiple times in a row with the same state. This is good if you need to remove a lot of signs, or make several signs with the same text. Here's an example of how one might use it:
- Put some text in the clipboard with /cmds line1 \test
- Enter batch enable mode with /cmds batch
- Click multiple signs. They'll all be given the same contents.
How do i set a sign delay? i can't under stand the typing above could someone tell me the commandsigns command for setting a time delay? i want to make it a 24 delay.
Hi,
Is there a way so that when a player clicks the sign, they are GIVEN money instead? I have created some parkour maps, and when a player reaches the end, I'd like them to be rewarded a certain amount of money. Is this possible? And if so, how?
SilverShadow
/cmds line1 /money give <NAME> $$$
@ deerboy
~<seconds> will delay the following commands for that many seconds
then type in a '-' to stop it
For example if I wanted to make it gave a player 1 diamond every 10 seconds:
~10
/i diamond 1
-
Is there a way, how I can set up a sign so all players can only use it once?
I desperately need a condition that would disallow use of a sign for x amount of time for all players after being clicked, so like the ~ condition but for all players. PLEASE HELP
EDIT: I got it half working but When the ppl click it it says it can't because they are OP because of the ^ and can't take that because they are already high enough. but the other # and * say they don't have enough perms to do that.
How can I set it so that it gives a player a permission I want it to be if they pay 75$ they will get an extra sethome but I need it to add permissions to their character is there a way I can do this?
@migraine_maddox
Let me rephrase that When ppl click my sign it makes them ^op for a few seconds right? well the permissions I want to give them essentials.sethome.multiple.buy says they are already op and it wont give them the permission.
@migraine_maddox
Get Pex problem solved
@bassie11 make it a permission sign and add a line at the end to negate that perm
Maybe a silly question, but is there a command to have the sign self destruct after use? as in just vanish?
@Ruthless_Gamer
At the end you could use /setblock (x y z of sign) 0
how do i make a sign check your rank, and accordingly give certain commands for each one? i dont have enough space for a bunch of signs!
@broluigi
If you read everything above it explains it pretty well under the "Restrictions and Permissions" section with some added info on nesting.
I'll reiterate it for you;
get the picture?
Firstly, absolutely AMAZING plugin! It's definitely up there with necessary plugins like Essentials and World Edit. Good job.
I have a question about how to set up a particular sign; this is what it needs to do:
I'm trying a lot of things, and I know it has to do with the placement of '-'s, but I cant figure it out. This is what I did but it does not work:
Thank you in advance for your help!
@FrozenThunder61
This is how it can be done: Give your lowest group (one that every other group inherits) sign.use permission (it can be any permission really)
This essentially checks if you have sign.use, and if you do, deletes the perm from the group. Now no one has permission to use the sign. It waits a certain time, then adds the perm back so people can use the sign again.
I want to make a sign that adds players to a group... But they can only do that once, is that possible?
@agog27
I do not quite understand .. where it would go? in file "signs.yml"?
Found a bug:
When you are trying to test for a permission node that starts with a letter that creates a color code, it just colors the text so it won't work.
Ex:
&alphachest.chest turns into lphachest.chest and its green.
Anyone have a solution?
@cookiemonsta54
You could create a custom permission that doesn't have a color code.