mIRC Homepage
Posted By: zad0909 CAn a script read and calc 2 .ini files? - 25/10/07 12:32 PM
I have this greet script. ANd it works perfectly, however recently the greet.ini got 2 full of ip's etc. So I made a greet 2.ini and no problems except one. Its supposed to tell you how many people have joined the chan, and how many times you have joiend the chan. Well mine won't go above 35, and I dunno why. I think its because of the 2 ini files but I have no idea. Here is the script:
Quote:

on !*:join:%greetchan: {
if (%greetCounter == on) {
inc %greet.counter
set %greet.join $calc( $readini( greet.ini, greet 2.ini, $address, Join ) +1 ) | writeini greet 2.ini $address Join %greet.join | unset %greet.join
if ($right(%greet.counter,2) == 00) || ($right(%greet.counter,2) == 50) {
notice $nick 0,2CONGRATS4,2 $nick 0,2you are the4,2 $ord(%greet.counter) 0,2 Visitor To4,2 %greetchan $+ ..0,2This is The4,2 $ord($readini(greet.ini, greet 2.ini, $address, Join)) 0,2Time You Have Visited here...11,2 «×X§Ç®îÞt0®§X×»
describe $chan shoots fireworks for4 $nick *~~~~~|#####> `';:*,.,*:;'`12 $nick *~~~~~|#####> `';:*,.,*:;'`9 $nick *~~~~~|#####> `';:*,.,*:;'`7 $nick *~~~~~|#####> `';:*,.,*:;'`13 $nick *~~~~~|#####> `';:*,.,*:;'`11 $nick *~~~~~|#####> `';:*,.,*:;'`
}
else {
notice $nick 0,2Hello And Welcome To4,2 %greetchan $nick $+ . 0,2You are the4,2 $ord(%greet.counter) 0,2 Person that has Visited This Room...This is The4,2 $ord($readini(greet.ini, $address, Join)) 0,2Time You Have Visited here..11,2 «×X§Ç®îÞt0®§X×»
}
}
}


any help you can offer would be greatly appreciated.

Thanks laugh
Posted By: RusselB Re: CAn a script read and calc 2 .ini files? - 25/10/07 11:26 PM
I can't see any reason for it to stop at 35, sorry.

Out of curiosity, did you try using the -n switch with the writeini command before going to multiple ini files?
Posted By: Bekar Re: CAn a script read and calc 2 .ini files? - 25/10/07 11:36 PM
I have a fairly major issue with this line:
Code:
set %greet.join $calc( $readini( greet.ini, greet 2.ini, $address, Join ) +1 )

It's invalid syntax..

$readini() can only read from one ini file at a time.
Posted By: zad0909 Re: CAn a script read and calc 2 .ini files? - 26/10/07 11:39 AM
Originally Posted By: Bekar
I have a fairly major issue with this line:
Code:
set %greet.join $calc( $readini( greet.ini, greet 2.ini, $address, Join ) +1 )

It's invalid syntax..

$readini() can only read from one ini file at a time.


Ok well that answeres my question, but how do I fix it?

And What would setting -n do?
Posted By: Horstl Re: CAn a script read and calc 2 .ini files? - 26/10/07 12:03 PM
Originally Posted By: zad0909
(...) however recently the greet.ini got 2 full of ip's etc. (...)
That's where the -n switch for writeini comes into play (Quoting the help file):
Quote:
If the -n switch is specified, mIRC will attempt to write to the .ini file even if it is larger than 64k.
Thus, change your writeini line to:
"writeini -n greet.ini $address Join %greet.join"
...and you shouldn't need a second .ini file.

For convenience, the calculation would be:
set %greet.join $calc($readini(greet.ini,$address,Join) + $readini(greet 2.ini,$address,Join) +1)

Another note: the line
Code:
if ($right(%greet.counter,2) == 00) || ($right(%greet.counter,2) == 50) {
can be shortened to:
Code:
if (50 // %greet.counter) {
("if %greet.counter is a multiple of 50")

Regards smile
Posted By: zad0909 Re: CAn a script read and calc 2 .ini files? - 26/10/07 09:12 PM
Thanks laugh
© mIRC Discussion Forums