This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help with Server Notice binds

Old posts that have not been replied to for several years.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

OK - Answering questions in random order (like I do best).

1: The OP command is there, because you ahd it there. Please refer to previous statments in the post.

2: The array element will be dlated upon unset. That is the whole idea of the unset command.

3: It is my fault you get the error

Code: Select all

if {[info exists $nserv(check)]} { return 0 }
Should be

Code: Select all

if {[info exists nserv(check)]} { return 0 }
Note the $

The unset command takes a variable name, and not it's value.

4: Yes, you are very correct, the catch statment does catch errors, and is precicly what we are trying to catch.

Code: Select all

% set a "hello to all"
hello to all
% set a
hello to all
% unset a
% set a
can't read "a": no such variable
% unset a
can't unset "a": no such variable
Notice how it errors when a doesn't exist, but you try and unset it.

You can drop the catch part, as an error should never occur (once the variable is set, there is no way to trigger the timer again, thus, no way to double unset (which causes the error)).

5:
I would however, sugest the following change to the script, to make it a little more less issue prone.

Replace the flood protection IF with this.

Code: Select all

if {[info exists nserv(check)]} {
  if {($nserv(check) + 60) > [unixtime]} { return 0 }
}
Then change the set line to

Code: Select all

set nserv(check) [unixtime]
Another script could possibly delete the timer to unset the variable. If this happens, you script will forever remain in flood protection mode. This change will allow it to continue if after 60 seconds, it hasn't unset itself.
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

And it looks like it works. Triggers on EVERY notice, but only responds to the specific services one.

Now the basic functionality is down, and i have seen where i screwed up, can use this to expand the script into auto-ghosting.

Something i have actually noticed is that the majority of the nickserv scripts, if not all, rely on a "notc" bind to detect the messages from services. Only one i have encountered doesnt do this, and this relies on identifying to services every 5/10 minutes, and running various checks to make sure it hasnt done so immediately before.

Did the "notc" bind use to work for server notices? Perhaps in an earlier version?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Too be honest.

I don't know!

I am guessing your bot is called natsuki-chan?

If so, then your bot should call the notice bind, as the putlogs sugest the information is complete enough to do so.
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

hi, problem cropped up. Took me a while to notice it.

Now, thanks to the flood protection you build ppslim, it isnt causing too much problems, but the script IS responding to all Services notices, and is trying to complete a trigger on them all

