mIRC Home    About    Download    Register    News    Help

Print Thread
#142080 15/02/06 08:00 PM
Joined: Jan 2006
Posts: 64
S
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2006
Posts: 64
What does it mean? shocked

#142081 15/02/06 08:02 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
What is the exact error you get and what's the code you're trying to use?

#142082 15/02/06 08:14 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
The only case I know to produce this error is

//echo -a $+($+,anythinghere)

What's (not so) interesting is that it's the only internal error I've seen printed in red.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#142083 15/02/06 08:14 PM
Joined: Jan 2006
Posts: 64
S
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2006
Posts: 64
Here is the code:
Code:
emotion {
  if ($prop != $null ) {
    if ($prop == name) {
      return $gettok($readini(data\config\emotions.dat,emotions,$+(n,$1)),1,61)
    }
    if ($prop == text) {
      return $right($gettok($readini(data\config\emotions.dat,emotions,$+(n,$1)),2,61), $calc($len($gettok($readini(data\config\emotions.dat,emotions,$+(n,$1)),2,61))   - 1)) 
    }
    if ($prop == total) {
      return $readini(data\config\emotions.dat,total,total)
    }
    if ($prop == path) {
      var %x = $mircdirimages\emotions\
      %x = $+(file:///,$replace(%x,$chr(92),$chr(47),$chr(32),$+($chr(37),20)))
      return $+(%x,$gettok($readini(data\config\emotions.dat,emotions,$+(n,$1)),1,61))
    }
  }
  else { return $gettok($readini(data\config\emotions.dat,emotions,$+(n,$1)),1,61) }
}

It apears on $prop == text

#142084 15/02/06 08:29 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You might be getting this error because you aren't using the 'n' switch in $readini(), so some things are being evaluated that shouldn't. Try including it and see if it fixes the problem.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#142085 15/02/06 08:50 PM
Joined: Jan 2006
Posts: 64
S
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2006
Posts: 64
I tried to separate it to 3:
Code:
.
.
.
    if ($prop == text) {
      var %r = $len($gettok($readini(data\config\emotions.dat,emotions,$+(n,$1)),2,61))
      var %e = $calc(%r - 1)
      return $right($gettok($readini(data\config\emotions.dat,emotions,$+(n,$1)),2,61), %e) 
    }
.
.
.

Since that I don't get this error any more.

#142086 15/02/06 09:40 PM
Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Try doing the advise of qwerty & that might fix your problem.


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
#142087 16/02/06 08:26 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
* Break: evaluation error
* Break: command halted

I see a pattern smile

On a side note it also happens with $($+,2)

Last edited by hixxy; 16/02/06 09:25 AM.
#142088 16/02/06 08:42 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
True, what I don't really get is why these two are related.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#142089 16/02/06 09:21 AM
Joined: Jan 2006
Posts: 64
S
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2006
Posts: 64
Ehm... I try it, I get Evaluation error on the same line again... don't know why, but when I separate the line to 3 lines and gather it with vars, it works... smirk Realy strange...

#142090 16/02/06 09:30 AM
Joined: Jan 2006
Posts: 64
S
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2006
Posts: 64
That's the first problem... let's say it's fixed for the moment... this function is being called sometimes 100-200 times per second, sometimes once per minute, but as we can see it's reading directly from the harddrive. This makes the program work so damn slow. Which is the best way to speed it up? Will it be better if I dump the file content in a Hash table structure when the program starts and read it via $hget() from that moment on? confused

#142091 16/02/06 09:36 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
That will be much better, but I imagine it will still be pretty slow. Why on earth do you need to execute this 100-200 times a second?

#142092 16/02/06 09:59 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
And basically with $anyident($+,anything), provided that $anyident() exists and the argument count is correct for that ident (except that it doesn't happen with $($+,non-number) ).


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#142093 16/02/06 10:10 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Ah I see. I don't understand why mIRC gives an evaluation error instead of just an insufficient parameters error or a "Too few parameters: $+"

#142094 16/02/06 07:37 PM
Joined: Jan 2006
Posts: 64
S
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2006
Posts: 64
The script i'm writing supports animated emotions like those in forums, Skype or ICQ. $emotion(N) returns all needed information about a selected emotion described in the INI file. They have filepaths, texts and so on. On every kind of incoming text, mIRC filters it for ALL emotions, every single line of text forces 14*4=56 calls of $emotion() with different property. If you are on 15-20 channels with average load of activity, mIRC WILL call $emotion() 400+ times per second... crazy

#142095 17/02/06 07:57 AM
Joined: Jan 2006
Posts: 64
S
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2006
Posts: 64
This is the final code:
Code:
load_emotions { 
  if ($exists($mircdirdata\config\emotions.dat)) { 
    var %x = $readini(data\config\emotions.dat,total,total)
    hadd -m emotions total %x
    if (%x > 0 ) {
      var %y = 1
      while (%y <= %x ) {
        hadd emotions %y $readini(data\config\emotions.dat,n,emotions,$+(n,%y))
        inc %y
      }
    }
    else {
      var %x = $input($lang(noconfig),dwao,$lang(error))
      exit
    }
  }
  else {
    var %x = $input($lang(noconfig),dwao,$lang(error))
    exit
  }
}

emotion {
  if ($prop != $null ) {
    if ($prop == name) {
      return $gettok($hget(emotions,$1),1,61)
    }
    if ($prop == text) {
      return $right($gettok($hget(emotions,$1),2,61), $calc($len($gettok($hget(emotions,$1),2,61)) - 1)) 
    }
    if ($prop == total) {
      return $hget(emotions,total)
    }
    if ($prop == path) {
      var %x = $mircdirimages\emotions\
      %x = $+(file:///,$replace(%x,$chr(92),$chr(47),$chr(32),$+($chr(37),20)))
      return $+(%x,$gettok($hget(emotions,$1),1,61))
    }
  }
  else { return $gettok($hget(emotions,$1),1,61 }
}
  

load_emotions executes on start. Any ideas how can I speed it up?

#142096 17/02/06 08:33 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I don't know if this'll be any faster, but, in theory it should be, since it's more compact
BTW: Needed to do a bit of rewrite on your code to get it to work this way, but my tests do show that it works.
Code:
 load_emotions { 
  if !$hget(emotions) { .hmake emotions 100 }
  if ($exists($mircdirdata\config\emotions.dat)) { 
    .hload -i emotions $mircdirdata\config\emotions.dat emotions
  }
  if !$hget(emotions,0).item {
    var %x = $input($lang(noconfig),dwao,$lang(error))
    exit
  }
}
emotion {
  elseif ($prop == text) {
    return $right($gettok($hget(emotions,$1),2,61), $calc($len($gettok($hget(emotions,$1),2,61)) - 1)) 
  }
  elseif ($prop == path) {
    var %x = $mircdirimages\emotions\
    %x = $+(file:///,$replace(%x,$chr(92),$chr(47),$chr(32),$+($chr(37),20)))
    return $+(%x,$gettok($hget(emotions,$1),1,61))
  }
  else {
    return $iif($prop == name || !$prop,$gettok($hget(emotions,$1),1,61),$iif($prop == total,$hget(emotions,0).item))
  }
}
 

#142097 17/02/06 09:18 PM
Joined: Jan 2006
Posts: 64
S
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2006
Posts: 64
Good ideas... 10x! I changed some things and it realy works... smirk


Link Copied to Clipboard