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.

is it posiable someone help me with SAMODE?

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
V
Valentin
Voice
Posts: 14
Joined: Sun Sep 04, 2022 12:54 am
Location: London
Contact:

is it posiable someone help me with SAMODE?

Post by Valentin »

I`m use this script fot ircop bot to get @ in every chan. Is it posiable to make it to get + in #opers. In every chan will get @, exempt #opers. In #opers has to be with +

Code: Select all

bind join - * join:opbot
proc join:opbot { nick host hand chan } {
 
    if {$nick eq $::botnick} {
       putserv "SAMODE $chan +o $::botnick"
    }
 
}
if there's a will, there's a way.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

bind join - * join:opbot

proc join:opbot { nick host hand chan } {
	if {![isbotnick $nick]} return
	set mode [expr {[string equal -nocase $chan "#opers"] ? "+o" : "++"}]
	putserv "SAMODE $chan $mode $::botnick"
}
Replace the second '+' in '++' with whatever mode gives the bot the + flag cos honestly I don't know.
Once the game is over, the king and the pawn go back in the same box.
Online
User avatar
CrazyCat
Revered One
Posts: 1217
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

The "+" is a voice, so +v.

And you like complex code ?

Code: Select all

bind join - * join:opbot

proc join:opbot { nick host hand chan } {
   if {![isbotnick $nick]} return
   set mode "+o"
   if {[string tolower $chan] eq "#opers"} { set mode "+v" }
   putserv "SAMODE $chan $mode $::botnick"
}
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

You scared of the expr line? :)

It's basically if condition do this else do something else just wrapped up nicely.
Once the game is over, the king and the pawn go back in the same box.
Online
User avatar
CrazyCat
Revered One
Posts: 1217
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

I'm not scared of it, but Valentin won't understand your code if you don't explain it.

I think that one of the first goals of this forum is to teach TCL to others, but I'm peharps wrong
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

You are right, in this case here's a more traditional approach:

Code: Select all

bind join - * join:opbot

proc join:opbot { nick host hand chan } {
	if {![isbotnick $nick]} return
	if {[string equal -nocase $chan "#opers"]} {
		set mode "+v"
	} else {
		set mode "+o"
	}
	putserv "SAMODE $chan $mode $::botnick"
}
Once the game is over, the king and the pawn go back in the same box.
Post Reply