Checked it this morning after reading some log files
[08:13:47] <Natsuki-Chan> [08:13] Nickserv Auto-Trigger Completed
[08:13:47] <Natsuki-Chan> [08:13] -NOTICE- Cyber_Akuma!Tendo847@12-248-42-33.client.attbi.com ACCESS [#catgirls] ADD princessv 8

Any idea why the first if statement isnt being validated right?

Code: Select all

	if {[string equal -nocase $text $nserv(warning)]} { 
		putserv "Privmsg $cserv(nick) :Op $::runchan" 
	} else { 
		putserv "Privmsg $nserv(nick) :Identify $nserv(pass)" 
		putcmdlog "Nickserv Auto-Trigger Completed" 
	} 
Did some testing, and got the bot ignored on services again, came up with this

Code: Select all

	if {[string equal -nocase $text $nserv(warning)] != 1} { 
		putlog "Test"
		return 1	
	} else { 
		putserv "Privmsg $nserv(nick) :Identify $nserv(pass)" 
		putcmdlog "Nickserv Auto-Trigger Completed" 
		putserv "Privmsg $cserv(nick) :Op $::runchan"
	} 
Problem that i created now, is that i cant see the notices in the dcc chat, that are from services, they all come out as
[08:27:40] <Natsuki-Chan> Msg to nickserv: help
[08:27:41] <Natsuki-Chan> [08:27] Test
[08:27:42] <Natsuki-Chan> [08:27] Test
And it seems it still doesnt work, any ideas?
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

and in further playing, i discovered it was my logic that was screwing it up

Code: Select all

	if {[string equal -nocase $text $nserv(warning)] != 0} { 
		return 0
	} else { 
		putserv "Privmsg $nserv(nick) :Identify $nserv(pass)" 
		putcmdlog "Nickserv Auto-Trigger Completed" 
		putserv "Privmsg $cserv(nick) :Op $::runchan"
	} 
dangit, thought that would have fixed it, but alas, it didnt
[08:32:18] <Natsuki-Chan> [08:32] -NOTICE- Weirdo!Seb@public2-ward1-6-cust41.oldh.broadband.ntl.com ACCESS [#catgirls] LIST
[08:32:18] <Natsuki-Chan> [08:32] -NOTICE- You have already identified
[08:32:19] <Natsuki-Chan> [08:32] -NOTICE- You are already opped on [#catgirls]
dangit

Sorry for double post, cant delete it seems
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

I did say it wasn't complete.

It needs more logic adding, to make sure it only responds to the commands you want.

Code: Select all

if {[string equal -nocase $text $nserv(warning)] != 1} {
You need to make sure the $nserv(warning) variable is set to the correct value.
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

set nserv(warning) "*nickname is owned*"

Thats what the warning variable is. What other logic could i add? I checked who the notice is from, services, i checking what the warning has to be, and i am checking for flood protection

What else could be added?
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

Well, i thought i would come back, after fiddling with the script this morning. I added some major logging to the script, to test the logic

Code: Select all

set cserv(services) "Services.Aniverse.Com"
set nserv(warning) "*This nickname is owned*"

proc nserv:notc {from keyword text} { 
	global cserv nserv 
	if {[string equal -nocase $from $cserv(services)] != 1} { return 0 } 
	putlog "1"
	if {[info exists nserv(check)]} { 
		if {($nserv(check) + 45) > [unixtime]} { return 0 }}
		putlog "2"
	if {[string match -nocase $text $nserv(warning)] == 1} { 
		putlog "3a"
		return 0
	} else { 
		putlog "3b"
		putserv "Privmsg $nserv(nick) :Identify $nserv(pass)" 
		putcmdlog "Nickserv Auto-Trigger Completed" 
		putserv "Privmsg $cserv(nick) :Op $::runchan"
	} 
	putlog "4"
	set nserv(check) [unixtime]
	utimer 15 [list catch [list unset nserv(check)]] 
	putlog "5" 
	return 0 
} 
To Trigger on <Natsuki-Chan> [11:40] -NOTICE- This nickname is owned by someone else

And on that trigger ONLY, run the script

But...
[11:40:28] <Natsuki-Chan> [11:40] Regained nickname 'Natsuki-Chan'.
[11:40:28] <Natsuki-Chan> [11:40] 1
[11:40:28] <Natsuki-Chan> [11:40] 2
[11:40:28] <Natsuki-Chan> [11:40] 3b
[11:40:28] <Natsuki-Chan> [11:40] Nickserv Auto-Trigger Completed
[11:40:28] <Natsuki-Chan> [11:40] 4
[11:40:28] <Natsuki-Chan> [11:40] 5
[11:40:28] <Natsuki-Chan> [11:40] -NOTICE- This nickname is owned by someone else
[11:40:28] <Natsuki-Chan> [11:40] 1
[11:40:28] <Natsuki-Chan> [11:40] -NOTICE- If this is your nickname, type /msg NickServ IDENTIFY <password>
does trigger on the message...

but also ...
[11:44:08] <Natsuki-Chan> [11:44] 1
[11:44:08] <Natsuki-Chan> [11:44] 2
[11:44:08] <Natsuki-Chan> [11:44] 3b
[11:44:08] <Natsuki-Chan> [11:44] Nickserv Auto-Trigger Completed
[11:44:08] <Natsuki-Chan> [11:44] 4
[11:44:08] <Natsuki-Chan> [11:44] 5
[11:44:08] <Natsuki-Chan> [11:44] -NOTICE- Weirdo!Seb@public2-ward1-6-cust41.oldh.broadband.ntl.com ACCESS [#catgirls] LIST
Now for some reason, even using the String Match, and String Equal, it just doesnt check it right. Is there any other way i can check one thing against another, cause right now, am out of ideas

Thanks
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

if {[string match -nocase $text $nserv(warning)] == 1} {
this line is wrong, first of I bet you want it to react when the text match, not when it doesn't, right now it hops to the else command when it doesn't match. Also you need to change the position of $text and $nserv(warning) ... make the line like this:

Code: Select all

if {![string match -nocase $nserv(warning) $text]} {
and give it another try

Just a small side-notice ;)
When binding raw NOTICE, $text won't just include the text of the notice, it will first hold the destination for the notice... in this case the botnick
so infact the reply will look like this:
from= "X!service@someservicebots.host" key="NOTICE" text="botnick :the text sent to the bot"
* this was just a small notice to anyone else wondering about the raw NOTICE bind ;)
Elen sila lúmenn' omentielvo
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

Yup, that worked. Cant believe it was such a simple error. but it is now triggering Putlog 3a, which is what wasnt happening.
[15:25:25] <Natsuki-Chan> [15:25] 1
[15:25:25] <Natsuki-Chan> [15:25] 2
[15:25:25] <Natsuki-Chan> [15:25] 3a
[15:25:25] <Natsuki-Chan> [15:25] -NOTICE- Weirdo!Seb@213.106.125.41 ACCESS [#catgirls] LIST
Getting past the checks nicely :)
Locked