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 event after connect to server

Help for those learning Tcl or writing their own scripts.
Post Reply
d
darkwood
Voice
Posts: 2
Joined: Sun May 15, 2011 12:24 pm

Help with event after connect to server

Post by darkwood »

This is working:

Code: Select all

# This is a Tcl script to be run immediately after connecting to a server.
bind evnt - init-server evnt:init_server
bind raw - "432" evnt:nick_invalid

proc evnt:init_server {type} {
  global nick
  putserv "OPER nick operpass"
  putserv "NICK $nick"
  putserv "NS ID nickpass"
  putserv "MODE $nick +BiHqx-sw"
}

proc evnt:nick_invalid {from keyword text} {
  global altnick
  putserv "NICK $altnick"
}
This isnt working:

Code: Select all

# This is a Tcl script to be run immediately after connecting to a server.
bind evnt - init-server evnt:init_server
bind raw - "432" evnt:nick_invalid

proc evnt:init_server {type} {
  global nick botnick
  putserv "OPER nick operpass"
  putserv "NICK $nick"
  putserv "NS ID nickpass"
  putserv "MODE $botnick +BiHqx-sw" # this doesnt works
}

proc evnt:nick_invalid {from keyword text} {
  global altnick
  putserv "NICK $altnick"
}
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

Change:

Code: Select all

global nick botnick
To:

Code: Select all

global nick
global botnick
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@darkwood:
The latter probably does not work since you've just issued a NICK-command, and the "botnick" variable hasn't been updated yet. Keep in mind that eggdrop isn't multi-threaded, and the "botnick" variable is updated by another binding (catching the response-code of the NICK-command).

@Trixar_za:
Providing multiple variable names to a single global command is just as valid as calling the global command multiple times. Maybe you were thinking of the "variable" command?
NML_375
d
darkwood
Voice
Posts: 2
Joined: Sun May 15, 2011 12:24 pm

Post by darkwood »

@Trixar_za : Not solved the problem
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

@nml375 : Actually, I was thinking of a totally different different language because I was playing with a couple of non-standard ones yesterday.

That's the only thing I could see that might be wrong. The only possible explanation then is that botnick hasn't been set yet, which is probably caused by the NICK event. I don't really see the point of doing this at connect. Why change the bot's nick to itself on connect? Why not just remove the NICK $nick part all together?
Post Reply