Solved Why is this nested list not looping?

  • Thread starter Deleted member 9003
  • Start date
  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
D

Deleted member 9003

Hi guys :emoji_slight_smile:

on right click:
delete {wands::*}

set {_wand} to "elder.wand"

set {wands::%{_wand}%::name} to "elder.wand"
set {wands::%{_wand}%::display.name} to "Elder Wand"
set {wands::%{_wand}%::lore} to "Wand used by Wizards from an era of the past."
set {wands::%{_wand}%::min.damage} to 5
set {wands::%{_wand}%::max.damage} to 7
set {wands::%{_wand}%::speed} to 1

clear {_wand}

loop {wands::*}:
broadcast "test" # doesnt show
broadcast "%{%loop-value%::name}%" # doesnt show
broadcast "%{wands::%loop-index%::name}%" # doesnt show
broadcast all indices of {wands::*} # doesnt show

broadcast "i am after loop %{wands::elder.wand::name}%"​


My code above is not functioning, the comments indicate whats wrong. Let me know if you have any solutions :emoji_wink:
 
Hi guys :emoji_slight_smile:

on right click:
delete {wands::*}

set {_wand} to "elder.wand"

set {wands::%{_wand}%::name} to "elder.wand"
set {wands::%{_wand}%::display.name} to "Elder Wand"
set {wands::%{_wand}%::lore} to "Wand used by Wizards from an era of the past."
set {wands::%{_wand}%::min.damage} to 5
set {wands::%{_wand}%::max.damage} to 7
set {wands::%{_wand}%::speed} to 1

clear {_wand}

loop {wands::*}:
broadcast "test" # doesnt show
broadcast "%{%loop-value%::name}%" # doesnt show
broadcast "%{wands::%loop-index%::name}%" # doesnt show
broadcast all indices of {wands::*} # doesnt show

broadcast "i am after loop %{wands::elder.wand::name}%"​


My code above is not functioning, the comments indicate whats wrong. Let me know if you have any solutions :emoji_wink:
Add this: `set {wands::%{_wand}%} to true`
 
Hey thanks for your help, may I know why that fixes the error?
Ofcourse! Skript's loops work by looping the indices. Let's say you have this:
{list::a} = 1
{list::b} = 2
{list::c} = 3
It will loop through the indices a, b and c.
Now let's say you have this:
{list::a::test1} = 1
{list::a::test2} = 2
{list::a::test3} = 3
When you loop {list::*}, Skript will look at all of the indices directly in {list::*}. Since {list::a} is not set, it wouldn't be looped over, as the loop-value must be set.
I would say that this is not really a bug, but more a design flaw in Skript due to the way lists were created in Skript.
 
  • Like
Reactions: Deleted member 9003
Status
Not open for further replies.