|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Hi, there are many ways to create a pm blocker. Personally I would go with a Hash Table, or perhaps the User List. However, it's your script so I'll give you a solution that is closest to the way you like it. Now, your test.txt file consists of lines with on each line 1 nickname, no spaces. An altered $isinfile alias using $read instead of filter works great for your script, since it's single words, not multiple words on each line. The filter solution is preferable in the case of multiple words on one line. Example code:
alias isinfile {
if !$isfile($$1) { echo -a Error: File $1 missing. | return }
if $2 == $null { echo -a Error: Matchtext missing. | return }
.echo -q $read($1,s,$2)
return $readn
}
[color:red] [/color]
on ^*:OPEN:?:*:{
if !$isinfile(test.txt,$nick) { echo -a $+ $nick just tried messaging you : 12 $+ $1- | halt }
}
Hope it is to your likings, Greets Edit: added the ^ in front of the event thanks to tsoglanos.
Last edited by FiberOPtics; 25/06/04 12:30 PM.
Gone.
|
|
|
|
Joined: Mar 2004
Posts: 130
Vogon poet
|
Vogon poet
Joined: Mar 2004
Posts: 130 |
hi Fiberoptics =)
first you forgot to add on text the (^) so the halt or haltdef can work second i it halts all querys even from users/nicks are in test.txt listed.
Dont`t call me baby,..
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Hi tsoglanos,
you have not carefully read my script.
1. You are right, i forgot to add it. When you need to use ^ with halt or not isn't really well defined in mIRC. For example in the ON INPUT you don't need it to halt something. Good remark.
2. Right now it only halts the script if a user is not in the script. Because i put if !$isinfile(...
Note the negating !, that means only people who are not in the file will be halted. The halt is within the braces { } that follow the !$isinfile, which means that the halt will only be triggered when the person is not in the file, which is what The_Game wants. He wants only people who are in the file to be able to pm.
3. Your script is BAD, and I'll try to explain to my best why it is. Be sure to do some tests this time before responding, ok?
--> Ok $read(test.txt,w,$+(*,$nick,*)) will search in the text file looking for *nickname*.
If it doesn't find a match, %m will be $null and that means that person isn't in the text file, and that the pm should be blocked.
So far so good.
Now, suppose in your text file you have:
TheOne TheBigOne Gooney
and a person with the nick "One" wants to message. Then your script will search for *one* and it will trigger on TheOne. So %m will be filled with TheOne, and the script will not block the pm. But as you can see this is not the good result, because we want to check if that nickname "One" is in the text file. One isnt in the text file, so he should be blocked, but in your script he is allowed.
4. Well tsoglanos, it seems that you are not as experienced in scripting yet, so please really from now on, try to test the code first, try to read it, try to learn from it, and then, when your postive that somethign is mistaken, let me know. But right now, you're making a fool out of yourself :tongue:
Greets
Last edited by FiberOPtics; 25/06/04 12:25 PM.
Gone.
|
|
|
|
Joined: Mar 2004
Posts: 130
Vogon poet
|
Vogon poet
Joined: Mar 2004
Posts: 130 |
Well this is not a big deal it was just a typo Ignore the * *
here again on ^1:OPEN:?:*: { var %m = $read(test.txt,w,$nick) | if (%m == $null) { echo -at * $nick just tried messaging you $+ : 12 $+ $1- | halt } }
why you think if somone has a question you must make a scripting tutorial.,about my scripting expirience I have enouth so i can give a simpel and worket explain somthing i mising in your explains =) don`t private anymore i just Ignore you and you post bye!
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
I'm sure putting $+(*,$nick,*) was a typo. *cough cough*
What you are missing is the ability to properly read and write in the English language.
Not only confusing me, but also confusing yourself when you're trying to interpret other people's posts.
And the reason that I have almost been giving scripting tutorials is because of this confusement. I had to wheigh my every word, because you could interpret it wrong because of your lack in English.
Last edited by FiberOPtics; 25/06/04 12:41 PM.
Gone.
|
|
|
|
Joined: Mar 2004
Posts: 130
Vogon poet
|
Vogon poet
Joined: Mar 2004
Posts: 130 |
and before you post again of course you can replace w with s
|
|
|
|
Joined: Mar 2004
Posts: 130
Vogon poet
|
Vogon poet
Joined: Mar 2004
Posts: 130 |
you sould realy change this: In theory, there is no difference between theory and practice. But, in practice, there is
Becuse the code you post is anithing else then what the game asked for,.., put the foul code if you now how so everone can easy test and Understend what you are posting
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
You cant' replace w with s in this case, because when doing $read(test.txt,s,$nick) the script will read from the text file, and scan for that word ($nick) and it will return what is following that first word on the line.
Example (here I go again giving you a scripting tutorial, because you obviously need one):
In your text file:
tsoglanos fiberoptics this is the text that will be returned
//echo -a Result: $read(test.txt,s,tsoglanos) --> Returns: Result:
//echo -a Result: $read(test.txt,s,fiberoptics) --> Returns: Result: this is the text that will be returned
In other words, your %m will always be empty even if it did find a match in the text file, because in The_Game's text file it is only nicknames, with nothing following it.
Gone.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Lol,
that code works perfect for what The_Game is requesting, and everybody except you is not understanding it. But I can't blame you really, your too busy confusing yourself.
Gone.
|
|
|
|
Joined: Jun 2003
Posts: 5,024
Hoopy frood
|
Hoopy frood
Joined: Jun 2003
Posts: 5,024 |
-General Reply-
I don't think it's necessary to pick at each other's code. It's not a competition. Obviously, the best code, 'cleanest' and so on is preferred but if you have a suggestion to someone who is helping about how they could improve then, in general, it would be better to PM the person. I believe FibreOptics opted to do this and tsoglanos started again.
This "check what you said before you post again" attitude is not necessary and it's rude. I think getting rude with each other is going to start an argument and is not productive to this thread! Picking at forum signatures is even less so and completely unnecessary.
Regards,
Mentality/Chris
|
|
|
|
Joined: Mar 2004
Posts: 130
Vogon poet
|
Vogon poet
Joined: Mar 2004
Posts: 130 |
this tsoglanos stardet again I realy dont like it if you read all post you will realise i stardet nothing i just posted somthing thes all and Fiberoptics stardet, not me and Mentality you are are moderator in this formum so you now we have in the past fight , but this has nothing to do with my post or this room also act like a moderator and keep you private fight or probleams you have with me out of this formum , we are all intrsting to Help with mIRC becuse we are all mIRCers nothing more.,.. greats.
|
|
|
|
Joined: Mar 2004
Posts: 130
Vogon poet
|
Vogon poet
Joined: Mar 2004
Posts: 130 |
Ah and Mentality if you are public post you think Fiberoptics
Is the best way why you are not just test fibers code first.,
alias isinfile { if !$isfile($$1) { echo -a Error: File $1 missing. | return } if $2 == $null { echo -a Error: Matchtext missing. | return } .echo -q $read($1,s,$2) return $readn } on ^*:OPEN:?:*:{ if !$isinfile(test.txt,$nick) { echo -a $+ $nick just tried messaging you : 12 $+ $1- | halt } }
after you test this code post the results!
|
|
|
|
Joined: Jun 2003
Posts: 5,024
Hoopy frood
|
Hoopy frood
Joined: Jun 2003
Posts: 5,024 |
I ensure you I am being completely objective and ensuring this does not go into an argument, and at the same time I will not participate in one with you. If you have further questions, comments or queries about my post, please private message me. Thank you Regards,
Mentality/Chris
|
|
|
|
Joined: Mar 2004
Posts: 130
Vogon poet
|
Vogon poet
Joined: Mar 2004
Posts: 130 |
the best way to do what the game want is a while loop with $read(test.txt,N)
on ^*:OPEN:?:*:{ var %t = 1 | while ($read(test.txt,%t)) { inc %t | if ($read(test.txt,%t) == $nick) { return } | else { echo -a $+ $nick just tried messaging you : 12 $+ $1- | halt } } }
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
on ^*:open:?:{
if (!$read(test.txt,r,/^ $+ $nick $+ $/i)) { halt }
}
The above is the simplest way i can think of. Edit: if you want case-sensitive nicks in the test.txt file, remove the i in /i
Last edited by tidy_trax; 25/06/04 02:51 PM.
New username: hixxy
|
|
|
|
Joined: Mar 2004
Posts: 130
Vogon poet
|
Vogon poet
Joined: Mar 2004
Posts: 130 |
he i tring the r before you postedt but this wrong if you have in test.txt write tso tsoglanos tsoglanos29 and somone with the nick tsog pm you it you will not block him
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Yes you will, the ^ and $ make sure of that: //write -c nicks.txt tso | write nicks.txt tsoglanos | write nicks.txt tsoglanos29 | if (!$read(nicks.txt,r,/^tsog$/i)) { echo -a this will be halted }
New username: hixxy
|
|
|
|
Joined: Mar 2004
Posts: 130
Vogon poet
|
Vogon poet
Joined: Mar 2004
Posts: 130 |
Well tidy sory but it your fall you used wrong the on open ^*:open:?:{ it can only be on :OPEN:?:*:{ and second this is my test.txt tso tsoglanos29 tsoglanos293 this is the nick i using tsog and this is the code on ^*:open:?:*:{ if (!$read(test.txt,r,/^ $+ $nick $+ $/)) { halt } } it is the same like ,w,*nick* when i type with the nick tsog /msg XXX-0758282137692 ela re it still open a query I using mIRC 6.15 and now debug you script add this echo -a $read(test.txt,r,/^ $+ $nick $+ $/)) i using the nick tsog and i get the nick tsoglanos29 you see? I realy don`t try to make a scripting chalenger with you I only try to help but there are always some guys the want to prove how good the are why ?
Last edited by tsoglanos; 25/06/04 03:13 PM.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
First of all, the on open event doesn't need *, regardless of what the help file says. Second, w,*nick* would be ,r,.*nick.*, mine will only match the complete nickname, if you actually type the example i gave you, you will see that it says "this will be halted", and it will be halted.
New username: hixxy
|
|
|
|
Joined: Mar 2004
Posts: 130
Vogon poet
|
Vogon poet
Joined: Mar 2004
Posts: 130 |
again debug your script
my nick is tsog
in test.txt
i have
tsoglanos tsoglanos29
and only becuse tsog is in tsoglanos or tsoglanos29
you script dont halt
here is an expalin how to debug your script, if you are to tiredt to test the script why you are posting?
on ^*:open:?:*:{ echo -a $read(test.txt,r,/^ $+ $nick $+ $/) }
|
|
|
|
|