mIRC Home    About    Download    Register    News    Help

Print Thread
R
RieDeLL
RieDeLL
R
No this is not a system stat script. I would like to KNOW if displaying this material to members in the irc channel CLICKY through a bot, is possible.
If so can you give me some info on how I would go about doing this, is it difficult?

Last edited by RieDeLL; 02/05/08 02:58 AM.
Joined: Aug 2004
Posts: 7,168
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,168
1 - Yes it is possible.
2 - It can be difficult depending on your scripting knowledge and abilities
3 - To do so will require the usage and a decent understanding of sockets.

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Originally Posted By: RieDeLL
No this is not a system stat script. I would like to KNOW if displaying this material to members in the irc channel CLICKY through a bot, is possible.
If so can you give me some info on how I would go about doing this, is it difficult?


was bored here's a quick shot at the NICKlist

In any channel have someone type !statx nick

it should display the stats

The script is not 100% but hopefully you can work around it.

Code:
alias statx { .remove statx.txt | sockclose statx | sockopen statx realm.worldofchris.org 80 }
alias statxa { 
  %x = $read(statx.txt,w,$+(*,%stx,*))
  %y = $readn
  msg %stx.a StatX> %stx RACE $statxb(1) CLASS $statxb(2) GENDER $statxb(3) PVPRANK $statxb(4) LEVEL $statxb(5) MAP $statxb(6) AREAID $statxb(7) XPOS $statxb(8) YPOS $statxb(9) ONTIME $statxb(10) LATENCY $statxb(11)
}
alias statxb { return $read(statx.txt,$calc(%y + $1)) }

on 1:sockopen:statx:{
  .sockwrite -n statx GET /stats.xml HTTP/1.1
  .sockwrite -n statx HOST: realm.worldofchris.org
  .sockwrite -n statx $crlf
}

on 1:sockread:statx:{
  if ($sockerr > 0) return 
  var %x | sockread -fn %x
  write statx.txt $remove($regsubex(%x,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,),$chr(9))
}

on *:TEXT:!statx*:#:{
  if ($$2) {
    statx
    %stx = $$2 | %stx.a = # | .timerstat 1 3 /statxa
  }
}

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
I noticed an error for channel in my last code + I added a check to see if the user exists before displaying any data. Added small explanations


alias statx { .remove statx.txt | sockclose statx | sockopen statx realm.worldofchris.org 80 }
;Removed any instances of statx.txt "temp" file, used socket to connect to site
alias statxa {
noop $read(statx.txt,w,$+(*,%stx,*))
; creates no operations for the $read command since I just need the location number
if ($readn > 0) {
; Checks to see if my $read came out with something if it didnt then it skips to else
%y = $readn
; var created to store the numerical value of $read
msg %stx.a StatX> %stx RACE $statxb(1) CLASS $statxb(2) GENDER $statxb(3) PVPRANK $statxb(4) LEVEL $statxb(5) MAP $statxb(6) AREAID $statxb(7) XPOS $statxb(8) YPOS $statxb(9) ONTIME $statxb(10) LATENCY $statxb(11)
; msg displayed use with the alias statxb that was created }
else { msg %stx.a Sorry %stx is not currently online or a valid entry }
; Now again if $readn returns nothing it will display this message to the channel}
alias statxb { return $read(statx.txt,$calc(%y + $1)) }
; instead of writting the command many times I made it shorter by making an alias

on 1:sockopen:statx:{
;once sock is open perform these commands
.sockwrite -n statx GET /stats.xml HTTP/1.1
; first we need the path of the file we want "/stats.xml" .sockwrite -n statx HOST: realm.worldofchris.org
; second we have to give the hostname back which is the site
.sockwrite -n statx $crlf
; We need a line break to properly dump the data}

on 1:sockread:statx:{
; Socket reads data if properly handled in sockopen event
if ($sockerr > 0) return
; if error occurs return meaning go to next or stop
var %x | sockread -fn %x
; here we create a temporary var that the data will go to has well is read the data into the var
write statx.txt $remove($regsubex(%x,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,),$chr(9))
; If all is ok this writes to statx.txt without the HTML tags so I can search whatever I need
}

on *:TEXT:!statx*:#:{
; Initiates if !statx DATA is said in channel
if ($$2) {
; Checks to see if there is DATA typed after the command !statx before continuing
statx
; Here it calls the statx alias on top to dump the site
%stx = $$2 | %stx.a = # | .timerstat 1 3 /statxa
; Here I temporarly stores the DATA entered and channel into 2 vars and
; made a timer to start the actual check to see if someone is in the list in 3 seconds

}
}

R
RieDeLL
RieDeLL
R
wow thnks ill see if i can do anything with it. I haven't coded anything in about a year. laugh

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Your welcome, but im not sure if its the nicknames you wanted stats of, or the top part but anyhoo im sure you can work around it


Link Copied to Clipboard