Skript

Skript

743k Downloads

Better data storing

MissingReports opened this issue ยท 6 comments

commented

Suggestion

I feel like it would be nice for a way to store multiple data as one element in a list, since you can't store a list inside of a list
E.g:

set {_eventDataStructure} to an empty data structure
set element "Type" of {_eventDataStructure} to "Global Booster"
set element "EndDate" of {_eventDataStructure} to 10 minutes later
set element "Amount" of {_eventDataStructure} to 100
add {_eventDataStructure} to {events::*}

# Retrieving
loop {events::*}:
    set {_eventDataStructure} to loop-value
    set {_type} to element "Type" of {_eventDataStructure}
    # And so on

Another option is using SkReflect's array, or making it so you can store lists inside of lists

Why?

It's pretty hard to store multiple values in a list as one element

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.
commented

I like this idea

commented

why not {events::1::type} and so on

commented

It'd be hard to add an event and reidentify it later

commented

You may enjoy #7064

commented

It'd be hard to add an event and reidentify it later

what do you mean?

commented

it really depends on the end goal but I had the same issue on my minigame framework while creating instances of games.

the way i solved it is creating a random id for the game and storing that id in the player

ex.

function start(p: player):
  set {_instance} to random uuid
  set {var::%{_instance}%::end.date} to now
  set {current.instance::%{_p}'s uuid%} to {_instance}

on jump:
  set {_instance} to {current.instance::%player's uuid%}
  broadcast {var::%{_instance}%::end.date}

you can take inspiration from this if applicable