moeycvbn12

Untitled

Nov 30th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.95 KB | None | 0 0
  1. options:
  2. #---------------------------------------------------------------------
  3. #Internal configurations:
  4. #The location were SimpleBoard saves data.
  5. FileLoc: plugins/SimpleBoard/
  6. ConsolePrefix: &7[&aSimpleBoard&7] &r
  7.  
  8.  
  9. #---------------------------------------------------------------------
  10. #!Don't touch the options below unless you know what you're doing.
  11.  
  12. #VarPrefix is the prefix placed before the variable. {HERE::*}
  13. #SKRIPT DEVELOPERS:
  14. #Recommened that you delete the list variable of the existing variable
  15. #before changing this variable name, Example:
  16. #!delete {SimpleBoard::*})
  17. VarPrefix: SimpleBoard
  18. version: 1.0.1
  19. #Made it faster
  20. #Update on start up
  21. #Changed the slots to match the config
  22. #Added quick checker for less data storage
  23. function SimpleBoardYMLSave(file: text = "none", empty: integer = 0):
  24. if {_file} is "config":
  25. set {_nodes::*} to yaml nodes with keys "%{_file}%" from file "{@FileLoc}%{_file}%.yml"
  26. loop {_nodes::*}:
  27. set {{@VarPrefix}::%{_file}%::%loop-value%} to yaml value "%{_file}%.%loop-value%" from file "{@FileLoc}%{_file}%.yml"
  28. else:
  29. set {_nodes::*} to yaml nodes with keys "config" from file "{@FileLoc}config.yml"
  30. loop {_nodes::*}:
  31. set {{@VarPrefix}::config::%loop-value%} to yaml value "config.%loop-value%" from file "{@FileLoc}config.yml"
  32. function SimpleBoardYML(file: text, data: text, node: text = "empty", object: text = "empty") :: text:
  33. if {_file} is "config":
  34. if {_data} is "write" or "set":
  35. set yaml value "%{_file}%.%{_node}%" from file "{@FileLoc}%{_file}%.yml" to "%{_object}%"
  36. SimpleBoardYMLSave("%{_file}%")
  37. exit
  38. if {_data} is "listadd":
  39. add "%{_object}%" to yaml list "%{_file}%.%{_node}%" from file "{@FileLoc}%{_file}%.yml"
  40. SimpleBoardYMLSave("%{_file}%")
  41. exit
  42. if {_data} is "listremove":
  43. remove "%{_object}%" from yaml list "%{_file}%.%{_node}%" from file "{@FileLoc}%{_file}%.yml"
  44. SimpleBoardYMLSave("%{_file}%")
  45. exit
  46. function SimpleBoardYMLKeys(file: text, data: text, node: text = "empty") :: objects:
  47. if {_file} is "config":
  48. if {_data} is "keys":
  49. return yaml nodes with keys "%{_file}%.%{_node}%" from file "{@FileLoc}%{_file}%.yml"
  50. else if {_data} is "readlist":
  51. return yaml list "%{_file}%.%{_node}%" from file "{@FileLoc}%{_file}%.yml"
  52. on script load:
  53. if file exists at "{@FileLoc}config.yml" is false:
  54. message "{@ConsolePrefix}&cGenerating config.yml" to console
  55. if {{@VarPrefix}::config::saveFiles} is "true":
  56. loop {{@VarPrefix}::config::*}:
  57. set yaml value "%loop-index%" from file "{@FileLoc}config.yml" to "%loop-value%"
  58. else:
  59. delete {{@VarPrefix}::config::*}
  60. SimpleBoardYML("config", "write", "version", "{@version}")
  61. SimpleBoardYML("config", "write", "saveFiles", "false")
  62. SimpleBoardYML("config", "write", "ScoreboardUpdate", "10")
  63. SimpleBoardYML("config", "listadd", "Scoreboard", "&6Player: &f%%player%%")
  64. SimpleBoardYML("config", "listadd", "Scoreboard", "&6Deaths: &f%%{example.variable}%%")
  65. SimpleBoardYML("config", "listadd", "Scoreboard", "&6Health: &f%%player's health%%")
  66. SimpleBoardYML("config", "write", "ScoreboardTitleUpdate", "5")
  67. SimpleBoardYML("config", "listadd", "ScoreboardTitle", "&cExample scoreboard")
  68. SimpleBoardYML("config", "listadd", "ScoreboardTitle", "&6Example scoreboard")
  69. SimpleBoardYMLSave()
  70. function SimpleBoardDeleteBoard(p: player):
  71. loop 15 times:
  72. delete the id based score "%{_p}%Slot%loop-number%" in stylish scoreboard "Simple-%{_p}%"
  73. delete stylish scoreboard "Simple-%{_p}%"
  74. on quit:
  75. SimpleBoardDeleteBoard(player)
  76. on join:
  77. if stylish scoreboard "Simple-%player%" exists:
  78. SimpleBoardDeleteBoard(player)
  79. if stylish scoreboard "Simple-%player%" is not set:
  80. add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
  81. create new stylish scoreboard named "Simple-%player%"
  82. set {_title::*} to SimpleBoardYMLKeys("config", "readlist", "ScoreboardTitle")
  83. set {_board::*} to SimpleBoardYMLKeys("config", "readlist", "Scoreboard")
  84. set title of stylish scoreboard "Simple-%player%" to "%{_title::1}%"
  85. set stylish scoreboard of player to "Simple-%player%"
  86. set {_slot} to size of {_board::*}
  87. loop {_board::*}:
  88. evaluate "set {_s} to ""%loop-value%"""
  89. create a new id based score "%player%Slot%{_slot}%" with text "%{_d::%{_slot}%}%%{_s}%" slot {_slot} for stylish scoreboard "Simple-%player%"
  90. subtract 1 from {_slot}
  91. while player is online:
  92. loop "%{{@VarPrefix}::config::ScoreboardUpdate}%" parsed as integer times:
  93. wait a tick
  94. loop {_title::*}:
  95. evaluate "set {_t} to ""%loop-value%"""
  96. set title of stylish scoreboard "Simple-%player%" to "%{_t}%"
  97. loop "%{{@VarPrefix}::config::ScoreboardTitleUpdate}%" parsed as integer times:
  98. wait a tick
  99. set {_slot} to size of {_board::*}
  100. loop {_board::*}:
  101. evaluate "set {_s} to ""%loop-value%"""
  102. set the text of id "%player%Slot%{_slot}%" to "%{_d::%{_slot}%}%%{_s}%"
  103. subtract 1 from {_slot}
Advertisement
Add Comment
Please, Sign In to add comment