|
Joined: Jan 2006
Posts: 64
Babel fish
|
OP
Babel fish
Joined: Jan 2006
Posts: 64 |
What does it mean?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
What is the exact error you get and what's the code you're trying to use?
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Jan 2006
Posts: 64
Babel fish
|
OP
Babel fish
Joined: Jan 2006
Posts: 64 |
Here is the 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
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Jan 2006
Posts: 64
Babel fish
|
OP
Babel fish
Joined: Jan 2006
Posts: 64 |
I tried to separate it to 3:
.
.
.
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.
|
|
|
|
Joined: Mar 2005
Posts: 420
Fjord artisan
|
Fjord artisan
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!
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
* Break: evaluation error * Break: command halted I see a pattern On a side note it also happens with $($+,2)
Last edited by hixxy; 16/02/06 09:25 AM.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Jan 2006
Posts: 64
Babel fish
|
OP
Babel fish
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... Realy strange...
|
|
|
|
Joined: Jan 2006
Posts: 64
Babel fish
|
OP
Babel fish
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?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
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?
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
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: $+"
|
|
|
|
Joined: Jan 2006
Posts: 64
Babel fish
|
OP
Babel fish
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...
|
|
|
|
Joined: Jan 2006
Posts: 64
Babel fish
|
OP
Babel fish
Joined: Jan 2006
Posts: 64 |
This is the final 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?
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
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. 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))
}
}
|
|
|
|
Joined: Jan 2006
Posts: 64
Babel fish
|
OP
Babel fish
Joined: Jan 2006
Posts: 64 |
Good ideas... 10x! I changed some things and it realy works...
|
|
|
|
|