Jump to content

HeyImGamer

Member
  • Posts

    1
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

HeyImGamer's Achievements

Lurker

Lurker (1/6)

0

Reputation

  1. We're making a scoreboard with currencies on it and we're having issues with Essentials' economy displaying the way we need it to be displayed. We're trying to get it to be formatted into numbers like "$1M, $2B, $4T, $5Q" instead of the numbers being "$1000000" or "$2000000000" and so on. This is our code that at the moment that grabs the balance of the player and puts it on the leaderboard: on join: set {p} to placeholder "%%vault_eco_balance%%" from player set line 11 of player's scoreboard to "&8| &a$ &7» &a%{p}%" and, it works as intended to display the raw balance on the leaderboard. As shown in "Screenshot A" Then, we found a piece of skript which formats numbers. This piece of skript works for the other two currencies which are custom made by ourselves (as seen below in Yellow and Blue underneath the $ currency in "Screenshot B"). Below is the function that formats the numbers to the proper form we need them to be. function format(n: number) :: text: set {_data} to "SX,21|QT,18|Q,15|T,12|B,9|M,6|k,3" loop split {_data} at "|": set {_s::*} to split loop-value at "," {_n} >= 10 ^ {_s::2} parsed as number return "%{_n} / 10 ^ {_s::2} parsed as number%%{_s::1}%" return "%{_n}%" and this is the specific chunk of code where the function is used to display on the scoreboard: set line 10 of player's scoreboard to "&8| &e⛁ &7» &e%format({tokens::2::%player%})%" set line 9 of player's scoreboard to "&8| &b◎ &7» &b%format({tokens::%player%})%" However, when we use the function for the essentials currency in the same exact way, it breaks and says <none> This is the code used on the scoreboard to display the essentials currency: on join: set {p} to placeholder "%%vault_eco_balance%%" from player set line 11 of player's scoreboard to "&8| &a$ &7» &a%format2({p})%" and the outcome is what is seen in "Screenshot C" which is just <none> (I would like to note, you may notice that in the 4th set of code, it says "format2()" instead of the "format()" seen in the 2nd and 3rd set of code. I know this, we separated this essentials balance into a new skript file for us to be able to easily dissect and analyze the problem. This different skript simply just has a copy of the "format()" function but labelled "format2()" because multiples functions cannot have the same name. I also would like to note, this issue was happening before we moved the essentials balance code into a new skript file, so that would not be causing the issue. I will show the "function2()" code below just in case someone wants to see it): function format2(n: number) :: text: set {_data} to "SX,21|QT,18|Q,15|T,12|B,9|M,6|k,3" loop split {_data} at "|": set {_s::*} to split loop-value at "," {_n} >= 10 ^ {_s::2} parsed as number return "%{_n} / 10 ^ {_s::2} parsed as number%%{_s::1}%" return "%{_n}%" So, this is our issue in which the essentials currency won't format properly to the way we need it. We have tried different ways of using the function, notably differences in this "%format2({p})%" by adding, removing, and changing parentheses, brackets, and percent signs. Nothing seemed to work from what we tried so we would be extremely grateful if we could get help on this. Thank you again. (Credit to: Useful vanilla Skript functions - by EWS)
×
×
  • Create New...