Ok i changed the code and using $ticks and hash tables helped to make the script running smoother, but i still can't find a way around using a timer to run dict.form before the socket is automatically closed.

Code:
on *:SOCKREAD:dict.*: {
  if ($sockerr > 0) { echo -a Error while reading from $sockname $+ . | echo -a Error # $+ $sockerr occurred. | return }
  sockread % [ $+ $sockname ]
  while ($sockbr) {
    hadd -m $sockname $+ .text $hget($sockname,count) % [ $+ $sockname ]
    hinc $sockname count   
    sockread % [ $+ $sockname ] 
  }
  timer $+ $sockname -m 1 100 dict.form $sockname
}


It's not a big deal, because the Script runs good enough the way it is,but everytime a timer is activated a message appears in the status window.

And in the end it looks like this:

* Timer dict.45327359 activated
-
* Timer dict.45327359 activated
-
* Timer dict.45327359 activated
-
*...
-
* Timer dict.45327359 halted


Which is pretty annoying to be honest, so i was wondering if there is maybe a possibility to start a timer without getting a notice or even better to run dict.form entirely without a timer.


Click to reveal.. (Full code)
Code:
alias dict {
  set %temp $ticks
  hadd -m dict. $+ %temp chan  $$1
  hadd dict. $+ %temp term  $$2-
  hadd dict. $+ %temp count 1
  hadd dict. $+ %temp url /?s= $+ $replace($$2-,$chr(32),+)
  sockopen dict. $+ %temp www.dict.cc 80
  unset %temp
}

on *:SOCKOPEN:dict.*:{
  sockwrite -nt $sockname GET $hget($sockname,url) HTTP/1.1
  sockwrite -nt $sockname HOST: www.dict.cc
  sockwrite -n $sockname
}


on *:SOCKREAD:dict.*: {
  if ($sockerr > 0) { echo -a Error while reading from $sockname $+ . | echo -a Error # $+ $sockerr occurred. | return }
  sockread % [ $+ $sockname ]
  while ($sockbr) {
    hadd -m $sockname $+ .text $hget($sockname,count) % [ $+ $sockname ]
    hinc $sockname count   
    sockread % [ $+ $sockname ] 
  }
  timer $+ $sockname -m 1 100 dict.form $sockname
}
on *:SOCKCLOSE:dict.*: { msg $hget($sockname,chan) 4***Error Socket wasn't closed properly | hfree -s $sockname }


alias -l dict.form {
  hadd $1 charremove 1
  msg $hget($1,chan) <14 $hget($1,term) > 7Dict.cc14 Translation 12English - 3Deutsch 
  while ($hget($1,charremove) <= %dictresultcount) {
    hadd $1 countreset $hget($1,count)
    while ($hget($1,countreset)) {
      if ($regex($hget($1 $+ .text,$hget($1,countreset)),var c.Arr = new Array)) {
        hadd $1 match 1
        if ($mid($hget($1 $+ .text,$hget($1,countreset)),6,1) == 1) { hadd $1 lang eng }
        else { hadd $1 lang deu }
        hadd $1 $hget($1,lang) $remove($remove($mid($hget($1 $+ .text,$hget($1,countreset)),$pos($hget($1 $+ .text,$hget($1,countreset))," $+ $chr(44) $+ ",$hget($1,charremove)),$calc($pos($hget($1 $+ .text,$hget($1,countreset))," $+ $chr(44) $+ ",$calc($hget($1,charremove) + 1)) - $pos($hget($1 $+ .text,$hget($1,countreset))," $+ $chr(44) $+ ",$hget($1,charremove))))," $+ $chr(44) $+ "),",\)
      }
      hdec $1 countreset
    }
    if ($hget($1,match) == $null) { msg $hget($1,chan) 12no match! | hadd $1 match 1 }
    if ($hget($1,eng)) && ($hget($1,deu)) { msg $hget($1,chan) 12 $hget($1,eng) -3 $hget($1,deu) }
    hinc $1 charremove

  } 
  msg $hget($1,chan) 14for more information visit7 www.dict.cc $+ $hget($1,url) 
  hfree -w $1*
  sockclose $1
}


EDIT: o.O Nevermind a single . fixed the proplem, but anyway if anyone has an idea how to run dict.form without a timer, i would be glad if he/she shares it with me.
TIA

Last edited by p4rad0xon; 07/04/13 05:38 AM.