mIRC Homepage
Posted By: Apollo26 reading nicknames from txt file - 25/06/04 04:28 PM
How can i alow only notices from specify users

all nicks are stored in a file caled notice.txt

thanks!
Posted By: tidy_trax Re: reading nicknames from txt file - 25/06/04 04:32 PM
Code:
on ^*:notice:*:*:{
  if (!$read(notice.txt,r,/^ $+ $nick $+ $/i)) { haltdef }
}
Posted By: tsoglanos Re: reading nicknames from txt file - 25/06/04 04:37 PM
on ^*:Notice:*:*:{ var %t = 1 | while ($read(notice.txt,%t)) { inc %t | if ($read(notice.txt,%t) == $nick) { return } | else { halt } } }
Posted By: Apollo26 Re: reading nicknames from txt file - 25/06/04 04:42 PM
Thank you tsoglanos !
Posted By: tsoglanos Re: reading nicknames from txt file - 25/06/04 04:54 PM
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
Posted By: Sat Re: reading nicknames from txt file - 25/06/04 04:54 PM
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 } }
Posted By: tidy_trax Re: reading nicknames from txt file - 25/06/04 04:59 PM
Yep, you're right.

Code:
if (!$read(notice.txt,r,/^ $+ $replacex($nick,\,\\,^,\^,[,\[,],\],$chr(124),\ $+ $chr(124),{,\{,},\}) $+ $/i)) { haltdef }
Posted By: qwerty Re: reading nicknames from txt file - 25/06/04 05:03 PM
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 }
Posted By: tsoglanos Re: reading nicknames from txt file - 25/06/04 05:13 PM
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 .............
Posted By: FiberOPtics Re: reading nicknames from txt file - 25/06/04 05:54 PM
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!
Posted By: tsoglanos Re: reading nicknames from txt file - 25/06/04 08:23 PM
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) =)
Posted By: tsoglanos Re: reading nicknames from txt file - 25/06/04 08:26 PM
Tidy your code crashs mIRC * Break: evaluation error

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

© mIRC Discussion Forums