mIRC Homepage
Posted By: snabbi $eval bug - 12/05/04 09:36 PM
The bug is, sometimes it replaces the , in a space and sometimes it doesn't.

This is what i am up to. I have a hashtable in which I can store both commands and texts. I have put them in this format
1-1
1-2
1-3
2-1

I choose that 1- is my eventname, and has 3 lines in it. I keep on increasing the second number till it doesn't exists anymore. This is how i create an expendable set of commands.

This is the code you need for the experiment: (some of the words are dutch, just ignore that)

alias test {
var %iii = $2,%ii = $3-
var %i = 1
while ( $hget(gametext,%iii $+ - $+ %i) ) {
var %_i = %ii $_-_(%iii $+ - $+ %i)
$eval(%_i,2)
inc %i
}
}

alias _-_ { return $hget(gametext,$1) }
dialog chanbot {
title "Channelbot instellingen © snIRC by snabbi"
size -1 -1 300 200
option dbu
combo 74,10 10 80 50
combo 76,100 10 80 50
combo 78,10 100 80 50
}
on *:dialog:chanbot:init:* : {
test ¶ 166 did -a chanbot 74,76,78
}
alias start2 {
hadd -m gametext 166-1 1 Doe niets
hadd -m gametext 166-2 2 Geef 2 bottempvoice
hadd -m gametext 166-3 3 Devoice 2
hadd -m gametext 166-4 4 Deop 1 en devoice 2
hadd -m gametext 166-5 5 Deop 1 en devoice 2, log 2 uit
hadd -m gametext 166-6 6 Kick 1 devoice 2
}
When you start first do /start2 to load the hashvalues, then use the command /dialog -m chanbot chanbot

It should give 3 lists which contain the same sentences. (because all lines have had the command did -a chanbot 74,76,78)

But to my surprise this is what actually happend:
did -a chanbot 74,76,78 1 Doe niets
did -a chanbot 74,76,78 2 Geef 2 bottempvoice
did -a chanbot 74 76 78 3 Devoice 2
did -a chanbot 74 76 78 4 Deop 1 en devoice 2
did -a chanbot 74,76,78 5 Deop 1 en devoice 2, log 2 uit
did -a chanbot 74 76 78 6 Kick 1 devoice 2

Sometimes it leaves the , sometimes it is replaced by a space.
The solution to this problem is very simple and I already have the correct solution using

while ( $hget(gametext,%iii $+ - $+ %i) ) {
var %_i = $_-_(%iii $+ - $+ %i)
%ii $eval(%_i,2)
inc %i
}

(I need the eval function to replace functions like $time stored in the hashtable to the actual time)

So in short again, why does it sometimes replace the , and sometimes leaves it just the way it is.
© mIRC Discussion Forums