Moving item from one list to another.

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

Kowal9833

New Member
Aug 17, 2023
6
1
3
I have some trouble with my skript. Items should be saved in "drops" list after death, and when the items despawn, they should be moved from "drops" list to "stuff" list.
Items do save in "drops" list, but I have problems moving them to "stuff" list after items despawn. So I'm doing something wrong in the 3rd segment... Any ideas?

Code:
on join:
   if {players::*} does not contain player's uuid:
       add player's uuid to {players::*}

on death of player:
   set {_playeruuid} to victim's uuid
   add drops to {drops::%{_playeruuid}%::*}

on item despawn:
   loop {players::*}:
       loop {drops::%loop-value-1%::*}:
           if event-entity is loop-value-2:
               add loop-value-2 to {stuff::%loop-value-1%::*}
               remove loop-value-2 from {drops::%loop-value-1%::*}
 
Last edited:
I have some trouble with my skript. Items should be saved in "drops" list after death, and when the items despawn, they should be moved from "drops" list to "stuff" list.
Items do save in "drops" list, but I have problems moving them to "stuff" list after items despawn. So I'm doing something wrong in the 3rd segment... Any ideas?

Code:
on join:
   if {players::*} does not contain player's uuid:
       add player's uuid to {players::*}

on death of player:
   set {_playeruuid} to victim's uuid
   add {drops::%{_playeruuid}%::*} to drops

on item despawn:
   loop {players::*}:
       loop {drops::%loop-value-1%::*}:
           if event-entity is loop-value-2:
               add loop-value-2 to {stuff::%loop-value-1%::*}
               remove loop-value-2 from {drops::%loop-value-1%::*}
Try debugging
 
Hey, thx for the reply!
Sorry for my poor knowledge, but how do I debug? Is that a command or something else I'm supposed to do?
U either change verbosity in skript config to see every line that gets executed or broadcast something after and before the check / loop ur doing
 
I've noticed that it gets stuck after 11th line. I don't know how to frase it anyhow else tho. Shouldn't this work? I'm pretty confused.
Code:
if event-entity is loop-value-2:

U either change verbosity in skript config to see every line that gets executed or broadcast something after and before the check / loop ur doing
 
I've noticed that it gets stuck after 11th line. I don't know how to frase it anyhow else tho. Shouldn't this work? I'm pretty confused.
Code:
if event-entity is loop-value-2:
Try broadcasting event-entity and loop-value-2
 
Try broadcasting event-entity and loop-value-2
It was a great idea! I think I know why it isn't happening. Skript is comparing "64 baked potatoes" with "dropped 64 baked potatoes", and that's why it's never the same. I have no idea how to fix it tho :emoji_frowning:
 

Attachments

  • Zrzut ekranu 2023-08-17 212353.png
    Zrzut ekranu 2023-08-17 212353.png
    2.9 KB · Views: 125
Okay, I think I know why it isn't happening. Skript is comparing "64 baked potatoes" with "dropped 64 baked potatoes", and that's why it's never the same. I have no idea how to fix it tho

Set {_t} to “%event-item%”
Remove all “dropped “ from {_t}
If “%loop-value-2%” = {_t}:
 
Set {_t} to “%event-item%”
Remove all “dropped “ from {_t}
If “%loop-value-2%” = {_t}:
It ain't working, I tried similar things previously.
 

Attachments

  • Zrzut ekranu 2023-08-17 213059.png
    Zrzut ekranu 2023-08-17 213059.png
    27.8 KB · Views: 122