#is there a way i could create a countdown?

1 messages · Page 1 of 1 (latest)

ocean fossil
#
    trigger:
        if {hideandseek} is not true:
            if {queue::*} does not contain player:
                add player to {queue::*}
                send "&aYou will be loaded into the next game!"
                wait 1 second
                if amount of players in {queue::*} is equal to 1:
                    send title "&fGame Starting Soon!" to all players for 10 seconds
                    send subtitle "&fJoin the queue to play" to all players for 5 seconds
                    wait 5 seconds
                    send subtitle "&a&l5" to {queue::*} for 1 second
                    wait 2 seconds
                    send subtitle "&a&l4" to {queue::*} for 1 second
                    wait 2 seconds
                    send subtitle "&c&l3" to {queue::*} for 1 second
                    wait 2 seconds
                    send subtitle "&c&l2" to {queue::*} for 1 second
                    wait 2 seconds
                    send subtitle "&4&l1" to {queue::*} for 1 second
                    set {map} to random integer between 1 and 2
                    wait 1 second
                    if {map} is equal to 1:
                        teleport {queue::*} to {mushroom}
                    else if {map} is equal to 2:
                        teleport {queue::*} to {bikinibottom}
                else if amount of players in {queue::*} is greater than or equal to 1:
                    set {hideandseek} to true
                    send title "&fChoosing Roles..." to {queue::*} for 3 seconds
                    send subtitle "&fYou are &kasdf" for 2 seconds
                    set {_seeker} to random element of {queue::*}
                    wait 1 second
                    send subtitle "&fYou are &4The Seeker" to {_seeker}
                    wait 1 second
                    remove all players from {_seeker}```
#

currently, this is what I have but i want to make it so the countdown shows instead of the manual "send title to queue" lines because it messes up when another player joins the queue and messes up the seeker portion of the code below

viscid oracle
#

lol

ocean fossil
viscid oracle
# ocean fossil yeah "lol"

your code is kind of hard for me to really understand right now; would you mind explaining what it does in a simple and straightforward manner?

ocean fossil
#

yeah theres a lot going on my bad

#

the first line talking about {hideandseek} checks to see if theres a game in progress, and then adds a player to the queue to be loaded into a game. After adding the player it checks to see if there is a certain amount of players ready to join the game, and in this case for testing purposes it's at 1 which sets of the titles and subtitles but idk how to make the countdown into a variable so that everything after the "else if amount of players in queue is greater than or equal to 1" only sends after the countdown hits 0

#

like right now if a player joins when the countdown is at 2, itll send the choosing roles... part before it gets done with the countdown

ocean fossil
viscid oracle
#

it's fine

#

you can't make me more mad than my own code does

#

🙏

ocean fossil
#

good to know haha

#

mine confuses me so bad because i think i overcomplicate these things way too hard and then i ask for help and someone tells me i could do it in like 40 less lines

viscid oracle
#

okay so I guess the explanation sadly didn't really help, but now I know what will

#

can you tell me how you want the countdown to work

ocean fossil
#

i want the countdown to display the same number for all players in the queue regardless of when they joined it

viscid oracle
#

sure but I mean

#

the actual countdown itself

#

when do you want it to start, how long do you want it to be,

#

so on

ocean fossil
#

i want it to start when theres 1 player in queue (in this case, im gonna raise it to around 10 when testing is finished) and i want it to go for 34 seconds because i want to send titles to players so that in the middle of their screen it tells them the countdown

#

and the countdown will run as this code is running send title "&fGame Starting Soon!" to all players for 10 seconds send subtitle "&fJoin the queue to play" to all players for 5 seconds wait 5 seconds send subtitle "&a&l5" to {queue::*} for 1 second wait 2 seconds send subtitle "&a&l4" to {queue::*} for 1 second wait 2 seconds send subtitle "&c&l3" to {queue::*} for 1 second wait 2 seconds send subtitle "&c&l2" to {queue::*} for 1 second wait 2 seconds send subtitle "&4&l1" to {queue::*} for 1 second

viscid oracle
#

?

#

isn't that your current countdown? so don't we want to replace it?

ocean fossil
#

thats just what displays, the main thing i want the countdown to do is make it so everything after the countdown will execute at the same time

#

rather than replacing this countdown that the players see, i want to add a timer as a variable to make sure that the rest of the code gets executed at the same time afterwards, whether there's 1 player in the queue or 7

#

because right now when there's 1 player in the queue, it starts the countdown and it sends to every player inside when they join the queue but when they join it continues to follow that line of code but also instantly jumps into this code else if amount of players in {queue::*} is greater than or equal to 1: set {hideandseek} to true send title "&fChoosing Roles..." to {queue::*} for 3 seconds send subtitle "&fYou are &kasdf" for 2 seconds set {_seeker} to random element of {queue::*} wait 1 second send subtitle "&fYou are &4The Seeker" to {_seeker} wait 1 second remove all players from {_seeker}

#

and i just want to make it so the timer counts down but doesnt necessarily display it, and executes the code i just sent after the top code is finished

viscid oracle
#

lots of your code could use some work

#

first, {_seeker} isn't a list; it can only be set to 1 value

#

if size of {queue::*} = 1:

#

else if size of {queue::*} >= 1:

viscid oracle
#

you can use a function

#
function someName():
    send subtitle "&fJoin the queue to play" to all players for 5 seconds
    wait 5 seconds
    send subtitle "&a&l5" to {queue::*} for 1 second
    wait 2 seconds
    send subtitle "&a&l4" to {queue::*} for 1 second
    wait 2 seconds
    send subtitle "&c&l3" to {queue::*} for 1 second
    wait 2 seconds
    send subtitle "&c&l2" to {queue::*} for 1 second
    wait 2 seconds
    send subtitle "&4&l1" to {queue::*} for 1 second
#
command /join:
    trigger:
        if {hideandseek} is not true:
            if {queue::*} does not contain player:
                add player to {queue::*}
                send "&aYou will be loaded into the next game!" to player

                wait 1 second

                if size of {queue::*} = 1:
                    someName()

                    wait 1 second

                    set {map} to random integer between 1 and 2
                    if {map} = 1:
                        teleport {queue::*} to {mushroom}
                    else if {map} = 2:
                        teleport {queue::*} to {bikinibottom}

                else if size of {queue::*} >= 1:
                    set {hideandseek} to true

                    send title "&fChoosing Roles..." to {queue::*} for 3 seconds
                    send subtitle "&fYou are &kasdf" for 2 seconds

                    set {_seeker} to random element of {queue::*}
                    wait 1 second

                    send subtitle "&fYou are &4The Seeker" to {_seeker}
                    wait 1 second
#

so then it'd look something like this

#

tell me how this works for you and what doesn't work as intended, then I can fix it from there accordingly now that I better understand your code

ocean fossil
ocean fossil
viscid oracle
#

nvm I read the code wrong

#

I just woke up sorry

ocean fossil
#

all good lol

viscid oracle
#

are you familiar with how to debug?

ocean fossil
#

not really no

#

im just learning how to skript, i did a bit a while back but it was really simple stuff and i overcomplicated it instead of using variables and stuff. it was more trial and error than figuring out exactly what was wrong with the skript

viscid oracle
#

broadcast any relevant variables, or just some text, after every condition or line that may be causing problems

#

to make sure every value is as intended, and every line is being reached and working

#

to identify which line is causing the problem, and why

#

I'll be on my PC after I make breakfast

ocean fossil
#

sounds good

#

i put it in the beginning of the function and did /join and it didnt do anything