This suggestion adds a new command that creates a variable and allows recalling variables in the command.
A suggested command: /variable
Syntaxes:
/variable <create|remove|store> ...
/variable create <variable name>
This one creates a new empty variable. I don't think this variable needs to specify the data type.
Example: /variable create bana_nas
/variable remove <variable name>
This one simply removes an existing variable
Example: /variable remove bana_nas
/variable store <score|value> ...
/variable store score <target player> <scoreboard name>
This one stores the scoreboard value of a player to the variable and also bound to it.
I.E. When a player has 5 in the score "bananas", storing will result in the variable having a value of 5. In addition, when the player changes the score from 5 to 3, the value of variable will automatically update to 3. just like the score in /stats
Example: /variable store score @a[tag=banana] bananas
/variable store value <value> <-- (value can be an integer, string, array or even a whole command)
This one stores the value in <value> in the variable.
Example1: /variable store value ["Why do I keep using",{"text":" bananas"}]
Example2: /variable store value @e[c=2] (If a player and a zombie is nearby, it gives an array. The player's name and the zombie's UUID)
Recalling variables:
So how to recall them?
My suggestion is by using **.
[let's say we have a variable "orange", with a value of 5]
Wow, this is a very good idea. I was about to suggest something like it so I didn’t have to make a machine that would take 64+ ticks to detect the amount of items there are in a slot. Maybe we could use the variable in a new command that would extract the amount of items in a chest slot into a numerical value to be used for things like Minecraft in game memory for red stone computers.
Rollback Post to RevisionRollBack
currently making what I believe to be a possible 1 Mb disk drive using command blocks and structure blocks
A global variable can be used anywhere in the world.
With a local variable, you have to specify the region, using the arguments in brackets. A local variable can only be used, changed, or removed if the executing entity or command block is located in the specified region.
A global variable can be used anywhere in the world.
With a local variable, you have to specify the region, using the arguments in brackets. A local variable can only be used, changed, or removed if the executing entity or command block is located in the specified region.
I was actually thinking of local variables that stores the value for every player, so when 2 players are recalling the same variable, they have different outcomes. However, yours sounds good actually. It's a "local variable".
DISCLAIMER:See Extras No. 4
Abstract:
This suggestion adds a new command that creates a variable and allows recalling variables in the command.
A suggested command: /variable
Syntaxes:
/variable <create|remove|store> ...
/variable create <variable name>
This one creates a new empty variable. I don't think this variable needs to specify the data type.
Example: /variable create bana_nas
/variable remove <variable name>
This one simply removes an existing variable
Example: /variable remove bana_nas
/variable store <score|value> ...
/variable store score <target player> <scoreboard name>
This one stores the scoreboard value of a player to the variable and also bound to it.
I.E. When a player has 5 in the score "bananas", storing will result in the variable having a value of 5. In addition, when the player changes the score from 5 to 3, the value of variable will automatically update to 3. just like the score in /stats
Example: /variable store score @a[tag=banana] bananas
/variable store value <value> <-- (value can be an integer, string, array or even a whole command)
This one stores the value in <value> in the variable.
Example1: /variable store value ["Why do I keep using",{"text":" bananas"}]
Example2: /variable store value @e[c=2] (If a player and a zombie is nearby, it gives an array. The player's name and the zombie's UUID)
Recalling variables:
So how to recall them?
My suggestion is by using **.
[let's say we have a variable "orange", with a value of 5]
Usage1: /tp @a ~ ~ *orange* ~90 ~2
Usage2: /summon creeper ~ ~ ~ {Fuse:*orange*,ExplosionRadius:-10}
Feasibility:
1. 1.13 is near. Although the snapshots are coming out, the gates shouldn't be locked tightly (maybe...?)
2. Variables are in a high demand by map makers
3. I haven't seen * being used in most cases (I know, "name":"*" in "score" of Raw JSON text)
4. I don't know much about the real code behind the commands, but I assume that this doesn't add much extra time to load a command.
Advantages:
(Too much, I'll just list 3)
1. Map makers can do easier raycasting
2. The Thrower tag can now be manipulated for some player kills using a summoned arrow
3. The item used to show cooldown no longer needs a command block for each second (I.E. a 60 second cooldown no longer needs 60 command blocks)
4. More technical If you see this message, I thank you sincerely. This is not an advantage btw. skills are required. Good for Minecraft EDU.
Issues:
1. Yes, players can change the variable during /title or /tellraw. I prefer real-time update, but it may be impossible
2. Again, I don't know much about the real code behind the commands, it may break everything (well, also the purpose of 1.13. lol)
3. May cause lag if too much variables are used
Extras:
1.
<Nerd> Wait! What about the operations? I wanna do an addition! (a = b + 1)
<Somebody> Well, /scoreboard players operation @p a += @p b
<Nerd> What about a = b + c * d - (e + f) ?
<Somebody>
/scoreboard players operation @p temp1 = @p c
/scoreboard players operation @p temp1 *= @p d
/scoreboard players operation @p temp2 = @p e
/scoreboard players operation @p temp2 += @p f
/scoreboard players operation @p a = @p b
/scoreboard players operation @p a += @p temp1
/scoreboard players operation @p a -= @p temp2
<Nerd> Why is this so complex?!?
<Somebody> Cuz you give me a complex operation. Common Sense
Nerd has left the game
2. I was thinking of local variables and global variables, but I think this will bring some other issues. What do you think?
3. These are my SUGGESTIONS, if you disagree with any of my suggestions, feel free to say so.
4. Yes, a lot of people suggested command variables, but they aren't duplicates. I did make them out of my own overheated brain.
If you see this message, a thank is given to you.
Wow, this is a very good idea. I was about to suggest something like it so I didn’t have to make a machine that would take 64+ ticks to detect the amount of items there are in a slot. Maybe we could use the variable in a new command that would extract the amount of items in a chest slot into a numerical value to be used for things like Minecraft in game memory for red stone computers.
currently making what I believe to be a possible 1 Mb disk drive using command blocks and structure blocks
I have a suggestion about local and global variables.
To create a variable, you would use:
/variable create <global|local> <variable name> [x1] [y1] [z1] [x2] [y2] [z2]
A global variable can be used anywhere in the world.
With a local variable, you have to specify the region, using the arguments in brackets. A local variable can only be used, changed, or removed if the executing entity or command block is located in the specified region.
I was actually thinking of local variables that stores the value for every player, so when 2 players are recalling the same variable, they have different outcomes. However, yours sounds good actually. It's a "local variable".