#(thatkev) Conditional lore

15 messages · Page 1 of 1 (latest)

obsidian bramble
#

How would I go about doing this correctly?

earth:
    type: item
    debug: false
    material: player_head
    display name: <&e><&l>Earth
    lore:
    - if <player.has_permission[planet.earth]>:
        - <&a><&l>Unlocked.
    - else:
        - <&c><&l>Locked.
    - <&7>Earth, the planet you are currently on. Literally.
grand nymphBOT
frosty cloudBOT
#

(thatkev) Conditional lore

frosty cloudBOT
#

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.

rotund iron
#

You could use procedure scripts for this. Write a procedure to determine an outcome, your lore in this case. Then reference the procedure in your item script lore key with <proc[my_procedure_here]>

obsidian bramble
#

Alrighty

obsidian bramble
#

^^ found it, context

rotund iron
#

Yep! That is exactly what procedure scripts do. Lemme see if I can bring up the meta.

#

!l procedure script

pine galeBOT
# rotund iron !l procedure script

Procedure script containers are used to define a script that can be ran through a tag.

Generally called via !tag proc or !tag proc.context.

The only required key is 'script:'.

Note that procedure scripts must NEVER change external state.
That is, a procedure script cannot change anything at all, ONLY determine a value.
Setting a flag, loading a YAML document, placing a block, etc. are all examples of external changes that are NOT allowed.

This restriction comes from two main reasons:

  • Tags run in arbitrary conditions. They may be read asynchronously or in other weird circumstances that can result
    in applied changes crashing your server or other unexpected side effects.
  • Tags can run for a variety of reasons.
    If you were to make a proc script 'spawn_entity' that actually...
Group

Script Container System

obsidian bramble
#

great, got it working :)

#

Leaving it here incase anybody's stumped in the future

validatelore:
    type: procedure
    definitions: planet
    script:
        - if <player.has_permission[planet.<definition[planet]>]>:
            - determine <&a><&l>Unlocked.
        - else:
            - determine <&c><&l>Locked.```
rotund iron
#

👍