This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Err.... Slow or thats the way it has to be?

Old posts that have not been replied to for several years.
Locked
d
dcboy

Err.... Slow or thats the way it has to be?

Post by dcboy »

Okay i wrote this code so when a user in my chan pulls the trigger !lw blah it will then go to the website get the info and paste it.. Problem is that its really slow and thats probably do to them regsubs... How to make it faster? BTW im fairly new to TCL so go easy :)
set lwname(cmdchar) "!"
set lwtrig "lw"

bind pub - [string trim $lwname(cmdchar)]$lwtrig stat:nam

proc stat:nam {nick uhost hand chan text} {
set lwnick [split $text]
if {$lwnick == ""} {
putserv "NOTICE $nick :Incorrext Syantax you JACKASS."
putserv "NOTICE $nick :Correct Syantax would be - !lw <lwname> - ie. !lw Turd91"
} else {
lw_socket $nick $chan $text $lwnick
}
}


proc lw_socket {nick chan text lwnick} {
set sock [socket www.l33t-wars.com 80]
puts $sock "GET /find.php?find=$lwnick"
flush $sock
set i 0
set ln 0
while {![eof $sock]} {
set line [gets $sock]
lappend buffer $line
incr ln
set attout "Attack $lwnick"
regsub -all -- {(<.+?>)} $buffer "" buffer
regsub -all -- {\}|\{} $buffer "" buffer
regsub -all -- { | | | } $buffer "" buffer
regsub -all -- { } $buffer "" buffer
regsub -all -- {<!--BODYfont-family: verdana;} $buffer "" buffer
regsub -all -- {A:link text-decoration: none} $buffer "" buffer
regsub -all -- {A:visited text-decoration: none font-familt} $buffer "" buffer
regsub -all -- {A:active text-decoration: none} $buffer "" buffer
regsub -all -- {A:hover color:white-->} $buffer "" buffer
regsub -all -- {Cash:} $buffer " Cash:" buffer
regsub -all -- $attout $buffer "" buffer
regsub -all -- {!} $buffer "" buffer
regsub -all -- {Go Back} $buffer "" buffer
regsub -all -- {Back} $buffer "" buffer
regsub -all -- {Home -} $buffer "" buffer
regsub -all -- {Sign Up -} $buffer "" buffer
regsub -all -- {Terms of Service -} $buffer "" buffer
regsub -all -- {Links -} $buffer "" buffer
regsub -all -- {Back-} $buffer "" buffer
regsub -all -- {Contact Us} $buffer "" buffer
regsub -all -- {Copyright © 2002 Net-Warz. All rights reserved.} $buffer "" buffer
regsub -all -- {Gangster} $buffer "Gangster " buffer
regsub -all -- {Punk} $buffer "Punk " buffer
regsub -all -- {Mercenaries} $buffer "Mercenaries " buffer
regsub -all -- {Street Ho} $buffer "Street Ho " buffer
regsub -all -- {Girl} $buffer "Girl " buffer
regsub -all -- {Escort} $buffer "Escort " buffer
regsub -all -- {Highschool Pusher} $buffer "Highschool Pusher " buffer
regsub -all -- {College Dealer} $buffer "College Dealer " buffer
regsub -all -- {Drug Lord} $buffer "Drug Lord " buffer
regsub -all -- {:} $buffer ": " buffer
putquick "privmsg $chan :$buffer"
set ln 0
set buffer ""
}
}
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

OK - I can see the page, but without running the script (which I not willing to do), we don't know what information it does spit out.

Maybe posting the exact output.
d
dcboy

Post by dcboy »

Heres what the code does and post after its done taking out the trash ---

[03:25] <dcboy> !lw dcboy
[03:25] <octain> l33t-Wars - Player Rankings
[03:25] <octain>
[03:25] <octain> [Devils0wn] dcboy
[03:25] <octain> Personal Information
[03:25] <octain> Name: dcboy
[03:25] <octain> Gang: [Devils0wn]
[03:25] <octain> Location: US West
[03:25] <octain> Global Rank: 1618 Cash: $26,793,863,485.71
[03:25] <octain> Total Drugs: $0.00
[03:25] <octain> Total Value: $26,806,028,335.71
[03:25] <octain> Followers
[03:25] <octain> Thugs
[03:25] <octain> Baby Gangster 24000
[03:25] <octain> Punk 15500
[03:25] <octain> Original Gangster 10250
[03:25] <octain> Mercenaries Unknown
[03:25] <octain> Hoes
[03:25] <octain> Street Ho 2106
[03:25] <octain> Web Cam Girl 2185
[03:25] <octain> Escort 16

does that help any?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Too be honest, I hate HTML parsing, and I hate regsub's even more, mainly due to the fact, I find them hard (more likely coz I hate perl)
Locked