#(ctr) get specific value from effects_data

87 messages · Page 1 of 1 (latest)

brazen oar
#

Is there something i can use to only get the amplifier value of luck when using:
<player.effects_data.filter[contains_text[type=LUCK]]> ?

I tried around alot with filter_tag and get but without success

formal zephyrBOT
#

(ctr) get specific value from effects_data

young folioBOT
formal zephyrBOT
#

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.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

vapid bough
#

wut

#

<player.effects_data> returns ListTag(MapTag)

#

so you would filter with

#

!t maptag.contains

raven dawnBOT
# vapid bough !t maptag.contains

Returns whether the map contains the specified key.
If a list is given as input, returns whether the map contains all of the specified keys.

Returns

ElementTag(Boolean)

Examples
- if <map[a=1;b=2].contains[a]>:
    - narrate "Yep it sure does have 'a' as a key!"
- if <map[a=1;b=2].contains[c]>:
    - narrate "This won't show"
- else:
    - narrate "No it doesn't have 'c'"
# Narrates 'true'
- narrate <map[a=1;b=2].contains[a|b]>
# Narrates 'false'
- narrate <map[a=1;b=2].contains[a|b|c]>
vapid bough
#

wait actually, here, you would check for the type

#

so it would be like

#

!t maptag.get

raven dawnBOT
# vapid bough !t maptag.get

Returns the object value at the specified key.
If a list is given as input, returns a list of values.

Returns

ObjectTag

Examples
# Narrates '2'
- narrate <map[a=1;b=2;c=3].get[b]>
# Demonstrates that list input gives list output - narrates '2' then '3'
- foreach <map[a=1;b=2;c=3].get[b|c]> as:value:
    - narrate "One of the values is <[value]>"
vapid bough
#

!t elementtag.equals

raven dawnBOT
vapid bough
#

so <player.effects_data.filter[get[type].equals[luck]]>

brazen oar
# vapid bough so `<player.effects_data.filter[get[type].equals[luck]]>`

Doesn't seem to work, i get an empty list every time...
Only thing i can get it to filter correctly is by using <player.effects_data.filter[contains_text[type=LUCK;amplifier=0]].get[1].exists>
but i don't want a true i just want the value narrated.. equals would return a true aswell... and just .get[key]doesn't work for me, not sure where i'm going wrong

vapid bough
#

you're object hacking here

#

one thing you can do is try /ex narrate <player.effects_data>

brazen oar
#

I don't think so, thats something ice gave me a while ago

vapid bough
vapid bough
brazen oar
brazen oar
vapid bough
#

what, specifically

#

do you have a screenshot or smth

brazen oar
#

Sure, back on pc in ~3-5 mins

vapid bough
#

alright so /ex narrate <player.effects_data.filter[get[type].equals[luck]]> narrates an empty list?

brazen oar
#

No, that just narrates the list with Luck, but that also worked with <player.effects_data.filter[contains_text[type=LUCK]]> which i used before

vapid bough
#

now to get the amplifier you can do

#

!t listtag.parse

raven dawnBOT
# vapid bough !t listtag.parse

Returns a copy of the list with all its contents parsed through the given tag.
One should generally prefer !tag ListTag.parse_tag.

Returns

ListTag

Examples
# Narrates a list of 'ONE|TWO'
- narrate "<list[one|two].parse[to_uppercase]>
vapid bough
#

so <player.effects_data.filter[get[type].equals[luck]].parse[get[amplifier]]>

#

and then

#

!t listtag.max

raven dawnBOT
vapid bough
#

uh

#

!t listtag.highest

raven dawnBOT
# vapid bough !t listtag.highest

Returns the highest value in a list of decimal numbers.
Optionally specify a tag to run on each list entry that returns the numeric value for that entry.

Returns

ObjectTag

Examples
# Narrates '10'
- narrate "<list[3|2|1|10].highest>
# Narrates the name of the player with the most money currently online
- narrate <server.online_players.highest[money].name>
brazen oar
#

ohh thanks alot

#

what the highest for?

vapid bough
#

so <player.effects_data.filter[get[type].equals[luck]]> returns the ListTag of MapTags of luck effects

#

<player.effects_data.filter[get[type].equals[luck]].parse[get[amplifier]]> returns all the amplifiers

#

<player.effects_data.filter[get[type].equals[luck]].parse[get[amplifier]].highest> returns the highest amplifier

brazen oar
#

maybe stupid question but an effect can't have multiple amplifiers or?

vapid bough
#

don't think so

#

if you have one though, it will probably appear as multiple maps in the list

brazen oar
#

also... can i put something like.. if there's no LUCK effect then continue without in the same line? with something like .if_null[null] or would i have to make a seperate if line for that?

vapid bough
#

yeah

#

you can use a if_null

brazen oar
#

neat, thanks :)

#

so if someone searching for the same issue -> /ex narrate <player.effects_data.filter[get[type].equals[luck]].parse[get[amplifier].add[1]].if_null[null]>

gentle copperBOT
#
Resolved

Thread closed as resolved.

brazen oar
#

still not sure what that would provide for me, there's only 1 value possible

#

i mean there can't be a lower one then the highest

vapid bough
#

well the current tag you put returns a list

#

so you would have to get one of the values

#

the safest one being obviously highest

brazen oar
vapid bough
#

sure, it seems like theres always going to be just one value, but in order to do anything with the value you gotta make it an elementtag first

brazen oar
#

i mean it's meant to be a definition

vapid bough
#

what are you going to do with the definition

brazen oar
#

i want to implement luck as a multiplier for some droprates

vapid bough
#

hmm

#

then you will have to use something like a .mul tag, which requires elementtags, not listtags

brazen oar
#

like <[dropchance].mul[<[Luck]]> something like that

#

yeah

vapid bough
#

you can't multiply by a list

brazen oar
#

alright, so /ex narrate <player.effects_data.filter[get[type].equals[luck]].parse[get[amplifier]].highest.add[1].if_null[null]>
add 1 to actually show the level of luck instead of amplifier

vapid bough
#

if you only use it in a .mul, you can also have the .if_null fallback to 1 instead of null

#

just to save some time

brazen oar
#

yeah, that's the next thing i would've tried. thanks alot :)

#

/ex narrate <player.effects_data.filter[get[type].equals[luck]].parse[get[amplifier]].highest.add[2].if_null[0]> seems perfect

vapid bough
#

👍

gentle copperBOT
#
Thread Reopened

Thread was manually reopened by @shell epoch.