Jump to content

Ofus | Skript Tutorials | Scoreboards


Ofus-Will

Recommended Posts

BEFORE READING:
1) If you have skrayfall installed, you must disable the enableFastScoreBoards option in skrayfall's config.yml

2) A scoreboard line can not be set to nothing, if you want an empty line, you must set it to a color code (e.g. "&0")

3) Two different scoreboards line can not have the same text, a work around is yet again by using color codes as seen above (e.g. "&eText" and "&1&eText" to display 2 lines the same)

4) There are 3 addons labelled skbee on minehut's download page, make sure you download the one that's description is "A simple solution to make your servers more bold!"


INTRO

Following the introduction of the new add-on skbee, i thought it'd be wise to create a scoreboard tutorial using the add-on. The only semi-viable options for minehut users prior to this add-ons introduction were skellet and skrayfall, which both had their issues. Noticeably, skellet had large parsing times and unnecessarily complex syntaxes and skrayfall scoreboards flickered.

important: if you are attempting to support 1.8 clients on your minehut server using protocolsupport for example, your skbee scoreboard lines will cut off at after 16 characters  for those 1.8 users

READING SYNTAX PATTERNS (syntaxes are ways you can write code)

for this tutorial, i will be providing the syntax patterns and example code. In the chance that you do not want to use this template, this is how you interpret skript's syntax patterns. If you do not understand, this do not worry. This is for more advanced users.

  • %% = an object/objects (e.g. player(s) or string(s))
  • [] = optional, meaning it is not mandatory
  • (option 1|option 2) = interchangeable, but only one can be used

For example, all these patterns are correct for the syntax [score]board of %player% is (on|off):

  • scoreboard of player is on
  • scoreboard of player is off
  • board of player is on
  • board of player is off

there are 6 simple, sufficient syntaxes provided by skbee which include:

Screenshot (95).png

 

SETTING UP YOUR SCOREBOARD
 

When making player specific scoreboards, we only want their scoreboard to exist when they're online (duh). Therefore, we need to listen to two player specific events: on join and on disconnect.

Luckily for us, if we use one of skbee's syntaxes (set line or set title), skbee will automatically handle setting up a player's scoreboard for us, so we don't need a syntax like create scoreboard. Useful, right? What this means, is that all we need to do is set the title and lines of our scoreboard and we're all done!

on join:
	set title of player's scoreboard to "my server!"
	set line 3 of player's scoreboard to "top line"
	set line 2 of player's scoreboard to "middle line"
	set line 1 of player's scoreboard to "bottom line"

2020-04-01_20.37.20.png

 Note: minecraft scoreboards always displays the lines highest to lowest from top to bottom (3, 2, 1 instead of 1, 2, 3)

Cool! we've got a scoreboard. Simple. However, odds are you're going to want to have variables on your scoreboard, right?

For this example, I will be displaying online players on the scoreboard

There are two ways of updating your scoreboard. For this tutorial we're going to be using a while loop as it is easier to use. For more advanced users, see the advanced scoreboards header for more efficient methods

a while loop basically means, for as long as a certain statement (condition) is true, repeat something. Here's an example of it put in to use (along with the use of some colour codes)

on join:
	set title of player's scoreboard to "&6&lServer Info"
	while player is online:
		set line 1 of player's scoreboard to "&7• &eOnline: &f%size of all players%"
		wait 1 second

2020-04-01_22_15_59.thumb.png.5d538922b1e53d97bfd99ee15bcc8f8d.png

Great! Now we've got a scoreboard that will accurately display the amount of online players. It's important to remember that this works for more than just online players, and you can make it display any skript variable you'd like by including %{variable}%

When the player leaves the server we want to clear their scoreboard because we don't want to store unnecessary data for players if they're not online. We can do this easily by including:

on disconnect:
	clear player's scoreboard

And that's all there is to it! I hope you've found this tutorial useful, if you have any requests for tutorials on anything else please let me know.

Skbee download link: https://www.spigotmc.org/resources/skbee-skript-addon.75839/

 

ADVANCED SCOREBOARDS

note: I will not being going in to as much detail here, if you don't understand the content below i suggest you stick with the first method

as i'm sure some of you are all aware, having a while loop that loops every 1 second for all players isn't the best way of updating a scoreboard in some cases

A better more complicated method for scoreboards that display data that's manipulation is easily detectable is by passing the setting of lines to an updateBoard() function. For this example i will be using player kills and deaths

function updateBoard(p: player):
	set {_uuid} to {_p}'s uuid
	set line 2 of {_p}'s scoreboard to "&6Kills: &f%{kills::%{_uuid}%} ? 0%"
	set line 1 of {_p}'s scoreboard to "&6Deaths: &f%{deaths::%{_uuid}%} ? 0%"
    
on join:
	set title of player's scoreboard to "&e&lStats"
	updateBoard(player)
    
