Solved Help with list variables.

  • 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.
Aug 22, 2021
2
0
1
19
I'm trying to make it so you can see the time you must wait to use a command again. I understand that you can use "cooldownmessage:" and %remaining time% for that, but it shows 2 decimal places. I want it to only show whole seconds. Here is the code that I tried. I cannot figure out why it does not work. That is what I need help with.

every second in "world":
loop {timecooldown::*}:
if {timecooldown::%loop-index%} is greater than 0:
subtract 1 from {timecooldown::%loop-index%}
command /time:
trigger:
if {timecooldown::*} does not contain {%player%.timecooldown}:
add {%player%.timecooldown} to {timecooldown::*}
if {timecooldownlist::%player%.timecooldown} is not set:
set {timecooldownlist::%player%.timecooldown} to 0
if {timecooldownlist::%player%.timecooldown} is 0:
set {timecooldownlist::%player%.timecooldown} to 40
message "you did it" to player
else:
message "wait %{%player%.timecooldown}% seconds" to player
 
just loop it alot of times then wait a second then subtract. I am so dumb.
ok enough jokes... first don't use "in" cause you wanna only use it if you wanna make it only work in this world. if it says that message about (in "world") use loop players. I am kinda new but at least I could help people. I been doing it for a year and I still don't know how to do functions. sorry that I can't help much but its fine. I can't really understand this a bit but at least someone will help you soon.
 
I managed to get it to work. Here is that code. I don't really know why this one works and the other doesn't.

every second:
loop {commandcooldown::*}:
if {commandcooldown::%loop-index%} is greater than 0:
subtract 1 from {commandcooldown::%loop-index%}
command /time:
trigger:
if {commandcooldown::%player%} is not set:
set {commandcooldown::%player%} to 0
if {commandcooldown::%player%} is 0:
message "you did it" to player
set {commandcooldown::%player%} to 40
else:
message "wait %{commandcooldown::%player%}% seconds"
 
Status
Not open for further replies.