#Pet skript

1 messages · Page 1 of 1 (latest)

upbeat temple
#

on toggle sneak:
player is sneaking:
name of player's offhand tool is "&cVulture":
push player upwards with speed 0.5
push player forwards with speed 1.5

i need to make a cooldown for this

remote furnace
#

Set a var or sometime when they use it

#

Then check how long its been since that var was set

upbeat temple
#

im new to skript so i dont know how to do that could you post it or an example

remote furnace
#

set a var to now

#

Which is the current time

#

Then use

#

difference between now and var

#

Which will give you how long its been

#

Ex

#

if difference between now and {cd::%player's uuid%} >= 1 second:

upbeat temple
#

it didnt work for me does it have to have addons for the sk to work

#

@remote furnace

remote furnace
#

No

#

Send you code and error

#

Also

#

!format

primal mistBOT
# remote furnace !format

:technologist: Code Blocks

To make it easier for others to read your code, it is asked that you send it in a code block. On Discord, you can simply send this:

```
Code here
```

upbeat temple
#

on toggle sneak:
player is sneaking:
name of player's offhand tool is "&cVulture":
push player upwards with speed 0.5
push player forwards with speed 1.5
if difference between now and {cd::%player's uuid%} >= 1 second
cancel event

remote furnace
#

...

upbeat temple
#

and error says

remote furnace
#

I gave you an example

#

Not the code you need

#

Learn to think

upbeat temple
#

oh sorry

remote furnace
#

Dont just copy paste

upbeat temple
#

ok

remote furnace
#

You didnt even copy paste correctly (you missed the :)

#

Also canceling the event just cancels the sneak

#

It doesnt do anything to your pushing

#

Put this check before you push then

#

And add a stop (it stops the rest of your code from running)

upbeat temple
#

i did this and it doesnt work it doesnt have an error the cooldown just doesnt run

#

on toggle sneak:
player is sneaking:
name of player's offhand tool is "&cVulture":
push player upwards with speed 0.5
push player forwards with speed 1.5
if difference between now and {cd::%player's uuid%} is less than 1 second:
stop
else:
push player upwards with speed 0.5
push player forwards with speed 1.5

lucid haven
# upbeat temple on toggle sneak: player is sneaking: name of player's offhand tool i...

indention is 1 of the key thing to understand to be good at skript, so if you are not going to make a if statement you dont want to be using : at the end of the condition.
example;

on jump:
  if player is online: # here is a ifstatement that ends with :, then the line under needs a indent
    broadcast "r"

on jump:
  player is online # here is a condition that does not have if and does not have : so the line under should not be indented
  broadcast "r"
upbeat temple
lucid haven
#

line 2 and 3

upbeat temple
#

like this?

#

on toggle sneak:
player is sneaking
name of player's offhand tool is "&cVulture":
push player upwards with speed 0.5
push player forwards with speed 1.5
if difference between now and {cd.%uuid of player%} is less than or equal to 1 second:
stop
else:
push player upwards with speed 0.5
push player forwards with speed 1.5

lucid haven
#

line 3 still has : at the end

upbeat temple
#

so i put an if before it?

lucid haven
#

but the only reason to have a if is if you are going to check something else

upbeat temple
#

on toggle sneak:
player is sneaking
name of player's offhand tool is "&cVulture"
push player upwards with speed 0.5
push player forwards with speed 1.5
if difference between now and {cd.%uuid of player%} is less than or equal to 1 second:
stop
else:
push player upwards with speed 0.5
push player forwards with speed 1.5
like this?

lucid haven
#

the indention looks about right

#

but now you just need to fix your code

#

why push player before the if statements?

upbeat temple
#

so remove that?

lucid haven
#

if thats how you want your code to work sure

upbeat temple
#

now like this

#

on toggle sneak:
player is sneaking
name of player's offhand tool is "&cVulture"
if difference between now and {cd.%uuid of player%} is less than or equal to 1 second:
stop
else:
push player upwards with speed 0.5
push player forwards with speed 1.5

lucid haven
#

give it a try

upbeat temple
#

no

#

on toggle sneak:
player is sneaking
name of player's offhand tool is "&cVulture"
if difference between now and {cd.%uuid of player%} is greater than or equal to 2 second:
stop
else:
push player upwards with speed 0.5
push player forwards with speed 1.5

#

i also made it greater than or equal to 2

#

seconds

lucid haven
upbeat temple
#

nah

lucid haven
#

bro wdym, you wont give it a try?

upbeat temple
#

i did

#

i meant no as in it didnt work sorry

lucid haven
#

ok, what didnt work?

upbeat temple
#

it wont stop

#

it keeps infinitley going

lucid haven
#

debug

upbeat temple
#

debug?

lucid haven
#

debugging means you need to figure out why and what makes it not stop

upbeat temple
#

maybe because its specifically greater than 2 seconds

lucid haven
#

or maybe because you never set the variable to something after use

upbeat temple
#

how do i do that?

#

like: set {cd.%uuid of player%} to now

#

?

lucid haven
#

for example yes

upbeat temple
#

do i put that in or would it be different

lucid haven
#

give it a try

#

dont be scared to try out different things its a great way to learn skript

upbeat temple
#

ik ik

#

still wont work

#

on toggle sneak:
player is sneaking
name of player's offhand tool is "&cVulture"
if difference between now and {cd.%uuid of player%} is greater than or equal to 2 second:
stop
else:
push player upwards with speed 0.5
push player forwards with speed 1.5
set {cd.%uuid of player%} to now

#

this is the new sk

lucid haven
upbeat temple
#

ok

#

its starting to work as it doesnt let me use it and it sends a message but it doesnt let me use it at all

#

on toggle sneak:
player is sneaking
name of player's offhand tool is "&cVulture"
{vulture::%uuid of player%::last usage} was less than 2 seconds ago:
message "&cWait a bit before again using this"
stop
else:
push player upwards with speed 0.5
push player forwards with speed 1.5
set {vulture::%uuid of player%::last usage} to now

#

@lucid haven

lucid haven
#

removing the if statement makes the else statement not work

upbeat temple
#

ohh

#

the else section was not erroring but as i add this back it has 2 errors

#

on toggle sneak:
player is sneaking
name of player's offhand tool is "&cVulture"
if difference between now and {vulture::%uuid of player%::last usage} was less than 2 seconds ago:
message "&cWait a bit before again using this"
stop
else:
push player upwards with speed 0.5
push player forwards with speed 1.5
set {vulture::%uuid of player%::last usage} to now

lucid haven
#

and the error is?

#

would be nice to provide it without needed to ask

upbeat temple
#

1 sec

#

there

lucid haven
#

was less and the error says "{the variable} does not have a past state" which means you cant check past state of a variable

upbeat temple
#

now it says this when i changed the was to is
on toggle sneak:
player is sneaking
name of player's offhand tool is "&cVulture"
if difference between now and {vulture::%uuid of player%::last usage} is less than 2 seconds ago:
message "&cWait a bit before again using this"
stop
else:
push player upwards with speed 0.5
push player forwards with speed 1.5
set {vulture::%uuid of player%::last usage} to now

lucid haven
#

read the error

#

it says cant compare time span with a date

upbeat temple
#

im not understanding what to do for that

lucid haven
#

remove ago

upbeat temple
#

TYSM it works

#

thanks for teaching me

main zealot
#

I love how one of the first things mentioned was code blocks and he never used it lol