mIRC Home    About    Download    Register    News    Help

Print Thread
#202407 21/07/08 12:22 PM
Joined: Jul 2008
Posts: 24
W
Ameglian cow
OP Offline
Ameglian cow
W
Joined: Jul 2008
Posts: 24
Heya, I posted a question about this script earlier, but i got it working so deleted the original post.

So now that i have the following script working:

Code:
alias zulu {
  sockopen zulu isizulu.net 80
  set %message query= $+ $urlencode($1)
}

on *:sockopen:zulu: {
  sockwrite -n zulu POST / HTTP/1.1
  sockwrite -n zulu Host: www.isizulu.net
  sockwrite -n zulu User-Agent: HTTPTool/1.1
  sockwrite -n zulu Referer: http://www.isizulu.net/
  sockwrite -n zulu Content-Type: application/x-www-form-urlencoded
  sockwrite -n zulu Content-Length: $len(%message)
  sockwrite -n zulu
  sockwrite -t zulu %message
}

on *:sockread:zulu:{
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    var %zulu
    sockread %zulu
    if (*<tr><td class="bglightgrey"*</a></td></tr>* iswm %zulu) {
      aecho $htmlfree(%zulu)
      sockclose zulu
      halt
    }
    if (*<p class="center">No entries found for* iswm %zulu) {
      aecho 4Null
      sockclose zulu
    }
  }
}


i want to add it into a on TEXT script to automatically replace words. So i was thinking i need a $zulu(wordhere) in a while loop to achieve this, but im not entirely sure how to get it to $zulu(wordhere). Any ideas? Once i have that part done, im sure i could continue. Might still set the last line of text as a variable and /sF8 Alias here to convert the last line spoken if it is in the language zulu.

Any other suggestions or ideas?


=======================
Count WhipLash
Services Administrator
KnightNet
=======================
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Since socket events are asynchronous (they happen whenever the remote server decides to respond), you can't integrate them into a onTEXT event with an $identifier. You can execute a command in the onTEXT event that starts the socket procedure, and then have a mechanism for displaying the result within the onSOCKREAD event.

Example:

Code:

on *:TEXT:!start &:#:{
  startsocket $chan $2
}

alias startsocket {
  sockmark mysock $1
  sockopen mysock www.foo.com 80
}

on *:SOCKOPEN:mysock:{
  sockwrite -n mysock GET / HTTP/1.0
  sockwrite -n host: www.foo.com
  sockwrite -n
}

on *:SOCKREAD:mysock:{
  var %s
  sockread %s
  msg $sock(mysock).mark > %s
}



-genius_at_work


Link Copied to Clipboard