ItsKirby Posted June 10, 2021 Share Posted June 10, 2021 I am in need of help in making a skript that puts a "," every 3 n umbers for my sell and scoreboard skripts. Because rn they look like this: Any help? Yo who actually reads these [Vip] - 12/29/2020[Pro] - 1/25/2022 Link to comment Share on other sites More sharing options...
StarBunnie Posted June 10, 2021 Share Posted June 10, 2021 (edited) function fancynum(i: text) :: text: set {_r} to "" if {_i} contains ".": set {_ni::*} to {_i} split at "." set {_l} to {_ni::1}'s length else: set {_l} to {_i}'s length loop {_l} times: set {_r} to "%subtext of {_i} from {_l}-loop-value+1 to {_l}-loop-value+1%%{_r}%" if mod(loop-value, 3) = 0: if loop-value is not {_l}: set {_r} to ",%{_r}%" if {_ni::2} is set: if {_ni::2}'s length = 1: set {_r} to "%{_r}%.%{_ni::2}%0" else: set {_r} to "%{_r}%.%{_ni::2}%" return {_r} There that should do it To use it just write something like set {_price} to fancynum("%{price::item1}%") Edited June 10, 2021 by Starshinex3 Feel free to add me on discord if you: need help with plugins need help with skripts need to vent about something >[ ‧₊˚꒰ʚ Starshine ɞ ‧✦ *#2683 ]< Link to comment Share on other sites More sharing options...
_Tarna_ Posted June 10, 2021 Share Posted June 10, 2021 36 minutes ago, Starshinex3 said: function fancynum(i: text) :: text: set {_r} to "" if {_i} contains ".": set {_ni::*} to {_i} split at "." set {_l} to {_ni::1}'s length else: set {_l} to {_i}'s length loop {_l} times: set {_r} to "%subtext of {_i} from {_l}-loop-value+1 to {_l}-loop-value+1%%{_r}%" if mod(loop-value, 3) = 0: if loop-value is not {_l}: set {_r} to ",%{_r}%" if {_ni::2} is set: if {_ni::2}'s length = 1: set {_r} to "%{_r}%.%{_ni::2}%0" else: set {_r} to "%{_r}%.%{_ni::2}%" return {_r} There that should do it To use it just write something like set {_price} to fancynum("%{price::item1}%") Here is an easier way to do that function spaced(n: text) :: text: set {_s::*} to split {_n} at "." if {_s::*} is not set: return a({_n}) else: return "%a({_s::1})%.%{_s::2}%" function a(b: text) :: text: if length of {_b} > 3: return "%a(first length of {_b} - 3 characters of {_b})%,%last 3 characters of {_b}%" return {_b} Then to use it, do spaced("%{variable}%") Not my skript btw Discord - tarna256 In-game name - _Tarna_ Website - https://tarna.dev Paste Site: https://paste.tarna.dev --------------------------------------------------------- [VIP] - 7/27/2020 Community Support - 7/8/20 | 11/3/20 Helper - 11/3/20 - 2/21/21 Moderator - 2/21/21 - 5/17/21 - 5/17/21 - now Moderator - 12/20/22 - now --------------------------------------------------------- Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now