#2 ERRORS: Variable issues

1 messages · Page 1 of 1 (latest)

arctic junco
#

format the code por favor

#

three of " ` " at the beginning and end

bright carbon
#

of the whole code?

arctic junco
#

ye

bright carbon
#

ok thats good to know i was trying to do that

#

eariler

arctic junco
#
code
#

^ right click, then click copy text

#

edit the original

#

instead of sending a new one

bright carbon
#
#SCOREBOARD
options:
    server: &b&lSky&f&lLegends

every 1 second:
    loop all players:
        set {_online} to number of all players
        wipe loop-players's sidebar
        set name of sidebar of loop-player to "{@server}"

        set score "" in sidebar of loop-player to 8
        set score "" in sidebar of loop-player to 7
        set score "&7&m-------------------" in sidebar of loop-player to 6
        set score "&9Player: &f%loop-player%" in sidebar of loop-player to 5
        set score "&3XP: &b%{xp::%player%}% &7/ &9%{level::%player%}%" in sidebar of loop-player to 4
        set score "&bPlayers Online: &f%{_online}%" in sidebar of loop-player to 3
        set score "&7&m--------------------" in sidebar of loop-player to 2
        set score "&7SkyLegendsMc.minehut.gg" in sidebar of loop-player to 1

#XPSYSTEM
variables:
    {xp::%player%} = 0
    {level::%player%} = 0

on player pickup:
    if event-item is dirt:
        add 1 to {xp::%player%}
        send action bar "&3[&b✧XP&3] &71+" to player

on death of player:
    if attacker is a player:
        add 1 to {xp::%attacker%}
        send action bar "&3[&b✧XP&3] &71+" to attacker

#LEVELS
on load:
    every 0.5 seconds:
        if {xp::%player%} => 500:
            add 1 to {level::%player%}

#COMMANDS
command /xp:
    trigger:
        send "&3XP Total: &7%{xp::%player%}%" to player

command /xpclear:
    trigger:
        clear {xp::%player%}
arctic junco
#

Also, do you have the uuid option enabled in the config?

bright carbon
#

yes i do

arctic junco
#

ok just making sure

#

You cant have every %timespan% inside a load event

bright carbon
#

i was trying player's uuid earlier and it was not making individual varibles for players in game

arctic junco
#

I would also instead of doing a periodical event to change a players level, to call a function whenever you give someone xp

bright carbon
#

can u give me an example of a function?

arctic junco
#

function Name(id: type):
Detailed

function CheckXP(p: player):
  if {_p} is online:
#
add 1 to {xp::%player%}
CheckXP(player)
#

so Name can be whatever you want it to be
id can be whatever you want it to be, its like basically having a local variable set for you
type has to equal the type of data youre sending

mellow breach
#

I would also strongly advise against looping all players every second

#

use on join: while player is online: wait 10 seconds #update scoreboard

bright carbon
#

so put this at the very start of the code

#

or should i replace it with the every 0.5 seconds

mellow breach
#

thats the better way to do the scoreboard

#

the very first event

bright carbon
#

so the on join code u just sent should be the very first event going

mellow breach
arctic junco
#

counter argument

on join:
  while player is online:
    wait 10 seconds
    #update scoreboard function

Reason I say do a function, is because if you make any changes to the scoreboard. and reload it wont update for players, and theyll have to relog

mellow breach
#

^

mellow breach
bright carbon
#

will that mess with the scoreboard updating at all?

#

for example the scorboard will have a XP: 0 / 1 tab in it

arctic junco
#

It'll just be every 10 seconds instead of 1. But thats shouldnt really matter tbh

bright carbon
#

ok

#

can i set the wait 10 seconds to 2 seconds instead or does that mess with my code a little bit

mellow breach
#

no, its whatever interval you want

arctic junco
#

I mean, you can, but the more players you have, the laggier it will become

bright carbon
#

i see

mellow breach
#

i just dont see a reason to update scoreboards that often.

#

personally, I actually only update mine periodically every minute.
but I also update it on damage: and stuff. then it's only updated for the active players who'll notice if it stops