Tremulous Forum

General => General Discussion => Topic started by: err on September 05, 2006, 03:29:56 am

Title: Build Point Calculator
Post by: err on September 05, 2006, 03:29:56 am
Don't ask me why, but I thought a build point calcultor might be useful to server admins and base builders... IE (b7 at least) freaks out about some of the javascript but you can allow it or just use moz.

http://ufo.freepgs.com/trem/TremBuildCalc.htm
Title: Build Point Calculator
Post by: Confess on September 05, 2006, 04:59:51 am
Sweet. I notice that its on a freewebhosting thing, and that they are closing the host in december. If you need hosting, lemme know and ill put you on ssthosting.net.
Title: Re: Build Point Calculator
Post by: Undeference on September 05, 2006, 05:20:20 am
Quote from: "err"
Don't ask me why, but I thought a build point calcultor might be useful to server admins and base builders... IE (b7 at least) freaks out about some of the javascript but you can allow it or just use moz.

http://ufo.freepgs.com/trem/TremBuildCalc.htm

To make it a little snazzier, you could add a place to specify the number of build points you are allowed (and indicate how many points are left or if you've gone over your allocation).
Title: Build Point Calculator
Post by: Survivor on September 05, 2006, 06:35:41 pm
In 100 years an 8 year old can code a game but substracting from a number in your head is impossible for them by then.
Title: Build Point Calculator
Post by: err on September 06, 2006, 01:07:59 am
Quote from: "Survivor"
In 100 years an 8 year old can code a game but substracting from a number in your head is impossible for them by then.


Exactly... this tool will relieve hundred-year-old eight year old game programmers from the burden of sub(s)tracting from a number in my head. I think.
Title: Build Point Calculator
Post by: err on September 06, 2006, 01:10:54 am
Quote from: "confess"
Sweet. I notice that its on a freewebhosting thing, and that they are closing the host in december. If you need hosting, lemme know and ill put you on ssthosting.net.


Paid em $3, hopefully they wont remove me. Thanks for the offer though.

:edit: If you want to host a copy anyway go for it, maybe just write "by err" on it or something.
Title: Build Point Calculator
Post by: [db@]Megabite on September 06, 2006, 08:56:44 am
Quote from: "err"
If you want to host a copy anyway go for it, maybe just write "by err" on it or something.


Aye captain, I would love to include it on tremulous.info (http://tremulous.info) ;)

Danny
Title: Build Point Calculator
Post by: gareth on September 06, 2006, 09:55:44 am
As it is it is rather  pointless, it would be better if it calculated various options that make optimal usage of buildpoitnts so that you end up with none left from a starting number.
Title: Build Point Calculator
Post by: MtS on September 06, 2006, 02:34:09 pm
If the calculator would have a list with all popular servers and use the numbers of buildpoints on the specified server as the limit that would be cool. If the number of buildpoints isn't tied to actual servers I can't see the need of letting the user specify the number of buildpoints as undeference suggested, either.
Title: Build Point Calculator
Post by: DASPRiD on September 06, 2006, 03:19:13 pm
If you need a PHP-Script to get the BuildPoints of a specifig server, ask me :)
Title: Build Point Calculator
Post by: Aninhumer on September 06, 2006, 04:19:19 pm
Don't most servers just use the default anyway, apart from SST.
It would be easier to hardcode the numbers into a combo box, if there are only a few different ones.
Title: Build Point Calculator
Post by: DASPRiD on September 06, 2006, 09:14:21 pm
Na, I've created a ready-to-use class for this purpose :)
Title: Build Point Calculator
Post by: err on September 06, 2006, 10:28:06 pm
Quote from: "DASPRiD"
If you need a PHP-Script to get the BuildPoints of a specifig server, ask me :)


hook it up =) any other php classes you want to share too, i'll come up with some cool ajax shit for it.
Title: Build Point Calculator
Post by: err on September 06, 2006, 10:35:18 pm
Quote from: "[db@
Megabite"]
Quote from: "err"
If you want to host a copy anyway go for it, maybe just write "by err" on it or something.


Aye captain, I would love to include it on tremulous.info (http://tremulous.info) ;)

Danny


No problem =)
Title: Build Point Calculator
Post by: DASPRiD on September 07, 2006, 01:40:07 pm
You have to modify this class, but the basic things are the same ;)

Code: [Select]

/**
* Tremulous Reporter
*
* This Class will conect to a Tremulous Server and fetch the main information.
* After this, it will join the Game as Spectator and reports everythin to a
* local string.
*/
class TremulousReporter {  
  function __construct ($address) {
    list($ip, $port) = explode(':', $address);
   
    $this->ip          = $ip;
    $this->port        = $port;
    $this->checkstring = md5('iD-Software-'.$server.'-'.$port);
  }
   
  public function connect () {
    $this->fp = fsockopen('udp://'.$this->ip, $this->port, &$errno, &$errstr, 5);
   
    if (!$this->fp)
      return false;
    else {
      socket_set_timeout($this->fp, 2);

      $this->getStatus();
      $this->getChallenge();
      $this->doConnect();
     
      return true;
    }
  }
 
  public function disconnect () {
    fclose($this->fp);
    unset($this);
  }
 
  private function sendQuery ($command) {
    fwrite($this->fp, "\xff\xff\xff\xff".$command);
  }
 
  private function getStatus () {
    $this->sendQuery('getstatus');
     
    $header = trim(fgets($this->fp, 60));
    $data   = trim(fgets($this->fp, 1500));

    $this->server_vars = array();

    $split = explode('\\', $data);
    for ($i=1; $i<count>server_vars[$split[$i]] = $split[$i+1];
    }
   
    $player = '-';
    while (!empty($player)) {
      $player = fgets($this->fp, 100);
      //print $player.'<br>';
    }
  }
 
  private function getChallenge () {
    $this->sendQuery('getchallenge');
   
    $header = trim(fgets($this->fp, 23));
    $data   = trim(fgets($this->fp, 100));

    $this->challenge_number = $data;
  }
 
  private function doConnect () {
    $this->sendQuery('connect "\\protocol\\69\\challenge\\'.$this->challenge_number.'\\port\\30200"');
   
    $header = trim(fgets($this->fp, 60));
    $data   = trim(fgets($this->fp, 1500));
    print $data;
  }
}


$reporter = new TremulousReporter('213.239.197.132:30721');
$reporter->connect();
$reporter->disconnect();
?>

Title: Build Point Calculator
Post by: stahlsau on September 07, 2006, 05:00:28 pm
hi,
i admire the effort you made, but i don't understand the sense of this stuff. When i'm building, i don't want to minimize the game, goto your website, calculate stuff, go back, and notice that i got killed in the meantime. Besides, i don't know why one should need to calculate something while building. You build, and when the points are empty you stop. That easy. And i never forgot to build the om or eggs and stuff, just fyi.
So please enlighten me for what purpose you use this website/script/whatever ;)
Title: Build Point Calculator
Post by: Undeference on September 07, 2006, 06:25:07 pm
Quote
for ($i=1; $i<count>server_vars[$split[$i]] = $split[$i+1];

There's an issue with SGML-like tags on the forum, meaning that you have to link to it, I think.
Title: Build Point Calculator
Post by: err on September 13, 2006, 02:23:09 am
@stahlsau - honestly since you asked, i created it bc i thought it would be a useful way to convince admins of servers with very high bp to bring them down a bit. It's more for server operators than builders.