#Skript Stats Actionbar

1 messages · Page 1 of 1 (latest)

somber oyster
#

any ideas at all?

proven moon
#

Ok so

#

You don’t have to loop all players in this case

#

You can just check for the player

#
       while player is online:
       # do stuff
#

The indentation kinda sucks bc I’m on mobile rn so I just spammed space for it but it should get the point across

#

Also it’s much more efficient to do it this way because otherwise you’re constantly looping every player more and more frequently the more players that you have in the server

#

Pretty much after that you would just fix it by changing every “loop-player” with “player”

somber oyster
#

Ill let you know how that goes

#

is my syntax for player's uuid and all that good?

#

@proven moon do you mind if I ask a follow up question about a related script?

proven moon
somber oyster
#

Okay one sec

#

So this whole thing is part of a leveling system I’ve been working on

proven moon
#

I see

somber oyster
#

One of the features is smthn called vessel

#

Which is basically an equivalent to mana

#
on join:
  while player is online:
    if {skill-vessel::%player's uuid%} is < variable {skill-vessel-max::%player's uuid%}:
      wait 0.5 seconds
      set {skill-vessel::%player's uuid%} to {skill-vessel::%player's uuid%} + 1 for player

#

any idea why this code is throwing errors?

proven moon
#

Don’t put “variable” before a variable

somber oyster
#

even without that it still doesn't work

proven moon
#

Don’t put “is” before <

#

Whenever you compare 2 values it really should just be “if x < y:”

#

Ofc change the sign if needed

somber oyster
#

okay cool

#

then lastly

#

what does it take to delete a variable?

#

I heard you should do that for performance

proven moon
#

delete {variable}

#

You can also delete entire lists

#

delete {list::*}

somber oyster
#

is there a way to delete all variables

proven moon
#

Stop your server then delete the variables folder

#

I think

#

Realistically you won’t really need to delete all variables that often unless you really are using that many.

#

But if you want an easy way to delete variables, group your variables into lists

#

Like {player::%uuid of player::stats::*} for example can contain all the stats for said player, and you can delete this just by saying “delete {player::%uuid of player::stats::**}” <- 1 asterisk not 2

#

E the asterisks disappeared

somber oyster
proven moon
#

Here’s an example

somber oyster
#

btw, thanks so much for your help bro

#

I appreciate it so much

proven moon
#

set {player::%uuid of player%::stats::armor} to 10

set {player::%uuid of player%::stats::mana} to 65

Etc

#

Np

somber oyster
#

so if I prefixed everything with {stats::<stat_name_etc.>} I could just do delete {stats::*}?

proven moon
#

Essentially a way to think about it.. it’s like a folder on your computer. You can make folders inside folders. The first part of the variable, (player) names the “starting” folder, and then the next part is like a folder inside that folder, which saves the uuid of the player

#

And so on

somber oyster
#

ohhh I see okay

proven moon
#

It’s like making a ton of folders inside folders for organization

#

And then when you don’t need certain info you can delete entire folders

#

If that helps you understand list variables

somber oyster
#

Okay cool

proven moon
#

But keep in mind this would delete everyone’s stats if you use that format

#

Instead,start the variable by defining a player

#

Kinda like my example

#

{player::%uuid of player%::etc…}

#

Cuz then when you want to delete a particular player’s info, all it takes is to delete that player’s “folders” of data

#

A good way to name variables is to start very broad and get more specific as you name it

proven moon
# proven moon {player::%uuid of player%::etc…}

^ like in this case, you start with “player”, then you go more specific by specifying a specific player’s uuid, and then you get even more specific by taking a very specific part of the player, it’s stats

#

Sorry this is a lot lol

somber oyster
#

No I get you haha

#

well so here's the thing

#

since you're in so deep now haha

proven moon
#

Lol

somber oyster
#

I have all the variables run the math, then I set a scoreboard objective to those variables per player

#

so I only really need the variables for the math portion

#

then I don't need them anymore

proven moon
#

Alright

somber oyster
#

I was worried there would be conflictions if players had the same variables

proven moon
#

Yea just make sure you name your variables properly and you’ll be fine

somber oyster
#

so I wanted to make them per player

somber oyster
#

thank you

proven moon
somber oyster
#

alr cool

proven moon
#

Good luck on your server

somber oyster
#

thank you!

proven moon
#

Np

somber oyster
#

I appreciate it haha

proven moon
#

Lol

somber oyster
#

if you ever have an interest in rpgs, just gimme a message lol

proven moon
#

Oh lol nice

somber oyster
#

oh yeah

somber oyster
#

sorry @proven moon Im back 😭

#

lemme know when you have the chance to help xD

#

actually sorry for the ping