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.

Need help converting to a pushmode =\

Help for those learning Tcl or writing their own scripts.
Post Reply
B
BIF
Voice
Posts: 12
Joined: Mon Jul 31, 2006 4:53 pm

Need help converting to a pushmode =\

Post by BIF »

qban { if ($1 ison $chan) { /mode # +b ~q: $+ $address($$1,2) } }
deqban { if ($1 ison $chan) { /mode # -b ~q: $+ $address($$1,2) } }

Cannot figure out how to get this to work in my bot
I have the rest of the script already written but this is stumping me
i thought like pushmode $chan +b ~q: $+ $host or something lol
pls help
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

doc/tcl-commands.doc wrote: pushmode <channel> <mode> [arg]
Description: sends out a channel mode change (ex: pushmode #lame +o
goober) through the bot's queuing system. All the mode changes will
be sent out at once (combined into one line as much as possible) after
the script finishes, or when 'flushmode' is called.
Returns: nothing
Module: irc
So basically, to add the ban "*!*@badhost" on channel "#mychannel", you'd do something like this:

Code: Select all

pushmode #mychannel +b "*!*@badhost"
Be aware that some of the ugly hacks in mirc-scripts are'nt nessecary (or available) in tcl (such as the "remove-space" token $+).
It would seem you're trying to add a ban such as this: "~q:*!*user@host", which would probably be something like this, depending on your code:

Code: Select all

pushmode $channel +b "~q:*!*${host}"
NML_375
B
BIF
Voice
Posts: 12
Joined: Mon Jul 31, 2006 4:53 pm

Ok thx I have figured it out and this is working

Post by BIF »

Code: Select all

proc pub:sban {nick uhost hand chan txt} {
  set txt [split $txt]
  set who [lindex $txt 0]
  if {[isbotnick $who]} { return }
  append ban "~q:*!*@" [lindex [split [getchanhost $who $chan] "@"] 1]
  if {[llength $txt] > 1} {
    set reason [join [lrange $txt 1 "end"]]
  } else {
    set reason "Requested"
  }
  if {[isvoice $who $chan]} {
    pushmode $chan "-v" $who
  }
  pushmode $chan +b $ban  
  puthelp "NOTICE $who :You Have been Placed on Silent Ban For bad Behavior."
  flushmode $chan
  return 1
}
B
BIF
Voice
Posts: 12
Joined: Mon Jul 31, 2006 4:53 pm

Post by BIF »

However When you just type !sban without any nick it will set +b ~q:*!*@* anyway i can stop that from happening.. Like make it not do anything if no nick is supplied ?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

BIF wrote:However When you just type !sban without any nick it will set +b ~q:*!*@* anyway i can stop that from happening.. Like make it not do anything if no nick is supplied ?

Code: Select all

change this:
if {[isbotnick $who]} { return } 

to this:
if {$who == "" || [isbotnick $who]} { return }
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

I'd rather suggest replacing that line with this:

Code: Select all

if {[isbotnick $who] || ![onchan $who $chan]} {return}
Checks wether the specified nick is present on the current channel, and aborts if not.
NML_375
Post Reply