Relative Positioning and Variables

Just is just a really quick idea I came up with. Please feel free to criticise me and elaborate on this topic.

I figure that a relative positioning similar to Minecraft would be nice to implement into Sponge, and that seems fine and dandy, but the real focus here is variables in commands.

It would simply be typed as: ~x. lets say the variable “x” is set to “Moonseeker12”, so
/msg ~x hey
would send the message “Hey” to Moonseeker12.

It will be a simple key value system:

  • Create/Override Variable: /var set “key” “value”
  • Remove a Variable: /var del “key”
  • Retrieve a list of all variables with a value: /var get “value”
  • So On

So why is this useful? Well this could be simply used to shorten things such as region names, player names, commands and more.

For example you could shorten a long region name like “SpawnProtectionArea” into “Spawn” without renaming it directly.

You could also shorten a command with an alias like /var set command commandName alias
So /spawn could also be used as /s

Some other variables could be used for convenience like ~me to retrieve you own name or ~loc to get your 3 coordinate location, separated into xyz automatically.

Sorry for my lack of creativity on making these examples, I am sure this system could be applied for much more useful ideas, I just wanted the idea out there.

I’m a bit confused :confused:. You’re talking about creating in-game variables for [‘players’,‘region(s)’, etc…] ? If so, in hopes for what? plugins to use these “shortened” variables if they execute a command? Ah… I’m just confused. :wink:

Without much background on the sponge project, I can tell you this will likely fall outside the scope of the project and left for an external plugin to accomplish. :wink:

I’m not sure if you will be able to do something like this in sponge, but I wouldn’t be all that surprised if there was a way to do it with a client side mod.

As for a client side mods, there’s a keyboard macro mod for the liteloader mod, you can scripts things to key binds in this.

1 Like

I agree. I was just suggesting it as a convenience feature much similar to tab for filling commands out automatically, however an external plugin could do this just as effectively since it does not really require other plugins to utilize an api.

I see where your coming from here, however this is in some sense different than a macro. For one this is global across the server, so every player can use it. Another reason it differs is because the process is carried out server side rather than client side, when the server is parsing the command.
However your comment gave me an idea, what if there was a server plugin that scanned to see if the client had a macro mod, then sent custom and commonly used macros to the client to choose to use.

The macro mod that I’m thinking about is that macro mod of @mumfrey’s. You could possibly do something like that, but if you sent key binds than you would have the problem of other people using different binds than you are, like binds for AZERTY or QWERTZ layouts, which would be a problem (I personally use the Colemak layout.). The best thing to use in that would be the screen button macros. As far as I know his plugin doesn’t support that currently, he would have to add support for it. As for if it gets sent to the client automatically or not, could be set by a command the player could use to “opt into” it, and have it set to default to being off.

Hmm good point with the key binds. May be possible to make a sudo inventory that contains so called “buttons”. Not to sure how to implement HUD buttons since it is a first person game, unless you mean something else.

I use his macro mod on my server for certain things(pic bellow.), You can bring up a hud with buttons in it in that mod if you have macros set to that screen. You can see his mob here, it’s a liteloader mod.

Oh ok it unlocks the mouse from the player’s camera. That is what I was confused about. The mod itself looks impressive.

Something like this could be helpful for server admins, if you have some of their admin functions set in macros, you can create macros that can show a player list on the server, this would make kicking someone form the server a bit faster, when you don’t have to worry about the format of the commands.

As for getting data from the server to the client, it could do something like what World Edit does with the we cui, it sends a command to the server (/we cui) and the server sends the selection data to the mod.

I like your idea, but I see a few major flaws:

  • Plugins would have to implement this for all of their commands;

This is extremely useful when you need to send a long message or when you need to edit allot of raw json or metadata from the chat or command line. The reason why its so useful is because Minecraft has a limitation of the amount of characters you can send to another client.

1 Like

This is not an API that other plugins utilize but rather a layer between receiving the command, and executing it. The player sends a command like
/tell ~x hello
The server receives the command and parses the arguments replacing the ~x with its value, this case Moonseeker12
The server then sends the new command /tell Moonseeker12 hello to the appropriate plugin to execute the commands task.

All the plugin is doing is treating the command as it would before this system, the system is just there to fetch values.

Oh! Well, in that case, this is a great idea, and certainly viable. Thanks for the clarification.

This is certainly interesting…

Do you mean by /var set “key” “value”, that this would be an in-game command that opped players could use to create simple command aliases without a server restart? Because I think that would be amazing.

Come to think of it, being able to edit config settings via in-game commands would be super useful, especially for newbie server owners.

Something that would be even more amazing: Being able to edit the server’s motd via an in-game command, without a restart/reload. Not sure if that could even work without some kind of plugin, but it would be cool.

Yes this would be an in game command that could also be executed via server console. There could also be an additional API not for utilizing this feature, but just executing this function from a method call. Plugins would not have to use this API to work.
Along with config and permission modification, I could see this being a viable idea in the form of /cfg “path or pluginname” “pathToKey” “value”