mIRC Home    About    Download    Register    News    Help

Print Thread
reading nicknames from txt file #88147 25/06/04 04:28 PM
Joined: Jun 2004
Posts: 3
A
Apollo26 Offline OP
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Jun 2004
Posts: 3
How can i alow only notices from specify users

all nicks are stored in a file caled notice.txt

thanks!

Re: reading nicknames from txt file #88148 25/06/04 04:32 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
on ^*:notice:*:*:{
  if (!$read(notice.txt,r,/^ $+ $nick $+ $/i)) { haltdef }
}


New username: hixxy
Re: reading nicknames from txt file #88149 25/06/04 04:37 PM
Joined: Mar 2004
Posts: 130
T
tsoglanos Offline
Vogon poet
Offline
Vogon poet
T
Joined: Mar 2004
Posts: 130
on ^*:Notice:*:*:{ var %t = 1 | while ($read(notice.txt,%t)) { inc %t | if ($read(notice.txt,%t) == $nick) { return } | else { halt } } }

Last edited by tsoglanos; 25/06/04 04:45 PM.
Re: reading nicknames from txt file #88150 25/06/04 04:42 PM
Joined: Jun 2004
Posts: 3
A
Apollo26 Offline OP
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Jun 2004
Posts: 3
Thank you tsoglanos !

Re: reading nicknames from txt file #88151 25/06/04 04:54 PM
Joined: Mar 2004
Posts: 130
T
tsoglanos Offline
Vogon poet
Offline
Vogon poet
T
Joined: Mar 2004
Posts: 130
stop showing this code here to other users:

if (!$read(test.txt,r,/^ $+ $nick $+ $/i))

becuse it is not equal to the nicknames may stored in notice.txt

Re: reading nicknames from txt file #88152 25/06/04 04:54 PM
Joined: Apr 2004
Posts: 840
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 840
tidy_trax: nicknames can contain characters that regex interprets as control characters, so you'd have to escape those first...

tsoglanos: that doesn't actually work, your script will always either return or halt after having tested the second line of notice.txt.

My solution would be,
Code:
on ^*:notice:*:*:{ if (!$read(notice.txt,w,$nick)) { haltdef } }

Last edited by Sat; 25/06/04 05:02 PM.

Saturn, QuakeNet staff
Re: reading nicknames from txt file #88153 25/06/04 04:59 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Yep, you're right.

Code:
if (!$read(notice.txt,r,/^ $+ $replacex($nick,\,\\,^,\^,[,\[,],\],$chr(124),\ $+ $chr(124),{,\{,},\}) $+ $/i)) { haltdef }


New username: hixxy
Re: reading nicknames from txt file #88154 25/06/04 05:03 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I'd use something like this, to prevent frequent file reads in the event of flood:
Code:
on ^*:notice:*:*: if !$read(notice.txt,w,$nick) { .ignore -nu20 $nick | halt }


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: reading nicknames from txt file #88155 25/06/04 05:13 PM
Joined: Mar 2004
Posts: 130
T
tsoglanos Offline
Vogon poet
Offline
Vogon poet
T
Joined: Mar 2004
Posts: 130
Ah so now he have right ?

I am tring to tell you this 4 hours ago with result you caled you friend cris /Mentality and he blocks my form post .............

Re: reading nicknames from txt file #88156 25/06/04 05:54 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hey tsoglanos,

I was reading The_Game's thread a few minutes ago, and I noticed that you pasted my $isinfile alias, when replying to Mentality. The last line of what you pasted was this:

.echo -q $read($1,s,$2) return $readn

Do you realise that you did not copy my code properly from the Msg Board to the mIRC Scripts Editor?

What I posted was this:

.echo -q $read($1,s,$2)
return $readn

Notice how they are on different lines?

Now despite of what you may be thinking, I'm not going to attack you or criticise you. I'll just let you in on a useful trick, known by many on this board:

When code is posted between the "code" tags, you can copy the code to Wordpad first, and then copy from WordPad to mIRC. (Start --> wordpad.exe --> paste code --> copy code to mIRC Scripts Editor).

That way the newlines will be respected, and scripts will function the way they were made to be.

When I came to this forum, I did not know about this trick. Since I've known, it has proved to be very valuable. I hope that, despite our incident, you can value this tip as well, since it may prevent a lot of confusion in the future.

Best to you,

FiberOPtics

PS: My apologies for interfering with this thread. Though I'm fairly positive that tsoglanos will ignore my PM that I sent him. And perhaps now, more people will know about the WordPad trick. I'm out, bye!


Gone.
Re: reading nicknames from txt file #88157 25/06/04 08:23 PM
Joined: Mar 2004
Posts: 130
T
tsoglanos Offline
Vogon poet
Offline
Vogon poet
T
Joined: Mar 2004
Posts: 130
Actuali you right your solution would be the best

I post the $read(test.txt,w,$nick) some hours ago in an other post in the on open but i was tring to var %m = $read(test.txt,$nick) this would be not inposibel in nick stores since the are only one word per line also it is wery smart to use if !$read(bla.txt,w,$nick) =)

Re: reading nicknames from txt file #88158 25/06/04 08:26 PM
Joined: Mar 2004
Posts: 130
T
tsoglanos Offline
Vogon poet
Offline
Vogon poet
T
Joined: Mar 2004
Posts: 130
Tidy your code crashs mIRC * Break: evaluation error

on ^*:NOTICE:*:*:{
if (!$read(notice.txt,r,/^ $+ $replacex($nick,\,\\,^,\^,[,\[,],\],$chr(124),\ $+ $chr(124),{,\{,},\}) $+ $/i)) { haltdef }
}