mIRC Home    About    Download    Register    News    Help

Print Thread
CAn a script read and calc 2 .ini files? #188533 25/10/07 12:32 PM
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
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Ǯt0X׻
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Ǯt0X׻
}
}
}


any help you can offer would be greatly appreciated.

Thanks laugh

Last edited by zad0909; 25/10/07 12:32 PM.
Re: CAn a script read and calc 2 .ini files? [Re: zad0909] #188574 25/10/07 11:26 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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?

Re: CAn a script read and calc 2 .ini files? [Re: RusselB] #188575 25/10/07 11:36 PM
Joined: Dec 2002
Posts: 503
B
Bekar Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
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.

Re: CAn a script read and calc 2 .ini files? [Re: Bekar] #188598 26/10/07 11:39 AM
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
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?

Re: CAn a script read and calc 2 .ini files? [Re: zad0909] #188599 26/10/07 12:03 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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

Re: CAn a script read and calc 2 .ini files? [Re: Horstl] #188619 26/10/07 09:12 PM
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
Thanks laugh