Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   New RC Announcer (https://forums.graalonline.com/forums/showthread.php?t=79977)

xXziroXx 06-07-2008 09:55 PM

New RC Announcer
 
Well, a system that can be useful to inform staff about new tasks etc., or a staff newsletter - whatever floats your boat!

Paste this script into a database NPC:
PHP Code:

function onCreated()
{
  if (
this.remotecontrols == NULL) {
    for (
plallplayers) {
      if (
pl.level.name == NULLthis.remotecontrols.add(pl.account);
    }
  }
  
setTimer(1);
}

function 
onTimeOut()
{
  for (
plallplayers) {
    if (
pl.level.name == NULLtemp.remotecontrols.add(pl);
  }
  
  for (
pltemp.remotecontrols) {
    if (!(
pl.account in this.remotecontrols)) {
      
temp.remotecontrols[temp.var].sendPM("No slacking, get to work!");
      
sendToRC("Welcome" SPC (temp.remotecontrols[temp.var].communityname == NULL temp.remotecontrols[temp.var].account temp.remotecontrols[temp.var].communityname) @ "! You have received a new PM!");
    }
    
temp.var ++;
  }
  
this.remotecontrols temp.remotecontrols;
  
setTimer(1);


Gosh I'm so bored... :cry:

Deas_Voice 06-07-2008 09:58 PM

nice,
no time to test it thought,
but doas onCreated get calld then someone log in too?

Tigairius 06-07-2008 10:02 PM

I don't like the serverside timer of 1 for something so useless :x I think a timer of 2 or 3 would get the job done just as effectively in this case.

xXziroXx 06-07-2008 10:23 PM

Quote:

Originally Posted by Deas_Voice (Post 1395271)
but doas onCreated get calld then someone log in too?

No, it's not supposed too.

Quote:

Originally Posted by Tigairius (Post 1395273)
I don't like the serverside timer of 1 for something so useless :x I think a timer of 2 or 3 would get the job done just as effectively in this case.

Definitely, even up to 5 would work perfectly. But in the end, it depends on how much lag it's causing. For example... while a timer of 1 might work fine on your average UC server, a timer of 5 would be more suited for Zodiac/Era etc.

cbk1994 06-07-2008 10:39 PM

Quote:

Originally Posted by xXziroXx (Post 1395284)
Definitely, even up to 5 would work perfectly. But in the end, it depends on how much lag it's causing. For example... while a timer of 1 might work fine on your average UC server, a timer of 5 would be more suited for Zodiac/Era etc.

Why should a UC server have to worry about lag any less?

It's best to have your scripts lag-free, regardless of the server.

Making the scripts suck because it's a UC server is like saying "this server will never take off, so it's okay if the scripts suck".

Tigairius 06-07-2008 10:45 PM

Quote:

Originally Posted by cbk1994 (Post 1395288)
Making the scripts suck because it's a UC server is like saying "this server will never take off, so it's okay if the scripts suck".

Similar to how I was talking to some lady the other day and she told me, "It's okay to burn tires out here because we live in the coutry." She doesn't realize your carbon footprint is the same size regardless of where you live... -_-

xXziroXx 06-07-2008 11:04 PM

Simply because a UC server can afford to "gimp" itself in some areas due to not getting as much strain on it, compared to a server with 100+ players.

cbk1994 06-07-2008 11:11 PM

Quote:

Originally Posted by xXziroXx (Post 1395292)
Simply because a UC server can afford to "gimp" itself in some areas due to not getting as much strain on it, compared to a server with 100+ players.

But then if it becomes popular (lol) everything has to be rescripted.

See Zodiac.

xXziroXx 06-08-2008 12:27 AM

Quote:

Originally Posted by cbk1994 (Post 1395294)
But then if it becomes popular (lol) everything has to be rescripted.

We're talking about changing a timer in one script... I think we're making a hen out of a feather here. >_<

cbk1994 06-08-2008 01:38 AM

Quote:

Originally Posted by xXziroXx (Post 1395317)
We're talking about changing a timer in one script... I think we're making a hen out of a feather here. >_<

Yes, but what purpose does a timeout of one versus five or even ten serve?

xXziroXx 06-08-2008 01:40 AM

Quote:

Originally Posted by cbk1994 (Post 1395336)
Yes, but what purpose does a timeout of one versus five or even ten serve?

It might not be much, but I'm sure it'd be noticeable depending on how many players you have.

Looping through 20 people every 1 second might not be too CPU heavy, but I'm sure looping through 150 of them every 1 second would be.

cbk1994 06-08-2008 01:42 AM

Quote:

Originally Posted by xXziroXx (Post 1395337)
It might not be much, but I'm sure it'd be noticeable depending on how many players you have.

Looping through 20 people every 1 second might not be too CPU heavy, but I'm sure looping through 150 of them every 1 second would be.

That's not what I meant to say; my bad.

I was saying why do you need a timeout of 1 when five or ten works just as well?

Even on Utopia where we only had ~30 players, we would use 5 or 10 second timeouts whenever possible.

xXziroXx 06-08-2008 01:52 AM

Quote:

Originally Posted by cbk1994 (Post 1395339)
That's not what I meant to say; my bad.

I was saying why do you need a timeout of 1 when five or ten works just as well?

Even on Utopia where we only had ~30 players, we would use 5 or 10 second timeouts whenever possible.

It's up to personal choise. Have it at 1, 5, 10 seconds - whatever you want. Does it matter for most? No, not really.


All times are GMT +2. The time now is 11:17 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.