#Skript Stats Actionbar
1 messages · Page 1 of 1 (latest)
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”
alright cool
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?
Yea sure
Also yea I think it looks fine
Okay one sec
So this whole thing is part of a leveling system I’ve been working on
I see
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?
Don’t put “variable” before a variable
even without that it still doesn't work
Don’t put “is” before <
Whenever you compare 2 values it really should just be “if x < y:”
Ofc change the sign if needed
okay cool
then lastly
what does it take to delete a variable?
I heard you should do that for performance
is there a way to delete all variables
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
how exactly would a list like this work?
Here’s an example
set {player::%uuid of player%::stats::armor} to 10
set {player::%uuid of player%::stats::mana} to 65
Etc
Np
so if I prefixed everything with {stats::<stat_name_etc.>} I could just do delete {stats::*}?
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
ohhh I see okay
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
Okay cool
Also yes
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
^ 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
Lol
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
Alright
I was worried there would be conflictions if players had the same variables
Yea just make sure you name your variables properly and you’ll be fine
so I wanted to make them per player
yeah I appreciate that
thank you
When in doubt just follow this ^
alr cool
Good luck on your server
thank you!
Np
I appreciate it haha
Lol
if you ever have an interest in rpgs, just gimme a message lol
Oh lol nice
oh yeah