xecho -b Refill timer loaded # This script sets up timers to control how fast your server fills # to your desired maximum usercount. Invalid input gives you a # simple usage text, the numbers in brackets are the ranges that # are acceptable. We assume the server is starting with $increase # number of users, and we set the first timer for $delay seconds # changing max to current + $increase, then so on until full. # # To see what the script is going to do, but not actually set the # timers, use the debug, ie: # # /refill max increment delay initial hub debug, example: # # /refill 2100 200 90 0 hub 1 # # Max of 2100, 200 at a time every 90 seconds, assume server has # 0 users, connect to hub when done, and only print what's happening, # not set it. # # Setting max to -1 will delete the refill timers, canceling the # fill. In case you set a bad value, or need to stop filling. @ hubtext = refillhub = refillhub2 = rt = rtold = timerdelay = maxfill2 = users = [] alias refill (maxfill,increment,delay,initial,refillhub,refilldebug) { @ hubtext = refillhub2 = timerdelay = maxfill2 = users = [] if (maxfill == -1 && rt) { xecho -b Cancelling fill timers.. ^assign rtold $rt ^assign rt 1 while (rt <= rtold) { timer -del rtime$rt @ rt++ } ^assign rt 0 /ad config max_connections } if (maxfill < 100 || maxfill > 10000 || increment < 50 || increment > 4000 || increment > maxfill || delay < 30 || delay > 300) { if (maxfill != -1) { xecho -b Usage: /refill max increment delay (initial) (hub) (debug) xecho -b Usage: max: Maximum users [-1,100...10000] xecho -b Usage: -1 will cancel refill and delete timers xecho -b Usage: increment: Number to increase by each period [50...] xecho -b Usage: delay: Number of seconds to wait [30...300] xecho -b Usage: initial: (Optional) Number of users on server to start with xecho -b Usage: hub: (Optional) Hub to connect to when finished filling. xecho -b Usage: debug: (Optional) Set to 1 to just print, not set timers xecho -b **NOTE** To keep this script simple, the optional items must xecho -b be have all previous optional items filled. So if xecho -b you want to specify a hub, you must specify initial, xecho -b to specify debug, you must specify hub and inital. } } { #xecho refillhub: $refillhub #xecho refillhub2: $refillhub2 ^assign timerdelay $delay ^assign rt 1 ^assign maxfill2 $maxfill ^assign refillhub2 $refillhub if (initial >= 0 && initial < maxfill) { ^assign users ${initial + increment} } if (initial < 0 || initial > maxfill) { ^assign users ${increment * 2} } if (!refilldebug) { if ([$refillhub2] != []) { ^assign hubtext and connecting to $refillhub2 } xecho -b xecho -b Filling to $maxfill users in increments of $increment users every $delay seconds $hubtext xecho -b } while (users < maxfill) { if (refilldebug) xecho -b /timer -refnum rtime$rt $timerdelay /ad config max_connections $users if (!refilldebug) /timer -refnum rtime$rt $timerdelay /ad config max_connections $users ^assign users ${users + increment} ^assign timerdelay ${timerdelay + delay} @ rt++ } if (refilldebug) xecho -b /timer -refnum rtime$rt $timerdelay /ad config max_connections $maxfill if (!refilldebug) /timer -refnum rtime$rt $timerdelay /ad config max_connections $maxfill @ rt++ if (refilldebug) xecho -b /timer -refnum rtime$rt ${timerdelay + delay} xecho -b Done filling server to ${maxfill}. if (!refilldebug) /timer -refnum rtime$rt ${timerdelay + delay} { xecho -b xecho -b Done filling server to ${maxfill2}. xecho -b if ([$refillhub2] != []) { /timer 10 /ad connect $refillhub2 } @ ^assign hubtext = refillhub = refillhub2 = rt = rtold = timerdelay = maxfill2 = users = [] } } }