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.

rehash problem with script

Old posts that have not been replied to for several years.
T
TomSommer

rehash problem with script

Post by TomSommer »

I have a tcl script where I bind two events, like so

bind pubm - * infoegg_chanmsg
bind msgm - * infoegg_privmsg

If I load up the bot... the first time... it won't respond to the msg's, but if I rehash... it works? why?

Is pubm something speciel when it comes to this? or?
P
Phooka

Post by Phooka »

try using:
bind pub
and
bind msg

i got that error when working on my script i still dont know what it is.
T
TomSommer

Post by TomSommer »

I tried that, but then it won't work all together... very strange

I'll try again... thanks
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

We would need to see more of the script, to locate the problem.
T
TomSommer

Post by TomSommer »

Code: Select all

bind pub - * infoegg_chanmsg
bind msg - * infoegg_privmsg

# - Basic forward functions
proc infoegg_chanmsg {nick host hand chan text} {
	infoegg_question $nick $chan channel $text
}
proc infoegg_privmsg {nick uhand handle text} {
	infoegg_question $nick $nick msg $text
}
nothing is registering... I've tried to debug it... but yet again.. nothing
T
TomSommer

Post by TomSommer »

BTW, nice number of posts ppslim.. 1337
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

I am guessing it is the pubm and msgm binds you need.

However, it's the rest of the script we need to see the problem.
T
TomSommer

Post by TomSommer »

hi again, sorry for the delay, but I've been debugging so much and found the code that is the problem

Code: Select all

	if {($tigger_only_in_channel == 1 && $type == "channel" && [lindex $text 0] != $trigger) || ([lindex $text 0] != $trigger && $tigger_only_in_channel != 1)} {
		infoegg_debug "Left operation because no trigger was found, trigger was '$trigger', text was '$text'"
		return 0
	}code]

Now, when the bot if first started... it issues the debug notice and terminates the function, but after I rehash it works fine... it does NOT terminate the function
T
TomSommer

Post by TomSommer »

I think I located the problem, the trigger is set to be "$botnick,"

but it seems that botnick is not defined when the bot is loaded, and only after the bot has been rehashed is that variable avaliable?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

$botnick is normaly defined in the config file.

However, when the bot loads withou the $botnick var being set, it will set it to a default of the primary nickname.

To get around it, add a "set botnick" line to the config file, with the value of the primary nickname.
T
TomSommer

Post by TomSommer »

I know this, but the problem is that if you have a script that says

Code: Select all

set trigger "$botnick"
in the top, (so it will be loaded once)

The variable $botnick won't contain anything....
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

So, as stated, set botnick before it gets a chance to load the script.

Surely that is simple to see.
T
TomSommer

Post by TomSommer »

I set my nick in my .conf file... surely that it correct?

There is no way to set it before the script loads... the botnick is set when the bot connects to a server, because it is a result of altnick and nick...
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Then as you have just stated, this is not a bug.

The confgi file, and scripts are loaded, before eggdrop even attempts to connect to a server. This is due to the fact, that all user settable settings and information, needs to be collected before connecting to a server.

If your script relies on using the var $botnick, to setup a trigger, then surly the trigger is being setup premiturly.

If eggdrop doesn't known what nickname it is using (IE, primary or altnick), then your script is not cable of knowing what trigger to use.

Sugestions would be to setup the trigger after connected to the server, and it is known what the nickname is.

Look into using the "bind evnt", to trigger a script, designed to setup the trigger based on the current nickname.
T
TomSommer

Post by TomSommer »

Thank you... I'll do that

The best way would be to have trigger set to "[botnick]" and then do a replace of [botnick] ? Don't you think?
Locked