#Total KubeNube, need help with a server script

23 messages · Page 1 of 1 (latest)

thorny gorge
#

Hello everyone, i need help with a script that puts my server "too sleep" after a certain time by using the Maintenance Mod command as a function. The function already works independently if i use it myself in game, but i keep getting errors on my script, and I'm not programming literate enough by any means to figure out where I'm going wrong.

past tulipBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

jolly pythonBOT
#

Paste version of maintenance.js from @thorny gorge

cobalt river
#

??neversay

jolly pythonBOT
# cobalt river ??neversay

Never say 'it crashed', 'it errored', or 'it didn't work' without providing the full crash report, log, and scripts!

thorny gorge
#

Ah, okay, ill get the log in a sec

jolly pythonBOT
#

Paste version of server.log from @thorny gorge

mint willow
#

Try this

ServerEvents.loaded(event => {

  event.server.scheduleInTicks(60 * 60 * 20, function (callback) {
    event.server.runCommand('/function serverfunctions:m_off')
  })
  
  event.server.scheduleInTicks(525 * 60 * 20, function (callback) {
    event.server.tell('Server is going to sleep in 15 minutes!')
  })
  
  event.server.scheduleInTicks(530 * 60 * 20, function (callback) {
    event.server.tell('Server is going to sleep in 10 minutes!')
  })
  
  event.server.scheduleInTicks(535 * 60 * 20, function (callback) {
    event.server.tell('Server is going to sleep in 5 minutes!')
  })
  
  event.server.scheduleInTicks(539 * 60 * 20, function (callback) {
    event.server.tell('Good Night Everyone!')
  })
  
  event.server.scheduleInTicks(540 * 60 * 20, function (callback) {
    event.server.runCommand('/function serverfunctions:m_on')
  })
})
cobalt river
#

what did you even change

mint willow
#

a lot

#

like 4 things

thorny gorge
#

Ill take a look, thank you. What are the additional numbers for?

#

OH i see.... Schedule in ticks... 540 minutes * 60 seconds * 20 ticks right?

mint willow
#

yes

#

schedule technically also works

#

but it uses milliseconds instead if I remember correctly

cobalt river
#

yes

#

and that's what MINUTE is for

thorny gorge
#

(shrug) either way, it works! thank you very much!

#

Ill do my best to learn from this here