#(snozbear) Placeholder empty

40 messages · Page 1 of 1 (latest)

foggy moat
#

Hey there,

Is there a way to make a placeholder return null if its empty? Currently it just spits out the raw placeholder

<placeholder[fabled_player_Class_attribute:vitality].if_null[0]>

glass sonnetBOT
deft copperBOT
#

(snozbear) Placeholder empty

deft copperBOT
#

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.

obsidian bone
#

!t <placeholder.player>

waxen jacinthBOT
obsidian bone
#

It looks like it’s looking for a server placeholder, not an individual player placeholder

foggy moat
#

Oh that works lol, weirdly it works fine if theyre professed into a class but if they arent it just gives the raw thingy

#

Tysm!

lavish sedgeBOT
#
Resolved

Thread closed as resolved.

foggy moat
#

wait nm that doesnt work

lavish sedgeBOT
#
Thread Reopened

Thread was manually reopened by @foggy moat.

foggy moat
#

I accidentally professed into a class

zealous arrow
foggy moat
# zealous arrow What?

Sorry, so the placeholder is empty until a player professes into a class. So when its empty I need it to return as 0, but currently it just gives me back the placeholder like %placeholder%

so, I was wondering if theres a way to get the placeholder to return null when its empty I guess

zealous arrow
#

!t if_null

waxen jacinthBOT
# zealous arrow !t if_null

If the object is null (or the tag errors), this will return the input object.
If the object isn't null, the input won't be parsed, and the original object will be returned.
For example, "<player.if_null[<npc>]>" will return the player if there is a player, and otherwise will return the NPC.
This functions as a fallback - meaning, if the tag up to this point errors, that error will be hidden.

Returns

ObjectTag

zealous arrow
#

Not sure how placeholders work.

foggy moat
#

<placeholder[fabled_player_Class_attribute:vitality].if_null[0]> returns as 0 when theyre professed into a class, but when they arent it just comes back as %fabled_player_Class_attribute:vitality%

fleet halo
#

Unfortunately that's probably more to do with how PAPI deals with placeholders - if it doesn't exist it just returns the raw placeholder text. You could always test whether the raw placeholder was returned

foggy moat
#

I see, rip. I'm trying to do it in an item's lore which makes it a bit more annoying

#

or maybe ill just make it so they can't open the menu if theyre not professed lmao

fleet halo
#

Do you have a way to tell if they are professed?

#

If so you could use ternary

#

!t tern

waxen jacinthBOT
# fleet halo !t tern
Cannot Specify Searched Tag

Multiple possible tags: <QuaternionTag.slerp[end=<quaternion>;amount=<amount>]>, <LocationTag.patterns>, <ItemTag.patterns>, <QuaternionTag.x>, <QuaternionTag.y>, <QuaternionTag.z>, <QuaternionTag.w>, <QuaternionTag.xyz>, <QuaternionTag.xyzw>, <QuaternionTag.plus[<quaternion>]>, <QuaternionTag.mul[<quaternion>]>, <QuaternionTag.scale[<factor>]>, <QuaternionTag.length>, <QuaternionTag.length>, <QuaternionTag.inverse>, <quaternion[<quaternion>]>, <QuaternionTag.negative>, <QuaternionTag.transform[<vector>]>, <LocationTag.lectern_page>, <QuaternionTag.normalize>, ...

foggy moat
#

yeah but its more placeholders lol

fleet halo
#

As long as that returns something always, that should be fine

glass sonnetBOT
fleet halo
#

!t tern.pass.fail

waxen jacinthBOT
# fleet halo !t tern.pass.fail

Returns either the 'pass' input, or 'fail' input depending on the outcome of the condition.
The 'pass' input will be returned when the condition returns 'true', otherwise the 'fail' input will be returned.
Example: '<tern[<player.is_spawned>].pass[Player is spawned!].fail[Player is not spawned!]>'
Consider instead using !tag ElementTag.if_true.if_false

Returns

ObjectTag

foggy moat
#

oh I see, alrighty I'll give that a whirl

next thicket
#

See the meta there ^, generally nicer to use

#

!t if_true.if_false

waxen jacinthBOT
# next thicket !t if_true.if_false

If this element is 'true', returns the first given object. If it isn't 'true', returns the second given object.
If the input objects are tags, only the matching tag will be parsed.
For example: "<player.exists.if_true[<player.name>].if_false[server]>"
will return the player's name if there's a player present, or if not will return 'server', and won't show any errors from the '<player.name>' tag even without a player linked.

Group

element checking

Returns

ObjectTag

fleet halo
#

Huh. Yeah that is neater. Knowledge increased. Thanks for pointing that out Aya 😄

next thicket
#

Feel free to ask if you need any help, otherwise -

lavish sedgeBOT
#
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.)

#

@foggy moat