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.

setudef tips plesae

Help for those learning Tcl or writing their own scripts.
Post Reply
k
kenh83
Halfop
Posts: 61
Joined: Wed Sep 08, 2010 11:22 am

setudef tips plesae

Post by kenh83 »

Code: Select all

setudef flag relaycommand 
bind pub - !command cmd:proc

proc cmd:proc { nick uhost hand chan args } {
  if {[channel get $chan relaycommand]} { 
  putlog "detected !command and +relaycommand was set to this channel - $chan"
  }
}
is it possible in some way that i'm not able to figure out or find out by reading available documentation, to be able to add, beneath that "putlog" command, to use putallbots WITHOUT specifying a channel within the putall bots command .. and be able to have the other bot that receives the putallbots command be able to know which channel to send text to base off of 'setudef'

hopefully this make sense.. :( i really hope it does and that someone can shine some lite for me ;)
Last edited by kenh83 on Sat Sep 11, 2010 8:29 am, edited 1 time in total.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Replace:

Code: Select all

setudef +relaycommand 
with:

Code: Select all

setudef flag relaycommand
You can replace relaycommand with anything as long as isn't used already.
Once the game is over, the king and the pawn go back in the same box.
k
kenh83
Halfop
Posts: 61
Joined: Wed Sep 08, 2010 11:22 am

Post by kenh83 »

yes, ceasar thank you for correcting that, but that is not my question or why I posted. Please re-read.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

kenh,
You could loop through all available channels, test each for the "relaycommand" status, and if set, issue the needed commands on that channel..

On a side-note, avoid using the name "args" in your argument list, as this word is handled in a different manner by tcl.
NML_375
k
kenh83
Halfop
Posts: 61
Joined: Wed Sep 08, 2010 11:22 am

Post by kenh83 »

What should be used instead of args?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Pretty much anything...
"arg" or "text" would do just fine.
NML_375
k
kenh83
Halfop
Posts: 61
Joined: Wed Sep 08, 2010 11:22 am

Post by kenh83 »

nml, i'm confused as to what you mean by loop through all the channels..


Could you kindly share an example?

I've dropped using 'args' in all of my scripts. Thanks for the tip!
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Something along these lines:

Code: Select all

...
foreach channel [channels] {
  if {[channel get $channel relaycommand]} {
    #This channel is set +relaycommand, so do something here...
    puthelp "PRIVMSG $channel :Woobie!"
  }
}
NML_375
k
kenh83
Halfop
Posts: 61
Joined: Wed Sep 08, 2010 11:22 am

Post by kenh83 »

Incredible! I am still learning a lot and haven't gotten to the "loops" yet

I really appreciate you guiding me with this nml375.
Post Reply