#Variable in title
1 messages · Page 1 of 1 (latest)
you need %%
so %{skriptexp}%
but it would actually be %{skriptexp::%player%}%
ok
since that's the variable you want
thx
@light harbor
i have a question
how would i add more items to this and make it actually remove the items:
trigger:
set {_s} to amount of wheat and stone in player's inventory
add {_s}*10 to {money::%player's uuid%} and {_total}
send "You have sold all your stuff for $%{_total}%"
you should find a better sell system
im trying to code my own economy
so i can put all the stuff on a scoreboard
bc skript variables and others dont mix
function sellable() :: itemtypes:
return stone, diamond
function worth(item: itemtype) :: number:
return 1 if {_item} is stone
return 5 if {_item} is diamond
function sell(inventory: inventory, player: player, multi: number = 1, sendMessage: boolean = true):
loop sellable():
add (amount of loop-value in {_inventory} * (worth(loop-value) * {_multi})) to {_$}
remove all loop-value from {_inventory}
if {_$} is 0:
send "&cThere are no items to sell." to {_player} if {_sendMessage} is true
else:
send "&aYou sold all items for $%{_$}%&a." to {_player} if {_sendMessage} is true
add {_$} to {money::%{_player}'s uuid%}
command /sell:
trigger:
sell(player's inventory, player)
here's my old sell system from like a year ago
to add items just look at the code up top
ok
function sellable() :: itemtypes:
return stone, diamond
function worth(item: itemtype) :: number:
return 1 if {_item} is stone
return 5 if {_item} is diamond
change to
function sellable() :: itemtypes:
return stone, diamond, emerald
function worth(item: itemtype) :: number:
return 1 if {_item} is stone
return 5 if {_item} is diamond
return 7 if {_item} is emerald
that would add emeralds for $7
right
nah
to the one im using?
it's already the one you're using
that yellow message is fine, you musta pasted the code weirdly
the functions are supposed to be their own thing
it's not in the command or anything
get rid of your old sell command and just put my stuff
it's not supposed to be in an existing command
ok
i got rid off the other sell command
is it supposed to be in a file with .sk?
return stone, diamond, emerald
function worth(item: itemtype) :: number:
return 1 if {_item} is stone
return 5 if {_item} is diamond
return 7 if {_item} is emerald
function sell(inventory: inventory, player: player, multi: number = 1, sendMessage: boolean = true):
loop sellable():
add (amount of loop-value in {_inventory} * (worth(loop-value) * {_multi})) to {_$}
remove all loop-value from {_inventory}
if {_$} is 0:
send "&cThere are no items to sell." to {_player} if {_sendMessage} is true
else:
send "&aYou sold all items for $%{_$}%&a." to {_player} if {_sendMessage} is true
add {_$} to {money::%{_player}'s uuid%}
command /sell:
trigger:
sell(player's inventory, player)
it's because sell isn't indented
put 4 spaces / a tab before sell(player's inventory, player)
whatever you use
i did
4 more I mean
oh mb
in skript after every : you have to indent another level in the next line
i did it
set score "&a&lBalance: &f{money::%player%}" in sidebar of loop-player to 5
@light harbor
you need to add %% around the variable. So it would look like this %{money::%player%}%
that doesnt work
it does work
read the error
it says there is no player in a periodical event
it means you loop something for x minutes/seconds/hours etc. To be able to add players there too you need to loop the players. To loop players you would need to add a line that goes like this loop all players:. But that is not efficient neither good for your server. I'd recommend using skbee and a while loop instead for a scoreboard.
okay
so what i do?
do you have the addon skrayfall, i believe that will fix it. There is one thing about rayfall scoreboards that no one likes. They are flickery, which means every time the loop goes again the scoreboard goes away and comes back.
no
then what?
use skbee scoreboards instead
do you have a link?
wait
nvm
i got it
wait
but this one
only refreshes on join
do i change it to every 5 seconds?
No, when a player joins the scoreboard comes the wait on the bottom is the time until it refreshes. So if the wait is 1 minute then it would refresh every 1 minute
on join:
while player is online:
set title of player's scoreboard to "&eMy Server"
set line 4 of player's scoreboard to "&a " #set a random color code and a space to set the line to a blank space. PS: You need to set different color codes or add more spaces for each blank line, there can't be 2 lines with the same exact name.
set line 3 of player's scoreboard to "&fPlayer: "
set line 2 of player's scoreboard to "&fKills: "
set line 1 of player's scoreboard to "&7Server Ip:"
wait 1 second```
Hello! If you're reading this tutorial then you probably need help making a scoreboard, don't worry, I'll teach you step by step how to make a clean Scoreboard without flickering.
IMPORTANT INFO
REQUIREMENTS: Skript, SkBee
List of plugins needed if you want the scoreboard to have...
thx
you're welcome!
to show the content of a variable you need to wrap it around with %% so %{var}%
k
btw
1 last question
for the variables to update
on the scoreboard
will they need to rejoin?
there is no need to rejoin to see the updated scoreboard, thats why there is that wait. As i said, if the wait is 1 minute then it would refresh every 1 minute.
also, the wait is the most crucial part of that scoreboard skript. If you wouldn't have a wait the server is just waiting to crash
uhh
i know this will sound stupid
but why is this not working:
set {_online} to number of all players
while player is online:
set title of player's scoreboard to "&a&lSmooth&6&lFarms"
set line 4 of player's scoreboard to "&7&m>>--------------------<< "
set line 3 of player's scoreboard to "&a "
set line 2 of player's scoreboard to "&b&lOnline: &f {_online} "
set line 1 of player's scoreboard to "&7Server Ip:"
wait 1 second```
im talking about the {_online}
part
you need to put percentage signs around a variable in a string, like this:
"number of kills: %{_kills}%"
thx
btw for the variable
will it just update automatically?
without having to rejoin?
No
how can i make it auto update?
you could do something like this:
while player is online:
# update scoreboard
wait 1 second
so above
do i just add wait 1 second and thats it?
and remove the wait 1 second at the end?
don't worry about what I said, all you need to do is move the set {_online} to number of all players to be in the loop
Yes
You could try it :p
test what?
ip