Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- #---------------------------------------------------------------------
- #Internal configurations:
- #The location were SimpleBoard saves data.
- FileLoc: plugins/SimpleBoard/
- ConsolePrefix: &7[&aSimpleBoard&7] &r
- #---------------------------------------------------------------------
- #!Don't touch the options below unless you know what you're doing.
- #VarPrefix is the prefix placed before the variable. {HERE::*}
- #SKRIPT DEVELOPERS:
- #Recommened that you delete the list variable of the existing variable
- #before changing this variable name, Example:
- #!delete {SimpleBoard::*})
- VarPrefix: SimpleBoard
- version: 1.0.1
- #Made it faster
- #Update on start up
- #Changed the slots to match the config
- #Added quick checker for less data storage
- function SimpleBoardYMLSave(file: text = "none", empty: integer = 0):
- if {_file} is "config":
- set {_nodes::*} to yaml nodes with keys "%{_file}%" from file "{@FileLoc}%{_file}%.yml"
- loop {_nodes::*}:
- set {{@VarPrefix}::%{_file}%::%loop-value%} to yaml value "%{_file}%.%loop-value%" from file "{@FileLoc}%{_file}%.yml"
- else:
- set {_nodes::*} to yaml nodes with keys "config" from file "{@FileLoc}config.yml"
- loop {_nodes::*}:
- set {{@VarPrefix}::config::%loop-value%} to yaml value "config.%loop-value%" from file "{@FileLoc}config.yml"
- function SimpleBoardYML(file: text, data: text, node: text = "empty", object: text = "empty") :: text:
- if {_file} is "config":
- if {_data} is "write" or "set":
- set yaml value "%{_file}%.%{_node}%" from file "{@FileLoc}%{_file}%.yml" to "%{_object}%"
- SimpleBoardYMLSave("%{_file}%")
- exit
- if {_data} is "listadd":
- add "%{_object}%" to yaml list "%{_file}%.%{_node}%" from file "{@FileLoc}%{_file}%.yml"
- SimpleBoardYMLSave("%{_file}%")
- exit
- if {_data} is "listremove":
- remove "%{_object}%" from yaml list "%{_file}%.%{_node}%" from file "{@FileLoc}%{_file}%.yml"
- SimpleBoardYMLSave("%{_file}%")
- exit
- function SimpleBoardYMLKeys(file: text, data: text, node: text = "empty") :: objects:
- if {_file} is "config":
- if {_data} is "keys":
- return yaml nodes with keys "%{_file}%.%{_node}%" from file "{@FileLoc}%{_file}%.yml"
- else if {_data} is "readlist":
- return yaml list "%{_file}%.%{_node}%" from file "{@FileLoc}%{_file}%.yml"
- on script load:
- if file exists at "{@FileLoc}config.yml" is false:
- message "{@ConsolePrefix}&cGenerating config.yml" to console
- if {{@VarPrefix}::config::saveFiles} is "true":
- loop {{@VarPrefix}::config::*}:
- set yaml value "%loop-index%" from file "{@FileLoc}config.yml" to "%loop-value%"
- else:
- delete {{@VarPrefix}::config::*}
- SimpleBoardYML("config", "write", "version", "{@version}")
- SimpleBoardYML("config", "write", "saveFiles", "false")
- SimpleBoardYML("config", "write", "ScoreboardUpdate", "10")
- SimpleBoardYML("config", "listadd", "Scoreboard", "&6Player: &f%%player%%")
- SimpleBoardYML("config", "listadd", "Scoreboard", "&6Deaths: &f%%{example.variable}%%")
- SimpleBoardYML("config", "listadd", "Scoreboard", "&6Health: &f%%player's health%%")
- SimpleBoardYML("config", "write", "ScoreboardTitleUpdate", "5")
- SimpleBoardYML("config", "listadd", "ScoreboardTitle", "&cExample scoreboard")
- SimpleBoardYML("config", "listadd", "ScoreboardTitle", "&6Example scoreboard")
- SimpleBoardYMLSave()
- function SimpleBoardDeleteBoard(p: player):
- loop 15 times:
- delete the id based score "%{_p}%Slot%loop-number%" in stylish scoreboard "Simple-%{_p}%"
- delete stylish scoreboard "Simple-%{_p}%"
- on quit:
- SimpleBoardDeleteBoard(player)
- on join:
- if stylish scoreboard "Simple-%player%" exists:
- SimpleBoardDeleteBoard(player)
- if stylish scoreboard "Simple-%player%" is not set:
- add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
- create new stylish scoreboard named "Simple-%player%"
- set {_title::*} to SimpleBoardYMLKeys("config", "readlist", "ScoreboardTitle")
- set {_board::*} to SimpleBoardYMLKeys("config", "readlist", "Scoreboard")
- set title of stylish scoreboard "Simple-%player%" to "%{_title::1}%"
- set stylish scoreboard of player to "Simple-%player%"
- set {_slot} to size of {_board::*}
- loop {_board::*}:
- evaluate "set {_s} to ""%loop-value%"""
- create a new id based score "%player%Slot%{_slot}%" with text "%{_d::%{_slot}%}%%{_s}%" slot {_slot} for stylish scoreboard "Simple-%player%"
- subtract 1 from {_slot}
- while player is online:
- loop "%{{@VarPrefix}::config::ScoreboardUpdate}%" parsed as integer times:
- wait a tick
- loop {_title::*}:
- evaluate "set {_t} to ""%loop-value%"""
- set title of stylish scoreboard "Simple-%player%" to "%{_t}%"
- loop "%{{@VarPrefix}::config::ScoreboardTitleUpdate}%" parsed as integer times:
- wait a tick
- set {_slot} to size of {_board::*}
- loop {_board::*}:
- evaluate "set {_s} to ""%loop-value%"""
- set the text of id "%player%Slot%{_slot}%" to "%{_d::%{_slot}%}%%{_s}%"
- subtract 1 from {_slot}
Advertisement
Add Comment
Please, Sign In to add comment