skript problem

  • 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 community!

    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.

j ploegmakers

Member
Nov 7, 2018
3
0
0
code_language.skript:
options:
    command: playtime                                        
    permission: playtime.use                                
    prefix: &8[&b&lPlaytime&8]                                

variables:
    {second::%player%} = 0
    {minute::%player%} = 0
    {hour::%player%} = 0
    {day::%player%} = 0




command /topplaytime:
    trigger:
        loop {day::*}:
            add 1 to {_size}
            if {_low.to.high.list::%loop-value%} is not set:
                set {_low.to.high.list::%loop-value%} to loop-index
            else:
                set {_n} to 0
            loop {_size} times:
                set {_n} to {_n}+1
                {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
                set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
                stop loop
            loop {hour::*}:
                add 1 to {_size}
                if {_low.to.high.list::%loop-value-2%} is not set:
                    set {_low.to.high.list::%loop-value-2%} to loop-index-2
                else:
                    set {_n} to 0
                    loop {_size} times:
                        set {_n} to {_n}+1
                        {_low.to.high.list::%loop-value-3%.%{_n}%} is not set
                        set {_low.to.high.list::%loop-value-3%.%{_n}%} to loop-index-3
                        stop loop
                    loop {minute::*}:
                        add 1 to {_size}
                        if {_low.to.high.list::%loop-value-4%} is not set:
                            set {_low.to.high.list::%loop-value-4%} to loop-index-4
                        else:
                            set {_n} to 0
                            loop {_size} times:
                                set {_n} to {_n}+1
                                {_low.to.high.list::%loop-value-5%.%{_n}%} is not set
                                set {_low.to.high.list::%loop-value-5%.%{_n}%} to loop-index-5
                                stop loop
                            wait 1 tick
                            set {_n} to size of {_low.to.high.list::*}
                            loop {_low.to.high.list::*}:
                                set {_high.to.low.list::%{_n}%} to loop-value
                                set {_n} to {_n}-1
                                wait 1 tick
                                set {_i} to 0
                                send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
                                loop {_high.to.low.list::*}:
                                    add 1 to {_topnumber}
                                    set {_player} to "%loop-value%" parsed as offlineplayer
                                    send "&7%{_topnumber}% - &c%{_player}% : &7%{day::%loop-value%}% Days %{hour::%loop-value%}% Hours %{minute::%loop-value%}% Minutes"
                                    add 1 to {_i}
                                    if {_topnumber} > 9:
                                        stop
                                send "&7&m------------------------------"
i cant seem to fix this skript

so please help me fix this
 
Last edited:
code_language.skript:
options:
    command: playtime                                        
    permission: playtime.use                                
    prefix: &8[&b&lPlaytime&8]                                

variables:
    {second::%player%} = 0
    {minute::%player%} = 0
    {hour::%player%} = 0
    {day::%player%} = 0




command /topplaytime:
   trigger:
        loop {day::*}:
            add 1 to {_size}
            if {_low.to.high.list::%loop-value%} is not set:
                set {_low.to.high.list::%loop-value%} to loop-index
            else:
                set {_n} to 0
                loop {_size} times:
                    set {_n} to {_n}+1
                    {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
                    set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
                    stop loop
                loop {hour::*}:
                    add 2 to {_size}
                    if {_low.to.high.list::%loop-value-2%} is not set:
                        set {_low.to.high.list::%loop-value-2%} to loop-index-2
                    else:
                        set {_n} to 0
                        loop {_size} times:
                            set {_n} to {_n}+1
                            {_low.to.high.list::%loop-value-3%.%{_n}%} is not set
                            set {_low.to.high.list::%loop-value-3%.%{_n}%} to loop-index-2
                            stop loop
                        loop {minute::*}:
                            add 4 to {_size}
                            if {_low.to.high.list::%loop-value-4%} is not set:
                                set {_low.to.high.list::%loop-value-4%} to loop-index-4
                            else:
                                set {_n} to 0
                                loop {_size} times:
                                    set {_n} to {_n}+1
                                    {_low.to.high.list::%loop-value-5%.%{_n}%} is not set
                                    set {_low.to.high.list::%loop-value-5%.%{_n}%} to loop-index-4
                                    stop loop
                                wait 1 tick
                                set {_n} to size of {_low.to.high.list::*}
                                loop {_low.to.high.list::*}:
                                    set {_high.to.low.list::%{_n}%} to loop-value
                                    set {_n} to {_n}-1
                                wait 1 tick
                                set {_i} to 0
                                send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
                                loop {_high.to.low.list::*}:
                                    add 1 to {_topnumber}
                                    set {_player} to "%loop-value%" parsed as offlineplayer
                                    send "&7%{_topnumber}% - &c%{_player}% : &7%{day::%loop-value%}% Days %{hour::%loop-value%}% Hours %{minute::%loop-value%}% Minutes"
                                    add 1 to {_i}
                                    if {_topnumber} > 9:
                                        stop
                                send "&7&m------------------------------"
i cant seem to fix this skript

so please help me fix this
what's wrong with it?
Errors?
What are you expecting it to do and what is it doing?
 
I put the wrong one but ill put the full skript ow and the problem is at line 79 to line 130 or so the rest is not that important
code_language.skript:
options:
    command: playtime                                          
    permission: playtime.use                                  
    prefix: &8[&b&lPlaytime&8]                                  

variables:
    {second::%player%} = 0
    {minute::%player%} = 0
    {hour::%player%} = 0
    {day::%player%} = 0

every second:
    loop all players:
        add 1 to {second::%loop-player%}
        if {second::%loop-player%} is 60:
            subtract 60 from {second::%loop-player%}
            add 1 to {minute::%loop-player%}
        if {minute::%loop-player%} is 60:
            subtract 60 from {minute::%loop-player%}
            add 1 to {hour::%loop-player%}
        if {hour::%loop-player%} is 24:
            subtract 24 from {hour::%loop-player%}
            add 1 to {day::%loop-player%}
          
command /{@command} [<offline player>]:
    permission: {@permission}
    trigger:
        if arg 1 is not set:
            send "{@prefix} &7Your play time is &a%{day::%player%}% Days %{hour::%player%}% Hours %{minute::%player%}% Minutes"
            stop
        if arg 1 is set:
            if arg 1 is "help":
                send "&cCorrect usage: '/playtime [<player>]', '/topplaytime' for leaderboard"
                stop
        if arg 1 is set:
            if {day.%arg 1%} is not set:
                set {day.%arg 1%} to 0
            if {hour::%arg 1%} is not set:
                set {hour::%arg 1%} to 0
            if {minute::%arg 1%} is not set:
                set {minute::%arg 1%} to 0
            send "{@prefix} &e%arg 1%&7's play time is &a%{day::%arg 1%}% Days %{hour::%arg 1%}% Hours %{minute::%arg 1%}% Minutes"
            stop
        if arg 1 is set:
            if arg 1 is "help":
                send "&cCorrect usage: '/playtime [<player>]', '/playtime top' for leaderboard"

command /playtimedebug:
    permission: playtimedebug
    trigger:
        loop all players:
            if {day::%loop-player's uuid%} is not set:
                set {day::%loop-player's uuid%} to 0
                if {hour::%loop-player's uuid%} is not set:
                    set {hour::%loop-player's uuid%} to 0
                    if {minute::%loop-player's uuid%} is not set:
                        set {minute::%loop-player's uuid%} to 0
                        if {day::%loop-player%} is not set:
                            set {day::%loop-player%} to 0
                            if {hour::%loop-player%} is not set:
                                set {hour::%loop-player%} to 0
            if {minute::%loop-player%} is not set:
                set {minute::%loop-player%} to 0
            if {day::%loop-value%} is not set:
                set {day::%loop-value%} to 0
            if {hour::%loop-value%} is not set:
                set {hour::%loop-value%} to 0
            if {minute::%loop-value%} is not set:
                set {minute::%loop-value%} to 0
            if {_low.to.high.list::%loop-value%} is not set:
                set {_low.to.high.list::%loop-value%} to 0
            if {_low.to.high.list::%loop-value-1%} is not set:
                set {_low.to.high.list::%loop-value-1%} to 0
                stop
            send "&7Finished debuggin"


command /topplaytime:
    trigger:
        loop {minute::*}:
            add 1 to {_size}
            if {_low.to.high.list::%loop-value%} is not set:
                set {_low.to.high.list::%loop-value%} to loop-index
            else:
                set {_n} to 0
                loop {_size} times:
                    set {_n} to {_n}+1
                    {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
                    set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index-1
                    stop loop
        loop {hour::*}:
            add 1 to {_size}
            if {_low.to.high.list::%loop-value%} is not set:
                set {_low.to.high.list::%loop-value%} to loop-index
            else:
                set {_n} to 0
                loop {_size} times:
                    set {_n} to {_n}+2
                    {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
                    set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index-1
                    stop loop
        loop {day::*}:
            add 1 to {_size}
            if {_low.to.high.list::%loop-value%} is not set:
                set {_low.to.high.list::%loop-value%} to loop-index
            else:
                set {_n} to 0
                loop {_size} times:
                    set {_n} to {_n}+3
                    {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
                    set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index-1
                    stop loop
        wait 1 tick
        set {_n} to size of {_low.to.high.list::*}
        loop {_low.to.high.list::*}:
            set {_high.to.low.list::%{_n}%} to loop-value
            set {_n} to {_n}-1
        wait 1 tick
        set {_i} to 0
        send "&7&m-----------&8< &6Top 10 Playtime&8>&7&m-----------"
        loop {_high.to.low.list::*}:
            add 1 to {_topnumber}
            set {_player} to "%loop-value%" parsed as offlineplayer
            send "&7%{_topnumber}% - &c%{_player}% : &7%{day::%loop-value%}% Days %{hour::%loop-value%}% Hours %{minute::%loop-value%}% Minutes"
            add 1 to {_i}
            if {_topnumber} > 9:
                stop

if i type /topplaytime i get this
af00cddf6e5955afff6908e34c5f7be0.png

https://gyazo.com/af00cddf6e5955afff6908e34c5f7be0

as u can see its only focusing on the minutes and not the days and hours first and i cant seem to fix it and the weird part is as u can see there are no errors so i dont know what to do
 
Last edited:
Because it only set's all of the variables if the player has an ontime of one day. Set all the variables to 0 on their first join
 
Just setup an on join event where if their variable is not set then set it to 0 ill give you an example for seconds

code_language.skript:
on join:
    if {second::%player%} is not set:
        set {second::%player%} to 0


You will do this for all your variables too
 
Status
Not open for further replies.