Mania-92 Posted September 3, 2006 Share Posted September 3, 2006 How to read a ini? It looks like this: [TEST] Mania-92[NL]=1 How to read it in script? Kind regards, Mania Link to comment
lil Toady Posted September 3, 2006 Share Posted September 3, 2006 $readini(bla.ini,TEST,Mania-92[NL]) or $readini(C:\program files\blablabla\bla.ini,TEST,Mania-92[NL]) Link to comment
Mania-92 Posted September 3, 2006 Author Share Posted September 3, 2006 $readini(bla.ini,TEST,Mania-92[NL]) or $readini(C:\program files\blablabla\bla.ini,TEST,Mania-92[NL]) And how do i check if it is 1 for example? if ($... ($1,$2) == 1) { Or what? Link to comment
lil Toady Posted September 3, 2006 Share Posted September 3, 2006 if ($readini(bla.ini,TEST,Mania-92[NL]) == 1) { blablabla } on *:SIGNAL:mta.join:{ if ($readini(bla.ini,TEST,$mta.name($1,$2)) == 1) mta.text $1 hello $mta.name($1,$2) } Link to comment
Mania-92 Posted September 3, 2006 Author Share Posted September 3, 2006 if ($readini(bla.ini,TEST,Mania-92[NL]) == 1) { blablabla } on *:SIGNAL:mta.join:{ if ($readini(bla.ini,TEST,$mta.name($1,$2)) == 1) mta.text $1 hello $mta.name($1,$2) } elseif ($3 == !warn) { if ($readini(test.ini,WARNS,$4) == 0) { !writeini -n " $+ $scriptdir $+ test.ini" WARNS $4 1 } This doesn't works. Anyone some suggestions? Link to comment
lil Toady Posted September 3, 2006 Share Posted September 3, 2006 elseif ($3 == !warn) { if ($readini($scriptdir $+ test.ini,WARNS,$4) == 0) { !writeini -n " $+ $scriptdir $+ test.ini" WARNS $4 1 } } Link to comment
Mania-92 Posted September 3, 2006 Author Share Posted September 3, 2006 (edited) elseif ($3 == !warn) { if ($readini($scriptdir $+ test.ini,WARNS,$4) == 0) { !writeini -n " $+ $scriptdir $+ test.ini" WARNS $4 1 } } Still doesn't work. This is my whole script: on *:SIGNAL:mta.command: { ;Parameters: ;$1 = Server ;$2 = ID ;$3 = Command ;$4- = Parameters /* if ($3 == !nice) { mta.text $1 $mta.nick($1,$2) thinks the victory of $4 was nice! } */ if ($3 == !nice) { mta.text $1 $mta.nick($1,$2) thinks the victory of $mta.nick($1,$mta.getid($1,$4)) was nice! } elseif ($3 == !warn2) { if ($mta.level($1,$2) == 5) { mta.text $1 $mta.nick($1,$2) warned $4! } else mta.pm $1 $2 Error - You need to be level 5 to use this command. } elseif ($3 == !warn) { if ($readini($scriptdir $+ test.ini,WARNS,$4) == 0) { !writeini -n " $+ $scriptdir $+ test.ini" WARNS $4 1 } } on *:SIGNAL:mta.text: { if ($3 == brb) { mta.text $1 $mta.nick($1,$2) will be right back! } } on *:SIGNAL:mta.join: { !writeini -n " $+ $scriptdir $+ test.ini" WARNS $mta.ip 0 } } Edited September 3, 2006 by Guest Link to comment
CoZ Posted September 3, 2006 Share Posted September 3, 2006 if ($readini(bla.ini,TEST,Mania-92[NL]) == 1) { blablabla } on *:SIGNAL:mta.join:{ if ($readini(bla.ini,TEST,$mta.name($1,$2)) == 1) mta.text $1 hello $mta.name($1,$2) } your mixed up with VC again i know your used to mta 0.5 so i guess if ($readini(bla.ini,TEST,Mania-92[NL]) == 1) { blablabla } on *:SIGNAL:mta.join:{ if ($readini(bla.ini,TEST,$mta.nick($1,$2)) == 1) mta.text $1 hello $mta.nick($1,$2) } right ? Link to comment
lil Toady Posted September 3, 2006 Share Posted September 3, 2006 (edited) lol ye, soz I dont even have a mta:ma for SA as i dont play it so i do mistakes.. Edited September 3, 2006 by Guest Link to comment
CoZ Posted September 3, 2006 Share Posted September 3, 2006 lol ye, soz I dont even have a mta:ma for SA as i dont play it so i do mistakes.. well better a reply with a small error than no reply at all .. imho Link to comment
lil Toady Posted September 3, 2006 Share Posted September 3, 2006 on *:SIGNAL:mta.command: { var %a = $iif($4,$iif($mta.nick($1,$4) != Unknown,$4,$bla.getid($1,$4)),$2) if ($3 == !nice) mta.text $1 $mta.nick($1,$2) thinks the victory of $mta.nick($1,%a) was nice! elseif ($3 == !warn) { var %b = $readini($scriptdir $+ test.ini,WARNS,$mta.nick($1,%a)) if (!%b) { !writeini " $+ $scriptdir $+ test.ini" WARNS $mta.nick($1,%a) $calc(%b + 1) mta.text $1 $mta.nick($1,%a) has been warned ( $+ $readini($scriptdir $+ test.ini,WARNS,$mta.nick($1,%a)) warnings in total) } } } on *:SIGNAL:mta.text: { if ($3 == brb) mta.text $1 $mta.nick($1,$2) will be right back! } on *:SIGNAL:mta.join: { !writeini -n " $+ $scriptdir $+ test.ini" WARNS $mta.nick($1,$2) 0 } alias bla.getid { var %a = 0 while (%a <= $mta.server($1).cmax) { if ($2 isin $mta.nick($1,%a)) !return %a !inc %a } !return -1 } Link to comment
Mania-92 Posted September 7, 2006 Author Share Posted September 7, 2006 If for example an ini is BLABLA=1, can write it back to 0 with !writeini? This for example?: on *:SIGNAL:mta.text: { if ($3 == brb) { mta.text $1 $mta.nick($1,$2) will be back soon! !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 } elseif ($3 == *) { if ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2)) == 1) { !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 0 mta.text $1 $mta.nick($1,$2) is back! } } } Link to comment
lil Toady Posted September 7, 2006 Share Posted September 7, 2006 of course you can.. but you can also remove that from the ini thats how i'd do that if i was you: on *:SIGNAL:mta.text: { if ($3 == brb) { mta.text $1 $mta.nick($1,$2) will be back soon! !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 } elseif ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2))) { !remini " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) mta.text $1 $mta.nick($1,$2) is back! } } Link to comment
Mania-92 Posted September 7, 2006 Author Share Posted September 7, 2006 of course you can.. but you can also remove that from the inithats how i'd do that if i was you: on *:SIGNAL:mta.text: { if ($3 == brb) { mta.text $1 $mta.nick($1,$2) will be back soon! !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 } elseif ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2))) { !remini " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) mta.text $1 $mta.nick($1,$2) is back! } } Now i have a script like this: on *:SIGNAL:mta.text: { if ($3 == brb) { if ($readini(bla.ini,TEST,$mta.nick($1,$2)) == 1) { mta.text $1 $mta.nick($1,$2) will be back soon! !remini " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 2 } } elseif ($3 == *) { if ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2)) == 2) { !remini " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 mta.text $1 $mta.nick($1,$2) is back! } } } on *:SIGNAL:mta.join: { !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 } mta.join works because there is writen an ini "IP=1", but on text brb there is no text no text and on the ini line it's still 1. PS, the rest of my scrips works fine only this: elseif ($3 == !players) { mta.text $1 $mta.players($1,$2) Doesn't work eather Kind Regards, Mania Link to comment
lil Toady Posted September 7, 2006 Share Posted September 7, 2006 (edited) don't get why didn't you use my on *:SIGNAL:mta.text:{ example.. but ok, thats your script: on *:SIGNAL:mta.text: { if ($3 == brb) { if ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2)) == 1) { mta.text $1 $mta.nick($1,$2) will be back soon! !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 2 } } elseif ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2)) == 2) { !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 mta.text $1 $mta.nick($1,$2) is back! } } on *:SIGNAL:mta.join: { !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 } on *:SIGNAL:mta.command:{ if ($3 == !players) { var %a = 0,%b while (%a <= $mta.server($1).cmax) { if ($mta.nick($1,%a) != Unknown) %b = $iif(%b,%b $+ $chr(44) $mta.nick($1,%a),$mta.nick($1,%a)) !inc %a } mta.text $1 Players: %b } } Edited September 7, 2006 by Guest Link to comment
Mania-92 Posted September 7, 2006 Author Share Posted September 7, 2006 don't get why didn't you use my on *:SIGNAL:mta.text:{ example.. but ok, thats your script: on *:SIGNAL:mta.text: { if ($3 == brb) { if ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2)) == 1) { mta.text $1 $mta.nick($1,$2) will be back soon! !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 2 } } elseif ($3 == *) { if ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2)) == 2) { !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 mta.text $1 $mta.nick($1,$2) is back! } } } on *:SIGNAL:mta.join: { !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 } on *:SIGNAL:mta.command:{ if ($3 == !players) { var %a = 0,%b while (%a <= $mta.server($1).cmax) { if ($mta.nick($1,%a) != Unknown) %b = $iif(%b,%b $+ $chr(44) $mta.nick($1,%a),$mta.nick($1,%a)) !inc %a } mta.text $1 Players: %b } } It was ment to give with !players a number (1/20 or just 1 for example) . And on text brb it is doing well and ini is writin to 2 but on than on text f no message orso and ini stays on 2. [EDIT] I already see the problem, in mIRC * is being seen as some kind of char. But i ment a random sentence or word. So how? Link to comment
lil Toady Posted September 7, 2006 Share Posted September 7, 2006 you dont need that 'if ($3 == *) {' line at all!.. the 'on *:SIGNAL:mta.text:{' is called when player says something, so you dont need to check if there is a word on *:SIGNAL:mta.text: { if ($3 == brb) { if ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2)) == 1) { mta.text $1 $mta.nick($1,$2) will be back soon! !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 2 } } elseif ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2)) == 2) { !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 mta.text $1 $mta.nick($1,$2) is back! } } on *:SIGNAL:mta.join: { !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 } on *:SIGNAL:mta.command:{ if ($3 == !players) mta.text $1 There are currently $mta.server($1).players players on the server } Link to comment
Mania-92 Posted September 7, 2006 Author Share Posted September 7, 2006 you dont need that 'if ($3 == *) {' line at all!.. the 'on *:SIGNAL:mta.text:{' is called when player says something, so you dont need to check if there is a word on *:SIGNAL:mta.text: { if ($3 == brb) { if ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2)) == 1) { mta.text $1 $mta.nick($1,$2) will be back soon! !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 2 } } elseif ($readini($scriptdir $+ brb.ini,BRB,$mta.ip($1,$2)) == 2) { !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 mta.text $1 $mta.nick($1,$2) is back! } } on *:SIGNAL:mta.join: { !writeini -n " $+ $scriptdir $+ brb.ini" BRB $mta.ip($1,$2) 1 } on *:SIGNAL:mta.command:{ if ($3 == !players) mta.text $1 There are currently $mta.server($1).players players on the server } !players still doesn't work. Link to comment
Recommended Posts