Solved Lambda loop-value issue

  • 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 community!

    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.

itsAaron_

New Member
Jun 20, 2017
6
1
0
Skript Version: 2.2-dev37c
Skript Author: bensku
Minecraft Version: 1.12.2

---
Full Code:
code_language.skript:
                loop {_presets::*}:
                    set {_presets::%loop-value%::*} to yaml nodes "presets.%loop-value%" from "plugins/Skript/scripts/presets/presets.yml"
                    yaml value "presets.%loop-value-1%.inGui" from "plugins/Skript/scripts/presets/presets.yml" is true
                    set {_item} to yaml value "presets.%loop-value%.guiItem" from "plugins/Skript/scripts/presets/presets.yml"
                    set {_item} to {_item} parsed as item
                    set {_name} to yaml value "presets.%loop-value%.name" from "plugins/Skript/scripts/presets/presets.yml"
                    set {_lore} to yaml value "presets.%loop-value%.lore" from "plugins/Skript/scripts/presets/presets.yml"
                    format slot {_slot} of player with 1 of {_item} named "&r%colored {_name}%" with lore coloured {_lore} to close then run [execute console command "/b createplot %loop-value%"]
                    add 1 to {_slot}

Errors on Reload: None


Console Errors: None

Other Useful Info: This essentially grabs all the "presets" of plot types for my server from a YAML file and displays it in a GUI, and it works perfectly except for one thing. The third argument always is the last loop-value no matter the situation, and I've tried checking to make sure it loops through every value and it does. It just seems like the lambda is grabbing the last loop-value it finds, and I'm not sure of a workaround for this.


Have you tried searching the docs? YES
Have you tried searching the forums? YES
What other methods have you tried to fix it? I've tried a bunch of small changes but can't really wrap my head around a way to fix this.
 
Skript Version: 2.2-dev37c
Skript Author: bensku
Minecraft Version: 1.12.2

---
Full Code:
code_language.skript:
                loop {_presets::*}:
                    set {_presets::%loop-value%::*} to yaml nodes "presets.%loop-value%" from "plugins/Skript/scripts/presets/presets.yml"
                    yaml value "presets.%loop-value-1%.inGui" from "plugins/Skript/scripts/presets/presets.yml" is true
                    set {_item} to yaml value "presets.%loop-value%.guiItem" from "plugins/Skript/scripts/presets/presets.yml"
                    set {_item} to {_item} parsed as item
                    set {_name} to yaml value "presets.%loop-value%.name" from "plugins/Skript/scripts/presets/presets.yml"
                    set {_lore} to yaml value "presets.%loop-value%.lore" from "plugins/Skript/scripts/presets/presets.yml"
                    format slot {_slot} of player with 1 of {_item} named "&r%colored {_name}%" with lore coloured {_lore} to close then run [execute console command "/b createplot %loop-value%"]
                    add 1 to {_slot}

Errors on Reload: None


Console Errors: None

Other Useful Info: This essentially grabs all the "presets" of plot types for my server from a YAML file and displays it in a GUI, and it works perfectly except for one thing. The third argument always is the last loop-value no matter the situation, and I've tried checking to make sure it loops through every value and it does. It just seems like the lambda is grabbing the last loop-value it finds, and I'm not sure of a workaround for this.


Have you tried searching the docs? YES
Have you tried searching the forums? YES
What other methods have you tried to fix it? I've tried a bunch of small changes but can't really wrap my head around a way to fix this.
I've had this issue a while ago as well, and I don't remember to have fixed it. But I would recommend using TuSKe for your GUI's, as SkQuery has bugs like this and more. You can also use the Skript's set slot and stuff like that, but you will have some problems transferring variable from one event to the other.
 
  • Like
Reactions: Uzumaki
I've had this issue a while ago as well, and I don't remember to have fixed it. But I would recommend using TuSKe for your GUI's, as SkQuery has bugs like this and more. You can also use the Skript's set slot and stuff like that, but you will have some problems transferring variable from one event to the other.
Alright thanks, I didn't want to outright say it was a glitch in case I was doing something dumb but I'll definitely start using TuSKe for my GUI's now.
 
  • Like
Reactions: TPGamesNL
Status
Not open for further replies.