on death of player:
	add 1 to {deaths::%victim's uuid%}
	if attacker is a player:
		add 1 to {kills::%attacker's uuid%}
	updateBoard(victim)
	updateBoard(attacker)

on disconnect:
	clear scoreboard of player

Notice how on join we don't require a loop, merely the initial set up of the lines. Instead, we listen in on the on death event, allowing us to only update the scoreboard of the victim and attacker when the information displayed on their boards change.

If your scoreboard is not player-specific, but still contains variables that frequently change, it might be better for you to structure your updateBoard() function like so:

function updateBoard(p: players):
	loop {_p::*}:
		set line 1 of loop-value's scoreboard to "..."

 

Edited by Ofus-Will
  • Like 1
Link to comment
Share on other sites

On 4/6/2020 at 8:02 PM, Ezekia said:

Nice - kinda related to scoreboards but could you tell me what the thing is for displaying pex ranks on a scoreboard? Obviously %rank% doesn't work.

it's just %player's rank%, alternatively you can use %player's prefix%. Both require a valid group plugin to work

  • Like 1
Link to comment
Share on other sites

4 hours ago, Ofus-Will said:

it's just %player's rank%, alternatively you can use %player's prefix%. Both require a valid group plugin to work

i'm stupid - i've tried everything but that lol

By reading this you are a confirmed nerd

IMG_1036.PNG

lolololol.PNG

lmao.PNG

Link to comment
Share on other sites

On 4/9/2020 at 2:17 PM, xlr100 said:

Cool tutorial, good job!

Should probably go into more details about group specific scoreboards (Like mini-games)

this tutorial was more focused on the conceptual idea of scoreboards, i feel like situation-specific scoreboards aren't actually related to scoreboards, but rather custom mechanisms that can be displayed on the scoreboard. 

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Necroposting, or replying on posts that haven’t been replied to in over a month is not allowed, unless the post is still relevant such as an active giveaway or a tutorial post

its a tutorial : )

how do i display balance on this scoreboard. but fixed so it doesnt display 1.99999999999.

 

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
20 hours ago, JettResetYT said:

Can you make a /start skript to give the player that types it a wood_pickaxe 1 unbreakbable

please

 

im not toooo sure about the enchants but its pretty easy

command /start:

  trigger:

    give player wooden pickaxe with unbreakable 999

 

  • Like 1

By reading this you are a confirmed nerd

IMG_1036.PNG

lolololol.PNG

lmao.PNG

Link to comment
Share on other sites

  • 2 months later...
On 4/7/2020 at 12:32 AM, Ezekia said:

Nice - kinda related to scoreboards but could you tell me what the thing is for displaying pex ranks on a scoreboard? Obviously %rank% doesn't work.

The best way to do that would be using Ersatz (Skript Addon) and PlaceholderAPI.

 

Once you install PlaceholderAPI, all you have to do is, execute /papi ecloud download Vault

Vault will basically provide you with placeholders related to permissions and economy plugin. /papi ecloud placeholders Vault for a full list of placeholders.

 

Once you install Ersatz, you will be able to grab PlaceholderAPI placeholders, and set those as variables in Skript.

Here is an example:

command /test:
    trigger:
        # Setting a temp variable. "%%vault_eco_balance%%" or "vault_eco_balance" both will work.
        set {_balance} to placeholder "vault_eco_balance" from player
        # Showing player their current balance. (If you have essentials/currency plugin installed)
        send "%{_balance}%" to player

 

Now since you have Vault expansion installed, we will be able to grab and use any of these placeholders:388110695_ScreenShot2020-10-19at3_18_10PM.png.d642c557a3161b7d4bb437c63875c899.png

Also, use /papi parse me %some_placeholder% to check which one you want to use.

 

Also make sure you have Vault installed.

  • Like 1

Hello there! If you're reading this, hope you're having a wonderful day!

 

Feel free to contact me via Discord (CoolProgrammer#1920) for any help.

My DMs are always open for help.

You can also message via. forum messages for help.

1604908226_ScreenShot2021-01-28at10_32_28AM.png.2646ad6be239a9d0756a99e8e15602ab.png

Also, don't hesitate to leave a like on my post if I helped you in any way.

Link to comment
Share on other sites

2 hours ago, CoolProgrammer said:

The best way to do that would be using Ersatz (Skript Addon) and PlaceholderAPI.

 

Once you install PlaceholderAPI, all you have to do is, execute /papi ecloud download Vault

Vault will basically provide you with placeholders related to permissions and economy plugin. /papi ecloud placeholders Vault for a full list of placeholders.

 

Once you install Ersatz, you will be able to grab PlaceholderAPI placeholders, and set those as variables in Skript.

Here is an example:


command /test:
    trigger:
        # Setting a temp variable. "%%vault_eco_balance%%" or "vault_eco_balance" both will work.
        set {_balance} to placeholder "vault_eco_balance" from player
        # Showing player their current balance. (If you have essentials/currency plugin installed)
        send "%{_balance}%" to player

 

Now since you have Vault expansion installed, we will be able to grab and use any of these placeholders:388110695_ScreenShot2020-10-19at3_18_10PM.png.d642c557a3161b7d4bb437c63875c899.png

Also, use /papi parse me %some_placeholder% to check which one you want to use.

 

Also make sure you have Vault installed.

This is a good tutorial, you should post this in the Skript section

 

but please do not post on topics over 1 month old

 

Locked 🔒

  • Like 1

Default: Feb 6 2018

VIP: April 14 2019

Jr. Mod: September 12 2020

Mod: Jan 11 2021

 

Am a person

Hello

image.png.bd769c496f267e5b4b56b5b53145033f.png

Link to comment
Share on other sites

  • Reassembly locked this topic
  • Vinixs unlocked this topic
  • 3 months later...

Topic Locked.

Please don't reply on month-old, inactive threads (necro-posting). 

𝚄𝚗𝚝𝚛𝚎𝚊𝚝𝚎𝚍

𝔻𝕚𝕤𝕔𝕠𝕣𝕕: @𝕌𝕟𝕥𝕣𝕖𝕒𝕥𝕖𝕕#𝟘𝟘𝟘𝟙

News & Updates  Rules • Helper Application

Reports • Appeals

𝚂𝚝𝚊𝚏𝚏 𝚘𝚗 𝙼𝚒𝚗𝚎𝚑𝚞𝚝 𝚜𝚒𝚗𝚌𝚎 𝙹𝚞𝚗𝚎 𝟹𝟶𝚝𝚑, 𝟸𝟶𝟸𝟶

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...