#(minecrafte) executing scripts to a set player with custom command

105 messages · Page 1 of 1 (latest)

plush shale
#

this is what i have and it keeps sending to me no matter what player i put

test_command:
  type: command
  name: test
  description: Sends "test" in action bar to a selected player
  usage: /test <player>
  args:
    player:
      type: player
      required: true
  script:
    - narrate "You ran this on player: <player.name>"
    - actionbar "test" targets:<player>
rotund lagoonBOT
#

(minecrafte) executing scripts to a set player with custom command

rotund lagoonBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

toxic ridge
#

"args" isn't a valid section in a command script

#

!l command script container

broken ginkgoBOT
# toxic ridge !l command script container

Command script containers allow you to register your own custom commands to the server.
This also allows the command to show up in the '/help' command, with some info on the command.

Note that existing names or aliases from other plugins will be overridden.
If you want to run a script at the same time as an existing command, see !event on command.

The following is the format for the container.

The required keys are 'name:', 'description:', 'usage:', and 'script:'
All other keys can be excluded if unneeded.
If you are not intentionally setting a specific value for the other keys, it is
strongly recommended that you simply not include them at all.

Please note that 'name:' is the true name of the command (written by users),
and 'usage:' is for documentation in the '/help' command.
...

Group

Script Container System

toxic ridge
#

you should probably use something like

#

!t match_player

broken ginkgoBOT
# toxic ridge !t match_player

Returns the online player that best matches the input name.
EG, in a group of 'bo', 'bob', and 'bobby'... input 'bob' returns player object for 'bob',
input 'bobb' returns player object for 'bobby', and input 'b' returns player object for 'bo'.

Returns

PlayerTag

toxic ridge
#

with the <name> being the first argument

modest isle
#

!g handling player commands

plush shale
#

i cant get it to work still

toxic ridge
#

!haste

broken ginkgoBOT
plush shale
plush shale
toxic ridge
#

targets:<playerToSend> isn't a valid tag. since this is a definition, you'll need to surround the text within the <> with []

plush shale
#

FINALLY

#

FUCK

modest isle
#

You already use that above with playerName ^ - are you using the Visual Studio Code extension? It should automatically point out errors like this for you

toxic ridge
#

the playerToSend is the match_player value

modest isle
#

I know, I was just pointing out they already used the correct syntax above

#

So if they have the VSC extension it should make it easier to see the difference between the correct tag & wrong tag / show them an error automatically

toxic ridge
#

you could also shorten the overall script by removing the playerName definition entirely, and filling that spot in the match_player tag with <context.args.get[1]>

#

also, if you're adding this as an available command to players, see

#

!g don't trust the player

broken ginkgoBOT
#
Possible Confusion

Did you mean to search for common mistakes - don't trust players?

modest isle
toxic ridge
#

if you have any other questions, feel free to let us know here. otherwise,

analog coralBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@plush shale

plush shale
#

how could i do it for @a

toxic ridge
#

you mean have the command effect everyone?

plush shale
#

yes

toxic ridge
#

!t server.online_players

broken ginkgoBOT
plush shale
#

i was wanting to be able to get this working for a seperate thing im working because im wanting to use this for an even on my server and i made a earthquake test thing

  type: command
  name: quake
  description: "Trigger earthquake effect for all players"
  usage: "/quake"
  tab completions:
      1: <server.online_players.parse[name]>
  script:
    - actionbar "You feel the ground shake"
    - playsound <player> sound:entity_generic_explode volume:0.05
    - teleport <player> <player.location.left[.02]>
    - wait 1t

more shitty code past this point```
#

i think i tried that online players for this script and it has all players at the same spot insead of being seperate

toxic ridge
#

so for the playsound and teleport parts, you'd have to use a

#

!c foreach

broken ginkgoBOT
# toxic ridge !c foreach
Group

queue

Syntax

foreach [stop/next/<object>|...] (as:<name>) (key:<name>) [<commands>]

Short Description

Loops through a ListTag, running a set of commands for each item.

Description

Loops through a ListTag of any type. For each item in the ListTag, the specified commands will be ran for that list entry.

Alternately, specify a map tag to loop over the set of key/value pairs in the map, where the key will be <[key]> and the value will be <[value]>.
Specify "key:<name>" to set the key definition name (if unset, will be "key").

Specify "as:<name>" to set the value definition name (if unset, will be "value").
Use "as:__player" to change the queue's player link, or "as:__npc" t...

toxic ridge
#

you shouldn't use this for any wait portions, since the script will have to run through that for a single player before going on to the next

plush shale
#
quake:
  type: command
  name: quake
  description: "Trigger earthquake effect for all players"
  usage: /quake
  tab completions:
      1: <server.online_players.parse[name]>
  script:
    - foreach <server.online_players> as:player:
      - actionbar "You feel the ground shake"
      - playsound <player> sound:entity_generic_explode volume:0.05
      - teleport <player> <player.location.left[.02]>```am i going in the right direction or am i being dumb again
