1. 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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

on variable update

Discussion in 'Addon Suggestions' started by titustitus98, Feb 11, 2020.

  1. titustitus98

    titustitus98 Member

    Joined:
    Feb 19, 2018
    Messages:
    46
    Likes Received:
    0
    Hi this is a suggestion for an addon or a new skript feature.

    My suggestion is a new event called "on variable update" which would trigger whenever a variables is changed.

    For example, say I have a variable called "{money::%player%}" and that it's default value is 0, so suppose I want there to be a message sent in chat when this number is updated, this would be the code for it:

    on variable update:
    if event variable is {money::%player%}:
    send "hi" to event-player
     
  2. 3meraldK

    3meraldK New Member

    Joined:
    Dec 27, 2019
    Messages:
    6
    Likes Received:
    1
    how would skript know what player did you mean
    big facepalm bruh
     
  3. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    430
    Likes Received:
    30
    Instead of facepalming, consider this. The event would be "on variable change", and you can loop all players and have a check, something like this: "if event-variable is {_blahblah::%loop-player%}" then go from there
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Theres no need for this.
    Variables do not update themselves, they only update when YOU update them in your code.
    If you need to find out when it updates, well, look at where you change said variable, or create functions so you can do multiple things when the variable needs to be changed.
     
  5. Govindas

    Govindas Active Member

    Joined:
    Feb 5, 2017
    Messages:
    79
    Likes Received:
    5
    I think this would be a nice addition, a lot of cool stuff could be done with this without a need to rewrite all of your code to make it a function. (for example linking all variables to external database) and overall this could be used for cross-script communication without load order issues, like set {starteventnow} to true, then many scripts which listen to on variable update event, could trigger code on this variable set.

    yes, for the most part this won't be needed to anyone, just a cool feature for those rare ones who need it.
     
  6. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    344
    Likes Received:
    22
    I agree 100%
     
  7. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    The load order issues will still remain. The only thing ur dooing is making a duplicate of the on script load: event.

    Code (Text):
    1. Skript 1 CORE:
    2.  
    3. on var change:
    4.     if event-var = "starteventnow":
    5.         if change value = true:
    6.             LOADIN SKRIPT 2
    7.  
    8. Skript 2 Dependency:
    9.  
    10. on script load:
    11.     set {starteventnow} to true
    Code (Text):
    1.  
    2. Skript 1 CORE:
    3.  
    4. function loadsk2(value: boolean):
    5.     LOADIN SKRIPT 2
    6.  
    7. Skript 2 Dependency:
    8.  
    9. on script load:
    10.     loadsk2(true)
    11.  
    if skript 2 loads before skript 1 both won't fix the order issues.

    Double databases are also not recomended except wenn making backups.

    Only thing i can see is another event in skript causing our servers to lag more.
     
  8. Govindas

    Govindas Active Member

    Joined:
    Feb 5, 2017
    Messages:
    79
    Likes Received:
    5
    I think you have completely misunderstood what I meant, I wasn't talking about functions or on script load events, also I don't think events cause noticeable lag. I did not mean double databases too. (talking bout stuff like {-variables} going to a separate database, for example mysql since skript doesn't support that properly anymore, I'd make a queue on that event, and every x seconds send a query to sql to put it there)
     
  9. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    are u talking about databases of skript it self or not?
    --- Double Post Merged, Mar 11, 2020, Original Post Date: Mar 11, 2020 ---
    from the config
     

Share This Page

Loading...