#YAML Value

1 messages · Page 1 of 1 (latest)

hardy inlet
#

Hello, so I try to get the yaml value of "Common", and i get everything in this yaml code, how can i do it so that i can only get the dog, cat and bat? like it won't show the id and petEffects values


  dog:

    id: "I;-1962431072,-555400647,-1776946664,-786455877"

    petEffects:

    - "movement speed:0.1"

    - "attack damage:0.2"

  cat:

    id: "I;1949763060,1700546699,-1761947563,1206264877"

    petEffects:

    - "movement speed:0.2"

    - "attack damage:0.3"

  bat:

    id: "I;-191833319,-560838190,-1520611936,444367289"

    petEffects:

    - "movement speed:0.3"

    - "attack damage:0.4"```
hardy inlet
#

Up

hardy inlet
#

Bump

hardy inlet
#

Bump

wheat fiber
#

You can’t cause the value is not set

hardy inlet
wheat fiber
#

The value of common.dog.id is set but there is no value at common

#

What you need to do is get all yaml nodes and work from there

hardy inlet
#

Hmm imma try that hold on

hardy inlet
wheat fiber
#

Yes cause rn common won’t return a value…

#

Something you also can do is make a new section in the yaml for example common.pets and have that be ur list

#

Or like I said before. Get all the nodes and work from that (filter out everything you don’t need)

hardy inlet
hardy inlet
#
  - dog:

      id: "I;-1962431072,-555400647,-1776946664,-786455877"

      texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTc4MDQ4N2QyOTYwNTI3MzY3NzE1N2IzMDhkNWNjYTcwMTc4OWNmZmI2MzhiMjI0MjhhZTg4MmRhNDVkMjU5NiJ9fX0="

      petEffects:

      - "movement speed:0.1"

      - "attack damage:0.2"


  - cat:

      id: "I;1949763060,1700546699,-1761947563,1206264877"

      texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjM5MDA0N2RjMjAxNGIzM2RmYWE4OTEzYzJmOWYwZDBjYjAwYWY4NGIzYzdlNWQzMzg2NzNmN2E1NWQ1Zjc0OSJ9fX0="

      petEffects:

      - "movement speed:0.2"

      - "attack damage:0.3"

  - bat:

      id: "I;-191833319,-560838190,-1520611936,444367289"

      texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjc5NmFhNmQxOGVkYzViNzI0YmQ4OWU5ODNiYzMyMTVhNDFiZjc3NWQxMTI2MzVlOWI1ODM1ZDFiOGFkMjBjYiJ9fX0="

      petEffects:

      - "movement speed:0.3"

      - "attack damage:0.4"``` I turned it into this, and used this code for debug ```command /test:
    trigger:
        loop yaml list "common" from "pets":
            broadcast "%loop-value%"
            add loop-value to {_list::*}
        broadcast "%{_list::*}%"``` Weirdly, it broadcast the loop-value during the loop, but not add it to the list variable
wheat fiber
#

Why not directly do: set list to yaml list of yaml file?

#

Instead of looping it first and then adding those to a list

hardy inlet
#

so i tried looping it

#

only in the loop that it shows

wheat fiber
#

Yea I think ur main issue is ur list has other nodes with values

hardy inlet
#

hmm, should i adjust my indentation?

wheat fiber
#

I am guessing this is a pre existing yaml you got from another plugin?

hardy inlet
#

kind of, but not exactly a plugin

wheat fiber
#

If you can edit the yaml I think ur safes bet is to add a new node called pets and add ur lists in there

#

But like this

hardy inlet
#

I'm able to edit the yaml, yes

wheat fiber
#
Pets:
   Common:
      - cat
      - dog
   Uncommon:
      - pet1 
      - pet2```
hardy inlet
#
  Common:
    - dog:
      id: "I;-1962431072,-555400647,-1776946664,-786455877"
      texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTc4MDQ4N2QyOTYwNTI3MzY3NzE1N2IzMDhkNWNjYTcwMTc4OWNmZmI2MzhiMjI0MjhhZTg4MmRhNDVkMjU5NiJ9fX0="
      petEffects:
        - "movement speed:0.1"
        - "attack damage:0.2"``` like this?
wheat fiber
#

No

#

At the bottom of the file

hardy inlet
#

hmm, how would i add the id's and textures?

wheat fiber
#

Create a new node

#

You keep those.

hardy inlet
#

what would this new node would be like?

wheat fiber
#
    dog:
      id: "I;-1962431072,-555400647,-1776946664,-786455877"
      texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTc4MDQ4N2QyOTYwNTI3MzY3NzE1N2IzMDhkNWNjYTcwMTc4OWNmZmI2MzhiMjI0MjhhZTg4MmRhNDVkMjU5NiJ9fX0="
      petEffects:
        - "movement speed:0.1"
        - "attack damage:0.2"

Pets:
   Common:
      - dog```
hardy inlet
#

ohh ok ok

#

i get it, thanks!

wheat fiber
#

Then set the list to that yaml list

#

Then in ur command stuff or gui or however you are doing it when they click or select dog you get ur Id and stuff from the first node

hardy inlet
#

I see, thank you!

#

is it better if i put it on a separate file

wheat fiber
#

You can

#

But it’s just another file you need to load

#

If you have ur common, uncommon, rare, … pets all in different files then yea Id make a new file for the list