Whenever I modify the lore of a local variable that has previously been taken from a hard variable, any edits to the lore are stacked onto the hard variable,
e.g. If I add "test" to the bottom of the local var, the hard var would also get "test" added to it, eventually adding a multitude of "tests" every time the line is run
It's almost as if setting a local variable creates a reference to the original instead of making a copy.
command /loreTest:
trigger:
set {_item} to {LoreTest}
set {_lore::*} to lore of {_item}
set lore of {_item} to "blobbytest" and {_lore::*}
create a gui with virtual chest with 6 rows named "%{_owner}%'s Shop":
make gui slot 1 with {_item}
open last gui to player
The expected behaviour is the hard variable is not modified and the local variable creates a new instance of the item.
No Errors or console errors
Each of these screenshots are taken after closing and opening the command above ^
EDIT:
I double checked the hard variable is being modified with !give player {var} and it continued giving me the item with the modified lore.
Please provide a self-contained example that works without addons.
I have the same bug (I think). I had some weird bugs with a script that I use to create guis, store items in guis etc.
While I was working in the guis, I noticed that skript was overwriting the lore of the item's in my player's inventory / hotbar (can not reproduce as of now). At least I could reproduce the bug of skript overwriting original item lore instead of local variable item's lore.
Versions:
I am using Skript 2.3.3.
I am using Tuske (for GUIs) [TuSKe v1.8.2-Pikachu-Patch-3]: https://skripttools.net/dl/TuSKe+1.8.3-PikachuPatch-v3.jar
The problem:
Script is changing the original lore of an item instead of ONLY changing the lore of the item's local variable.
My script for testing:
command /debugi [<text>] [<text>] [<text>]:
trigger:
set {_id} to arg-1
set {_slot} to 0
loop 5 times:
message "Slot: %{_slot}%"
message "ITEM: %{guimake::%{_id}%::slot::%{_slot}%::item}%"
message "ITEM-LORE: %{guimake::%{_id}%::slot::%{_slot}%::item}'s lore%"
message "PRICE: %{guimake::%{_id}%::slot::%{_slot}%::price}%"
add 1 to {_slot}
command /testing1 [<text>] [<text>] [<text>]:
trigger:
set {_id} to arg-1
set {_slot} to 0
set {guimake::%{_id}%::slot::%{_slot}%::item} to player's tool
set {guimake::%{_id}%::slot::%{_slot}%::price} to 100
set {guimake::%{_id}%::slot::%{_slot}%::action} to "buy"
command /testing2 [<text>] [<text>] [<text>]:
trigger:
set {_id} to arg-1
set {_slot} to 0
set {_p} to player
skellett open "CHEST" with 1 rows named "testgui" to {_p}
set {_cs} to 0
set {_item} to {guimake::%{_id}%::slot::%{_cs}%::item}
if {guimake::%{_id}%::slot::%{_cs}%::price} is set:
set {_test} to "-- %{guimake::%{_id}%::slot::%{_cs}%::price}% --"
add {_test} to {_thelore::*}
make a gui slot {_cs} of {_p} with {_item} with lore {_thelore::*} to run gui click event
Step by step:
It's overwriting original item's lore!!! That should be fixed asap.
And here is a simple skript to reproduce:
1.) Take item in your hand (e.g. diamond)
2.) execute command /loretest
command /loretest [<text>]:
trigger:
set {testtool::item} to player's tool
set {_item} to {testtool::item}
add "test lore" to {_testlore::*}
set {_item}'s lore to {_testlore::*}
give {_item} to player
wait 1 second
give {testtool::item} to player
Perfectly sums it up! I'm not the best at explaining the bugs so thank you!!
Sorry about using Tuske before, I didn't even think of it at the time. Here is my code editted from above to have no addons, just in case it is any help at all from the above explanation ^.
Expression to set to an item (Or you could create a command):
!set {LoreTest} to player's tool
command /loreTest:
trigger:
set {_item} to {LoreTest}
set {_lore::*} to lore of {_item}
set lore of {_item} to "blobbytest" and {_lore::*}
give {_item} to player
Each use of this command will add another line of "BlobbyTest" to the player's tool
Apologies if I'm doubling up on the above by @bloggy, I figure multiple explanations can't hurt.
It's all good @Blobbyguy
This bug cost me some hours to find out it's not my script but Skript itself ... I was about smashing my head against a wall :face_with_head_bandage:
I just hope that bensku can fix this asap because I have lots of scripts with item variables and where I set lores which don't work at the moment.
@bensku this should be marked as high priority I think
@bensku this should be marked as high priority I think
It might be problematic but it isn't as much of an issue as others are (comparison issues for example).
I still think this should be labeled as a higher priority bug since I see more issues like this being reported.
It's completely messing with item's lore at the moment, can't understand why this has not been hotfixed.
Again, we are well aware of the issue. We're sorry you're experiencing this but there are still more important issues to be fixed. If it hasn't been fixed yet it is either because it isn't an easy fix or the fact that we're focusing on other things, PRs are also accepted.
I'm quite busy these days, and it seems so are other devs. Unfortunately, lack of manpower translates to long(er) bug fix times. The obvious solution would be getting more people to help with Skript development.
I'd help but I have not experience with Java programming
I can confirm this issue still exists on 2.3.5
Can we push this?! There is no way working with items and lores in GUIs at the moment :-(