Solved Functions r stupid sometimes

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

glowgrew

Active Member
Jan 26, 2017
99
7
0
Perm, Russia
code_language.skript:
# Function, that returns a colored percent.
function color(v: text) :: text:
    {_v} <= 25:
        return colored "&c%{_v}%"
    else if {_v} <= 50:
        return colored "&6%{_v}%"
    else if {_v} <= 75:
        return colored "&e%{_v}%"
    else if {_v} <= 100:
        return colored "&a%{_v}%"

command /bae:
    trigger:
        set {_percentCount} to 0
        while {_percentCount} < 10:
            add 1 to {_percentCount}
            set {_percent} to ({_percentCount}*100) / 10
            send actionbar from "%color({_percent})%" to player # Problem at this line, I see nothing in console.
            wait 2 ticks
 
@glowgrew
code_language.skript:
function color(v: number) :: text:
    {_v} <= 25:
        return colored "&c%{_v}%"
    else if {_v} <= 50:
        return colored "&6%{_v}%"
    else if {_v} <= 75:
        return colored "&e%{_v}%"
    else if {_v} <= 100:
        return colored "&a%{_v}%"
 
command /bae:
    trigger:
        set {_percentCount} to 0
        while {_percentCount} < 10:
            add 1 to {_percentCount}
            set {_percent} to ({_percentCount}*100) / 10
            set {_color} to color( {_percent} )
            send actionbar from "%{_color}%" to player
            wait 2 ticks
 
Status
Not open for further replies.