#How to change a number value to a time value for cooldown 😭

1 messages · Page 1 of 1 (latest)

zealous grail
#

An example skript where the command should go on cooldown based on how far player is from spawn.

command /example:
    cooldown: 0 seconds
    cooldown storage: {cooldown::%player's uuid%::example}
    trigger:
        set {x} to distance between player's location and {spawn}
        set {t} to {x} seconds # Convert number to a time??, how do i do this, or is it not possible
        set {cooldown::%player's uuid%::example} to {t}
        broadcast "Example command executed by %player%"
boreal hound
#

u can parse it as a timespan

zealous grail
#

do you mean like
set {t} to {x} parsed as timespan

boreal hound
#

Yah

#

wait

boreal hound
zealous grail
#

i'm trying that but i get this in console
Variable {cooldown::my uuid::example} was not a date! You may be using this variable elsewhere. This warning is letting you know that this variable is now overridden for the command storage.

boreal hound
zealous grail
#
command /example:
    cooldown: 0 seconds
    cooldown storage: {cooldown::%player's uuid%::example}
    trigger:
        set {x} to 10
        set {t} to "%{x}% seconds" parsed as timespan
        set {cooldown::%player's uuid%::example} to {t}
        broadcast "Example command executed by %player%"
boreal hound
zealous grail
#

its an example

boreal hound
#

Yah but a 0 second cooldown might break it

zealous grail
#

it aint the problem

boreal hound
#

add
broadcast class info of {that cooldown var}
To the bottom

zealous grail
#

can you show how

boreal hound
#

THATS A LINE OF CODE FRRR

zealous grail
#

bro no its not

boreal hound
#

Yes it is

zealous grail
#

how would you type is what im asking

#

the proper syntax

boreal hound
#

just change the var in it

zealous grail
#

yeah thats not it

boreal hound
#

well add it

#

class info is proper syntax

#

whos been in the server longer?

zealous grail
#

command /example:
cooldown: 0 seconds
cooldown storage: {cooldown::%player's uuid%::example}
trigger:
set {x} to 10
set {t} to "%{x}% seconds" parsed as timespan
set {cooldown::%player's uuid%::example} to {t}
broadcast "Example command executed by %player%"
broadcast class info of {cooldown::%player's uuid%::example}

boreal hound
#

yes

zealous grail
zealous grail
boreal hound
#

Fr

#

jst reload it in ur server

#

parser is outdated

zealous grail
#

i did

boreal hound
#

run the command then

#

send the output or error

zealous grail
#

it doesnt load

boreal hound
#

what dosent

zealous grail
#

the script

boreal hound
#

is there and error

zealous grail
#

the script doesnt work it doesnt load i cant run the command

boreal hound
#

well thats means ur loading it wrong

zealous grail
#

Can't understand this condition/effect: broadcast class info of {cooldown::%player's uuid%::example}

boreal hound
#

DO U NOT HAVE SKBEE

#

bruh

#

everyone has that here

#

except u

zealous grail
#

buddy if you dont know the issue please just stop what

boreal hound
#

fr

#

skbee is the nost essential addon

zealous grail
#

why are you trying to start an arguement in the skript help section what

boreal hound
#

ask shanebee

zealous grail
#

the class is time span

opal sage
#

{x} and {t} should be local

#

after parsing as a timespan, this should work

zealous grail
#

like this?

command /example:
    cooldown: 0 seconds
    cooldown storage: {cooldown::%player's uuid%::example}
    trigger:
        set {_x} to 10
        set {_t} to "%{_x}% seconds" parsed as timespan
        set {cooldown::%player's uuid%::example} to {_t}
        broadcast "Example command executed by %player%"
        
#

i tried and still same issue

opal sage
#

what's the issue?

zealous grail
#

this is printing to console and the cooldown isnt being set
Variable {cooldown::my uuid::example} was not a date! You may be using this variable elsewhere. This warning is letting you know that this variable is now overridden for the command storage.

opal sage
#

is that when you reload the script?

#

its cause it's still set to a number

#

run the command and see if that updates it to a timespan

zealous grail
#

yeah thats with it reloaded

zealous grail
#

i tried it in game with it like this. and it broadcasts nothing

command /example:
    cooldown: 2 seconds
    cooldown storage: {cooldown::%player's uuid%::example}
    trigger:
        broadcast class info of {cooldown::%player's uuid%::example}
#

then this and it broadcasts time span then 10 seconds

command /example:
    cooldown: 2 seconds
    cooldown storage: {cooldown::%player's uuid%::example}
    trigger:
        set {_x} to 10
        set {_t} to "%{_x}% seconds" parsed as timespan
        broadcast class info of {_t}
        broadcast {_t}      
#

so its making t into a timespan correctly but for some reason still it cant be used to set the cooldown

opal sage
#

aaaahh

#

okay i see

#

it wants a time__stamp__, not a time__span__

#

can you broadcast what skript sets the variable to? To see if it's set to the time when the command was used, or the time the command will be next useable

zealous grail
#

this one? {cooldown::%player's uuid%::example}

opal sage
#

mhmm

#

you can probably just !broadcast "future" if {} > now, else "past"

zealous grail
#

so i did this and it broadcasts 10 seconds

command /example:
    cooldown: 2 seconds
    cooldown storage: {cooldown::%player's uuid%::example}
    trigger:
        set {_x} to 10
        set {_t} to "%{_x}% seconds" parsed as timespan
        set {cooldown::%player's uuid%::example} to {_t}
        broadcast "Example command executed by %player%"
        broadcast {cooldown::%player's uuid%::example}      
#

and i tried this and it broadcasts nothing

command /example:
    cooldown: 2 seconds
    cooldown storage: {cooldown::%player's uuid%::example}
    trigger:
        broadcast {cooldown::%player's uuid%::example}
opal sage
#

use it within 2 seconds so the cooldown is set

#

or just wait a tick then do it

zealous grail
#

how do i use that idk what it means

opal sage
#

its a ternary if statement

#

it will broadcast "future" if the variable is in the future

#

and otherwise, it will broadcast "past"

zealous grail
#

i mean like how would you use it in the code. because skript doesnt understand it the thing you put literally

#

i dont understand what am i supposed to test

#

when i do
broadcast {cooldown::%player's uuid%::example}
before doing
set {cooldown::%player's uuid%::example} to {_t}
it gives nothing

#

then i make it broadcast after its set to {_t} and it says 10 seconds, but i can still use the command before 10 seconds has elapsed. so the cooldown isnt getting set properly

opal sage
#

well, you have to fill in the actual variable instead of {}

zealous grail
#

it only broadcasts "past"

#

o ok i have to do it like

set {cooldown::%player's uuid%::example} to {_t} from now
#

How to change a number value to a time value for cooldown 😭

opal sage
#

{_t} ago, since it's in the past

hallow parrot