Sorry for the title, i dont really know what to put there but that.
So, I have been making a skript to create, open and see item crates.
Everything working fine, but the function that shows the items a crate holds made me realise something nasty.
Skript: Bensku fork dev26f
Minecraft: 1.11
Addons: ExtrasSK 1.1, RandomSK 2.7.1, SharpSK 1.6.1.3, Skellett 1.8.8a, SkMorkaz 0.21, SkQuery 3.5.5-Lime, SkRayFall 1.9.7, SkStuff 1.6.4.1, SkUtilities 0.8.8, Umbaska 3-dev34
Searched the docs.
Searched the forum, or at least I tried.
No other methods tried, its probably the only way i can make it work.
Code:
What I'm trying: I stored an item in the list variable beforehand, I want to show that item on a chest, with its lore and everything the item has when you receive it, and also i want it to show, on another line of lore, the probability when it's being shown this way. Hence why i tried modifying the lore of the item this way.
What happens: I have been using Skript for a year and a half now, and I think this shouldn't be happening at all.
The global variable contains an item. I just want to copy the item to the local variable so i can edit it (to show the probability) without editing the stored item.
However, when I edit the local variable {_item}, the global variable {suministros.objetos.%{_chest}%::%loop-index%} gets edited too.
I have no clue at all why is this happening. The code works wonders, but each time i execute it, the probability gets added again to the item, showing things like this...
(The code is the same, just in spanish, my native language. The code I posted above just got translated so you can understand it a little better, Probabilidad=prob, Identificador=Id, Probabilidad exacta=Prob)
For what i can only assume not only {_item} is being edited, {suministros.objetos...} is edited too.
So, what I want to know: it is intended and I need to find a workaround, or is it not? If it's not, does it happens with other versions? Should i report it directly to Bensku?
Additional variable info: {suministros.weight.%{_chest}%::%loop-index%} contains a number, that's the weight of the item as im using a weight system.
So, I have been making a skript to create, open and see item crates.
Everything working fine, but the function that shows the items a crate holds made me realise something nasty.
Skript: Bensku fork dev26f
Minecraft: 1.11
Addons: ExtrasSK 1.1, RandomSK 2.7.1, SharpSK 1.6.1.3, Skellett 1.8.8a, SkMorkaz 0.21, SkQuery 3.5.5-Lime, SkRayFall 1.9.7, SkStuff 1.6.4.1, SkUtilities 0.8.8, Umbaska 3-dev34
Searched the docs.
Searched the forum, or at least I tried.
No other methods tried, its probably the only way i can make it work.
Code:
code_language.skript:
set {_counter} to 0
loop {suministros.objetos.%{_chest}%::*}:
add 1 to {_loop}
{_loop} is higher or equal to ({_point} + 1)
{_counter} is higher than 44:
stop loop
set {_item} to {suministros.objetos.%{_chest}%::%loop-index%}
set {_percent} to {suministros.weight.%{_chest}%::%loop-index%}/{_w}*100
set {_percent} to "%{_percent}%"
replace all "." with "," in {_percent}
if lore of {_item} is not "":
set lore of {_item} to "%lore of {_item}%||&8------------------------------||&dProb: &7%{_percent}%%%"
else:
set lore of {_item} to "||&dProb: &7%{_percent}%%%"
{_j} has permission "admin":
set lore of {_item} to "%lore of {_item}%||&5Id: &9%loop-index%||&fProb: &8%{suministros.weight.%{_chest}%::%loop-index%}%/%{_w}%"
set slot {_counter} of current inventory of {_j} to {_item}
add 1 to {_counter}
What I'm trying: I stored an item in the list variable beforehand, I want to show that item on a chest, with its lore and everything the item has when you receive it, and also i want it to show, on another line of lore, the probability when it's being shown this way. Hence why i tried modifying the lore of the item this way.
What happens: I have been using Skript for a year and a half now, and I think this shouldn't be happening at all.
code_language.skript:
set {_item} to {suministros.objetos.%{_chest}%::%loop-index%}
However, when I edit the local variable {_item}, the global variable {suministros.objetos.%{_chest}%::%loop-index%} gets edited too.
I have no clue at all why is this happening. The code works wonders, but each time i execute it, the probability gets added again to the item, showing things like this...
(The code is the same, just in spanish, my native language. The code I posted above just got translated so you can understand it a little better, Probabilidad=prob, Identificador=Id, Probabilidad exacta=Prob)
For what i can only assume not only {_item} is being edited, {suministros.objetos...} is edited too.
So, what I want to know: it is intended and I need to find a workaround, or is it not? If it's not, does it happens with other versions? Should i report it directly to Bensku?
Additional variable info: {suministros.weight.%{_chest}%::%loop-index%} contains a number, that's the weight of the item as im using a weight system.