Author Topic: server announcements?  (Read 767 times)

i need the announcements that display every 5 minutes or so that AREN'T pecon's. i don't know how to use them, but if someone taught me how thatd be good too

Not sure about the addon, but it could be scripted fairly easy
Code: [Select]
function serverAnnouncement() {
    $announcementRandom = getRandom(0,2);
    if($announcementRandom == 0) {
        announce("announcement #1");
    } else if(announcementRandom == 1) {
        announce("announcement #2");
    } else if(announcementRandom == 2) {
        announce("announcement #3");
    }
    schedule(30000,0,serverAnnouncement);
    serverAnnouncement();
}

serverAnnouncement();
Iirc that's how it'd work, although I'm relatively new to Torque.
To set the announcements just replace the "announcement #" phrases with your announcements (although keep the quotation marks)

Not sure about the addon, but it could be scripted fairly easy
Code: [Select]
function serverAnnouncement() {
    $announcementRandom = getRandom(0,2);
    if($announcementRandom == 0) {
        announce("announcement #1");
    } else if(announcementRandom == 1) {
        announce("announcement #2");
    } else if(announcementRandom == 2) {
        announce("announcement #3");
    }
    schedule(30000,0,serverAnnouncement);
    serverAnnouncement();
}

serverAnnouncement();
Iirc that's how it'd work, although I'm relatively new to Torque.
To set the announcements just replace the "announcement #" phrases with your announcements (although keep the quotation marks)

The recursion is too stronk, rip in peace Blockland Server (That will crash your server).

editted drydess' code to be better; also you can toggle it on and off (you could also just cancel($announceSch); beforehand if you don't want the bool part for whatever reason. spacing might be weird but it'll work fine.
Code: [Select]
function serverAnnouncement(%bool)
{
    if (isEventPending($announceSch))
    {
cancel($announceSch);
    }
    if (!%bool)
return;
    switch (getRandom(0,2))
    {
case(0):
announce("something");
case(1):
announce("something again");
case(2):
announce("something else");
    }
    $announceSch = schedule(30000, 0, serverAnnouncement, 1);
}

serverAnnouncement(1);
edit: tiny improvement made just for records sake
« Last Edit: March 02, 2016, 08:46:15 PM by QuadStorm »

The recursion is too stronk, rip in peace Blockland Server (That will crash your server).
oh forget seriously
damn, guess I need to study some more

oh forget seriously
damn, guess I need to study some more
study some python or java or c if you feel masochistic first then torque will make a lot more sense

study some python or java or c if you feel masochistic first then torque will make a lot more sense
I'm pretty good at javascript although a bit rusty.