#

im assuming that is wrong

toxic ridge
#

nope that's just what i was about to comment on

plush shale
#

so that should work like that then

toxic ridge
#

<player> will only produce the player that ran the command, <[player]> will produce the current player on the "foreach" loop

#

(although you will have to add a targets:<[player]> to the "actionbar" command, or have this before the "foreach" loop and specify the <server.online_players> as the target)

plush shale
#

<[player].location.left[.02]> this will move the players based of their own location and wont cause all players to go to same spot like what i fucked up before right ?
-# (i already added the target to the action bar after sending screenshot)

#

i want it to if no argument 1 then do it to all players but if theres someones userneme then do it to that player... is possible?

toxic ridge
#

- if <server.match_player[<context.args.get[1]>].if_null[null]> == null: for if there if either no player, or the player specified does not exist

plush shale
#
  - if <server.match_player[<context.args.get[1]>].if_null[null]> == null:
    - foreach <server.online_players> as:player:```?
#

i put a name and it still did it for everyone

#

IM DUMB

#

reload

#

heres the entire shitty earthquake script...
-# (i removed the waits as someone said they werent needed but they didnt see the full thing and it turns out they are very needed)

toxic ridge
#

you might run into an issue with this...

plush shale
#

if it others being able to do it... dont really care. small server. funny moments

toxic ridge
#

the waits are contained within the foreach section

#

because the entire section has to finish before it goes to the next entry, this includes the waits

#

so one player will run through the entire script, then once that player's done, it'll go to the next player

#

the waits delay this for every other player that's next on the list

plush shale
#

OH SHIT I SEE

#

is it possible to do all together?

toxic ridge
#

you would have to have the waits outside of the "foreach"s

plush shale
#

but then its not much of an earth quake its an earth move .2 blocks in 1 frame

toxic ridge
#

you could expand the wait time

#

or the block distance

plush shale
#

i have no idea how to move the waits outside the foreach and keep it working...

toxic ridge
#

you would have to have a new foreach after every wait

plush shale
#

i tried that it didnt work.

#

wait

#

fuck

#

got it

copper gyro
#

Don't upload the entire script.

#

Use our pastebin please.

#

!haste

broken ginkgoBOT
plush shale
#

is it possible to kick a player like - kick <player> <reason> or something...

copper gyro
#

Sure is.

#

!c kick

broken ginkgoBOT
# copper gyro !c kick
Group

player

Syntax

kick [<player>|...] (reason:<text>)

Short Description

Kicks a player from the server.

Description

Kick a player or a list of players from the server and optionally specify a reason.
If no reason is specified it defaults to "Kicked."

copper gyro
#

!c

broken ginkgoBOT
# copper gyro !c
Need input for 'Command' command

Please specify a command to search, like !command SomeCommandHere. Or, use !command all to view all documented commands.
You can also use !command [name] tags to view tags related to the command, or !command [name] usage to view usage examples.

copper gyro
#

!command all

broken ginkgoBOT
copper gyro
#

Check commands page in the future.

plush shale
#

so this should work...

#

because its not working for me

toxic ridge
#

the reason argument needs to start with reason:

copper gyro
#

Please double check the command pages when making scripts.

plush shale
#

- modifyblock <location[world,-268,72,716]> fire
ive look at the command thing so many times and changed this so much but its not placing it... theres nothing there that shows how to to a set location...

toxic ridge
#

!object locationtag

broken ginkgoBOT
# toxic ridge !object locationtag

A LocationTag represents a point in the world.

Note that 'l' prefix is a lowercase 'L', the first letter in 'location'.

This object type is flaggable.
Flags on this object type will be stored in the chunk file inside the world folder.

Prefix

l

Base Type

ElementTag

Implements

FlaggableObject, VectorObject

Format

The identity format for locations is <x>,<y>,<z>,<pitch>,<yaw>,<world>
Note that you can leave off the world, and/or pitch and yaw, and/or the z value.
You cannot leave off both the z and the pitch+yaw at the same time.
For example, 'l@1,2.15,3,45,90,space' or 'l@7.5,99,3.2'

toxic ridge
#

the format is x,y,z,world

#

also see

#

!g don't script raw locations

analog coralBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@plush shale