I couldn't find anything like this, probably due to me searching 1 thing, but let's get on with it.
When I say a "toggleable" command, I mean a command that is used to turn on/off something. Like the command /fly. If you are not in flight mode, you'll be put into flight mode. If you're in flight mode, you will be taken out of flight mode. Here's an easy way to make a toggleable command:
Now you no longer need to have /commandon and /commandoff commands.
EDIT: Some of you may want to make these player-specific. It's very simple. Take your variable, in this case {var}, and add ::%player's uuid% after the name of the variable.
{var} --> {var::%player's uuid%}
When I say a "toggleable" command, I mean a command that is used to turn on/off something. Like the command /fly. If you are not in flight mode, you'll be put into flight mode. If you're in flight mode, you will be taken out of flight mode. Here's an easy way to make a toggleable command:
Code:
command /test:
trigger:
if {var} isn't set:
set {var} to true
# your code
else:
delete {var}
# your code
EDIT: Some of you may want to make these player-specific. It's very simple. Take your variable, in this case {var}, and add ::%player's uuid% after the name of the variable.
{var} --> {var::%player's uuid%}