strange scripting bug - 14/06/09 09:13 AM
i was helping someone with a script today, that should have worked, but didn't. i couldn't really see anything wrong so i started testing, and i got a strange result.
//var %qn = 4 / 6 / | /var %qn = $deltok(%qn,-1,32) | /echo -s %qn
returns 0.666667
//var %qn = 4 / 6 / | /var %qn = $left(%qn,$calc($len(%qn)-1)) | /echo -s %qn
returns 0.666667
//var %qn = 4 + 6 + | /var %qn = $left(%qn,$calc($len(%qn)-1)) | /echo -s %qn
returns 10....
if you make it 4 & 6 & (witch is what started this, he tried to add results to a output string, like "found more results in quote 3 & 4 & 5...") it just returns 4..
and so on... any operator it just ($calcs) them..
and it only happens when theres 2 numbers.. if i did 4 + 6 + 6 + it would return "4 + 6 + 6"
it happens on xp, win7, on mirc 6.21 and 6.35..
so i assume its some sort of script engine bug..
//var %qn = 4 / 6 / | /var %qn = $deltok(%qn,-1,32) | /echo -s %qn
returns 0.666667
//var %qn = 4 / 6 / | /var %qn = $left(%qn,$calc($len(%qn)-1)) | /echo -s %qn
returns 0.666667
//var %qn = 4 + 6 + | /var %qn = $left(%qn,$calc($len(%qn)-1)) | /echo -s %qn
returns 10....
if you make it 4 & 6 & (witch is what started this, he tried to add results to a output string, like "found more results in quote 3 & 4 & 5...") it just returns 4..
and so on... any operator it just ($calcs) them..
and it only happens when theres 2 numbers.. if i did 4 + 6 + 6 + it would return "4 + 6 + 6"
it happens on xp, win7, on mirc 6.21 and 6.35..
so i assume its some sort of script engine bug..