#(bcraft) 1.20.4

43 messages · Page 1 of 1 (latest)

vital shard
#

Hello,

I'm having some difficulties with this little script:

https://pastebin.com/UAc3Cuje

Generate a small list of users that contain a certain flag and send a message with the list:


UserName_1, Username_2 AND Username_3

My question is if I can modify the way the user names appear, for example:


Username_1
Username_2
etc

From already thank you very much !

dense pollenBOT
#

(bcraft) 1.20.4

dense pollenBOT
#

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.

fading deltaBOT
austere orbit
#

Should use the Denizen pastebin

vital shard
#

Oops, sorry

timid bough
#

if you want someting to appear on multiple lines you need a seperate narrate for each line

#

!c foreach

fading deltaBOT
# timid bough !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...

vital shard
#

But the list of names appear all together, since several users would have the same flag using:
"<server.players_flagged" usernames appear consecutively: "name1", "name2", AND "name3"

timid bough
#

calling players_flagged returns a list, you can loop over that list with foreach and narrate each player seperately

vital shard
#

How could I narrate each name separately?
The same variable stores several names, I don't know how to separate them individually and use them

timid bough
#

!guide do that again

fading deltaBOT
vital shard
#

Even though I use "foreach" the variable already stores two or more user names, when I use it I get "name_user_1, name_user_2 AND name_user_2"

#

When a user calls the script it comes out like this, calling a single flag that contains several data (user names):

name_1, name_2 & name_3

timid bough
#

did you forget that you put .formatted in your original tag?
that tag will make a readable output but make it no longer a list.. you would want to loop over the list ie just the output of players_flagged

vital shard
#

But if I don't use "formatted" it will give me the user's UUID

timid bough
#

no, it gives the player objects

fading deltaBOT
timid bough
#

use this tag to get their name

vital shard
#

But the names must be taken from: "<server.players_flagged[<flag_name>]>" since it must be the list of users that have a specific flag

tepid adder
#

Can you post your current script and a record debug please.

#

!info haste debug

fading deltaBOT
#
Info: debug

If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!

vital shard
fading deltaBOT
compact spoke
fading deltaBOT
compact spoke
#

If you stick .parse[name] to your players_flagged tag it'll give you a list of usernames instead of player objects

#

Modifying how the list appears uhh, depends on how you want the names to appear?

#

Should they be separated by a comma? Do you want each nickname in a new line?

leaden pagodaBOT
vital shard
#

Thank you very much, it looked great, I went crazy looking for other methods but I didn't see that one :/
I'm sorry for the inconvenience, but very kind, both of you!

quasi lodgeBOT
#
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.)

#

@vital shard