Solved Timespan help

  • 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.

CKR367

Member
Feb 1, 2017
64
2
0
I have set a variable to now and I am trying to create a difference trigger, but it isn't working?
code_language.skript:
if difference between {_waited} and %{punished.currenttime::%player%}% is less than 4 hours:

Error: '::%player%}%' is not a valid item data'

Skript Ver: Latest Bensku Fork
Addons: It shouldn't matter
 
I have set a variable to now and I am trying to create a difference trigger, but it isn't working?
code_language.skript:
if difference between {_waited} and %{punished.currenttime::%player%}% is less than 4 hours:

Error: '::%player%}%' is not a valid item data'

Skript Ver: Latest Bensku Fork
Addons: It shouldn't matter
remove the "%"

{...} enough
 
Latest isn't a specific, give us a number, do "/about Skript" and tell us the output. Also, show us your current code, the changed one.
I switched the variable and {_waited} now it is showing a different error:

code_language.skript:
if difference between {punished.currenttime::%player%} and {_waited} is less than 4 hours:

Error:
code_language.skript:
Can't compare a number with a time span

Skript Version:
dev28c (Bensku)
 
I switched the variable and {_waited} now it is showing a different error:

code_language.skript:
if difference between {punished.currenttime::%player%} and {_waited} is less than 4 hours:

Error:
code_language.skript:
Can't compare a number with a time span

Skript Version:
dev28c (Bensku)
I cannot reproduce that, to what {_waited} and {punished.currenttime::%player%} are set?
 
I cannot reproduce that, to what {_waited} and {punished.currenttime::%player%} are set?
Ahh, sorry. Here:
code_language.skript:
                    set {_waited} to now
                    if difference between {punished.currenttime::%player%} and {_waited} is less than 4 hours:
                        message "&6Punish &8> &7Shh... You are muted for %difference between {punished.length::%argument 1%} and {_waited}%."
                        stop


code_language.skript:
            set {punished.currenttime::%argument 1%} to now
            evaluate "set {punished.currenttime::%argument 1%} to now" on bungeecord server "%loop-value%"
            wait 1 tick
 
Ahh, sorry. Here:
code_language.skript:
                    set {_waited} to now
                    if difference between {punished.currenttime::%player%} and {_waited} is less than 4 hours:
                        message "&6Punish &8> &7Shh... You are muted for %difference between {punished.length::%argument 1%} and {_waited}%."
                        stop


code_language.skript:
        wait 2 ticks
        loop all bungeecord servers:
            set {punished::%argument 1%} to "4.0 Hour Mute"
            evaluate "set {punished::%argument 1%} to ""Permanent Mute""" on bungeecord server "%loop-value%"
            wait 1 tick
            etc
How about full code.


I/Wee don't see this variables
{punished.currenttime::%player%}

btw its too enough

code_language.skript:
if difference between {punished.currenttime::%player%} and now is less than 4 hours:
 
Ahh, sorry. Here:
code_language.skript:
                    set {_waited} to now
                    if difference between {punished.currenttime::%player%} and {_waited} is less than 4 hours:
                        message "&6Punish &8> &7Shh... You are muted for %difference between {punished.length::%argument 1%} and {_waited}%."
                        stop


code_language.skript:
            set {punished.currenttime::%argument 1%} to now
            evaluate "set {punished.currenttime::%argument 1%} to now" on bungeecord server "%loop-value%"
            wait 1 tick
Well, you can debug and check if one of these variables aren't set (the only one I can think wouldn't be set is {punished.currenttime::%player%} so broadcast it)
 
bump

I have fixed my code, and there are no errors, but the differences are not displaying correctly. I am trying to make it so it takes the time I punished them, and subtract that from 4 hours, and displays that difference, similar to MP.
Here is my code:
code_language.skript:
                set {_waited} to difference between {punished.currenttime::%player%} and now # {punished.currenttime::%player%} was set to now when punished
                if {_waited} is less than 4 hours:
                    message "&6Punish &8> &7Shh... You are muted for %{_waited}%."
                    stop

This is how it is displaying:
https://gyazo.com/bb1dd09b7eca996092913fdd4761b861

All help is appreciated :emoji_grinning:
 
I want it to display time left in the punishment, so for my case, if they were punished 10 minutes ago, it would be
"Shh...You are muted for 3 hours and 50 minutes."
You would have to get the difference between {_waited} and {punished.currenttime::%player%} for that
 
You would have to get the difference between {_waited} and {punished.currenttime::%player%} for that
I think I am on the right path.... But {_waited2} is coming out as 0
code_language.skript:
                set {_4hr} to 4 hours
                set {_waited} to difference between now and {punished.currenttime::%player%}
                set {_waited2} to {_4hr} - {_waited}
                broadcast "%{_waited2}%"
                if {_waited} is not 0:
                    message "&6Punish &8> &7Shh... You are muted for %{_waited2}%."
                    stop
 
dude, do

message "&6Punish &8>Shh... You are muted for %difference between {punished.currenttime::%player%} and {_waited}

#im weird now...
 
dude, do

message "&6Punish &8>Shh... You are muted for %difference between {punished.currenttime::%player%} and {_waited}

#im weird now...
How does that relate to the punishment being 4 hours long? I already tried subracting that difference from 4 hours...
[doublepost=1497708971,1497450323][/doublepost]still need help... Trying to subtract the difference from 4 hours....
code_language.skript:
set {_4hr} to 4 hours
set {_waited} to difference between now and {punished.currenttime::%player%}
set {_waitedint} to {_waited} parsed as integer
set {_waited2} to 4 hours - {_waitedint}
broadcast "%{_waited2}%"


EDIT: Found the solution! Here is the code:
code_language.skript:
set {_waited} to difference between now and {punished.currenttime::%player%}
set {_waitedint} to difference between 4 hours and {_waited}
 
Last edited by a moderator:
Status
Not open for further replies.