Custom variables in commands

Discussion in 'Archived: Plugin Requests' started by Talocitie, May 11, 2012.

  1. Offline


    I had an idea where commands would accept variables in their parameters, that were modifiable separately.

    For example, we can create a var in the command console
    /var hello "123 232 267"

    Here var is the command, hello is the variable, and the next part is the variables value. Now if we use this variable in a command, let's do the /tppos example from essentials.

    /tppos hello

    hello would be replaced with "123 232 267" when the command is entered.

    The reason for wanting this mod is I use command-signs and various other plugins where I would like to use variables to save me typing them out, and when I want to change certain elements on multiple signs without having to rewrite them. And also at the spawn of my server, like many I have signs with a list of commands etc. I may want to change the location that commands teleport to, and not have to modify the signs at all (me being slightly lazy ;) ).

    Forgive me if this plugin already exists, but I couldn't find any similar on my searches.

    If such a thing wouldn't be possible, could we not do /varex tppos hello So we are using the command of the plugin, to create a command with the replaced variables if we couldn't do it directly.
  2. Offline


  3. Offline


    Thanks for that,

    It's a bit more complex that what I would have hopped for though, I would rather a very simple mechanism such as x = 5. /give person x

    I don't really think that's what I'm looking for.

    Would it be possible for someone to make a plugin with simple syntax?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 25, 2016
  4. Offline


    How is this not what you are looking for? It does exactly what you are asking and more.

    You can alias commands with variables like this:
    /i $data [$qty=64] = /give player() $data $qty
    /to $player = /tp player() $player
    You can make macros for entire commands like:
    /kit gold = /give player() 284 64 \ /give player() 285 64 \ /give player() 286 64
    or even,
    /tppos random = /tppos 123 456 789
  5. Offline


    Hmm,i could make a plugin if that 'alias' thingies not ok for you,i just want to know the variables would be global or saved for each player?
  6. Offline


    CommandHelper relies on a config, a don't want that. I would like to dynamically change variables in game.

Share This Page