Jump to content

We have updated TG007.net. If you notice any problems please let us know.

Alliterative Appellation

Members
  • Content count

    2
  • Joined

  • Last visited

About Alliterative Appellation

  • Rank
    Neophyte

Profile Information

  • Country
    United States
  1. Alliterative Appellation

    World Cup Results And Fixtures Addon -- For Scripters

    This is a snippet you can use to format World Cup group fixtures and results in a simple text file. From this you can make your own results and schedule scripts to provide people with various pieces of World Cup related information. Start it off with /wcup_getData and, if successful, it will create wcup_data.txt which you can then extract information from in a comfortable manner. ; /wcup_getData ; Connects to the site and grabs the data. ; Only needs to be performed when a fixture changes, ie. when a match starts or ends. alias wcup_getData { if ($sock(wcup_getData)) sockclose wcup_getData sockopen wcup_getData fifa.com 80 btrunc wcup_rawdata.txt 0 } ; /wcup_cleanUp ; To stop the data retrieval process at any time. ; Cleans up such that you can immediately restart getData. alias wcup_cleanUp { sockclose wcup_getData if ($1) { echo -eagc info2 * Retrieval was successful. Now parsing the received data. wcup_parseData } .remove wcup_rawdata.txt } ; /wcup_parseData ; Formats the raw data so that it can be interpreted easily by another script. ; The file created is called wcup_data.txt and is backed up each time it's overwritten. ; Data is arranged as so: ; ; <match number> <ctime of match> <group> <venue> <country1> <country2> [score] ; ; Eg. ; ; 1276264800 A Johannesburg_-_JEP Argentina Nigeria 1:0 ; ; Spaces are replaced by _ alias wcup_parseData { if (!$isfile(wcup_rawdata.txt)) { echo -eagc info * Error finding wcup_rawdata.txt. Use /wcup_getData and try again. return } if (!$isdir(wcup_backup)) .mkdir wcup_backup .copy -o wcup_data.txt "wcup_backup\ $+ $time(dd-mm HHnn) backup.txt" btrunc wcup_data.txt 0 bread wcup_rawdata.txt 0 $file(wcup_rawdata.txt) &wcup var %pos = 1, %group while ($bfind(&wcup,%pos,<table summary="Group)) { %pos = $v1 + 22 %group = $bvar(&wcup,%pos).text var %i = 6 while (%i) { dec %i %pos = $bfind(&wcup,%pos,<td class="c mNum">) var %j = 6 tokenize 32 while (%j) { dec %j %pos = $bfind(&wcup,%pos,<) while ($bvar(&wcup,%pos) == 60) { %pos = $bfind(&wcup,%pos,>) + 1 while ($bvar(&wcup,%pos) isin 13 10) inc %pos } tokenize 32 $1- $replace($bvar(&wcup,%pos,$calc($bfind(&wcup,%pos,<) - %pos)).text,$chr(32),_) } write wcup_data.txt $1 $calc($ctime($replace($2,_,/2010 0)) - 7200 - $timezone) %group $3-4 $6 $iif($5 < a,$5) } } filter -ctffu 1 32 wcup_data.txt wcup_data.txt echo -eagc info2 * Operation completed. wcup_data.txt created. } on *:sockopen:wcup_getData:{ if ($sockerr) { echo -eagc info * Error opening socket. wcup_cleanUp } sockwrite -n wcup_getData GET /worldcup/matches/index.html HTTP/1.1 sockwrite -n wcup_getData Host: www.fifa.com sockwrite -n wcup_getData } on *:sockread:wcup_getData:{ if (!$sock(wcup_getData).rcvd) { var %wcup sockread %wcup if (& 200 * !iswm %wcup) { echo -agc info * Error with GET request. wcup_cleanUp } return } if ($sockerr) { echo -agc info * Error reading data. wcup_cleanUp return } sockread &wcup bwrite wcup_rawdata.txt -1 -1 &wcup if ($bfind(&wcup,1,matchschedule)) wcup_cleanUp 1 } on *:sockclose:wcup_getData:{ wcup_cleanUp echo -agc info * Server closed the connection. Contact me. }
  2. Alliterative Appellation

    I Need Help With This Kicks Logger

    I don't suppose $2 is a number here (the number of the line to fetch in kicklog.txt)? If not, $read(file, $2) is not what you're looking for. Look at /help $read - you probably want to include one of the switches.
×