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.

!Chaninfo channel request [Solved]

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
P
Puck
Voice
Posts: 10
Joined: Sat Mar 08, 2008 8:05 am
Location: Budapest, Hungary
Contact:

!Chaninfo channel request [Solved]

Post by Puck »

Hi everyone.

I searched the website, the archives and the forum, but i didnt manage too find a script that basicly does the following thing:

If i type .chaninfo in the channel the bot replies the channel settings in a pub message or notice, and i`d like this kind of script so that other channel owners can see theire channel settings without connecting too the partyline, and they, if its possible, can choose so that the reply comes in a notice or a pub message on the channel, and only +m +n or +o can benefit with this command, and if the user doesnt have these flags it replies them with "Sorry, access denied." Also another feature would be good, if the bot wouldnt selfflood its self, since im using allprotection.tcl, and it has a lot of settings in the chaninfo area (as you all know the script), so if it would be possible that after 150 chars it would do another line.

I`m very new in the TCL, looked thruw the forum and found lots of great scripts and used them, i juse want this script too give more freedom too the channel owners who use my egg.

Thank you in advance for the help.

P.S. : I didnt find a good avatar with a woman and here are the blushing and crying smilies : :cry: :oops:

(This is the way too post a request right ? :P)
Last edited by Puck on Wed Mar 12, 2008 5:40 am, edited 1 time in total.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pub - .chaninfo show:chaninfo

proc show:chaninfo {nick uhost hand chan arg} {
 foreach info [channel info $chan] {
  puthelp "privmsg $chan :$info"
 }
}
P
Puck
Voice
Posts: 10
Joined: Sat Mar 08, 2008 8:05 am
Location: Budapest, Hungary
Contact:

Post by Puck »

Thank you for your reply Sir_Fz. The code works rather funny, the bot starts with the settings and pasts one on each line :
[08:19] (@Akos0): +stn
[08:19] (@Akos0): 0
[08:19] (@Akos0): 0
[08:19] (@Akos0): 0
[08:20] (@Akos0): 10:2
[08:20] (@Akos0): 3:1
[08:20] (@Akos0): 5:3
[08:20] (@Akos0): 0:0
[08:20] (@Akos0): 3:1
[08:20] (@Akos0): 0:0
[08:20] (@Akos0): 5:30
[08:20] (@Akos0): 0
[08:20] (@Akos0): 60
[08:20] (@Akos0): 60
[08:20] (@Akos0): -enforcebans
[08:20] (@Akos0): +dynamicbans
[08:20] (@Akos0): +userbans
[08:20] (@Akos0): -autoop
[08:20] (@Akos0): -autohalfop
[08:20] (@Akos0): -bitch
[08:21] (@Akos0): +greet
[08:21] (@Akos0): +protectops
[08:21] (@Akos0): -protecthalfops
[08:21] (@Akos0): -protectfriends
[08:21] (@Akos0): +dontkickops
[08:21] (@Akos0): -inactive
[08:21] (@Akos0): +statuslog
[08:21] (@Akos0): -revenge
[08:21] (@Akos0): -revengebot
[08:21] (@Akos0): -secret
[08:21] (@Akos0): +shared
[08:21] (@Akos0): -autovoice
[08:21] (@Akos0): +cycle
[08:21] (@Akos0): -seen
[08:21] (@Akos0): +dynamicexempts
[08:21] (@Akos0): +userexempts
[08:21] (@Akos0): +dynamicinvites
[08:21] (@Akos0): +userinvites
[08:21] (@Akos0): -nodesynch
[08:21] (@Akos0): ap:level 100
[08:22] (@Akos0): ap:textl {5:1 60 k:kb 2}
And only at the end it pasts the allprotection`s settings, but this way the bot gets lagged, isnt there a way too make the bot paste the settings in 3 or 4 lines, one after the other, like this :
ap:level 100, ap:textl {5:1 60 k:kb 2}, ap:textc {215:3 120 kb 2}, ap:notcl {2:1 120 kb 2}, ap:notcc {200:3 180 kb 2}, ap:caps {75:90 120 kb 2}, ap:repeatl {3:10 60 k:kb 2}
And so on :roll:
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Could try something like this, prints 4 settings on each line:

Code: Select all

bind pub - .chaninfo show:chaninfo

proc show:chaninfo {nick uhost hand chan arg} {
 foreach [list "info1" "info2" "info3" "info4"] [channel info $chan] {
  puthelp "privmsg $chan :$info1, $info2, $info3, $info4"
 }
}
One cosmetic issue is that it might print excessive commas (,) on the last line depending on the number of settings.
Labels for string and integer settings would have to be hardcoded however, as there is no mechanism to retrieve these easily through tcl-scripting.

Another way that might work more like you requested:

Code: Select all

bind pub - .chaninfo show:chaninfo

proc show:chaninfo {nick uhost hand chan arg} {
 puthelp "PRIVMSG $chan :[join [channel info $chan] ", "]"
}
Keep in mind that the whole string of settings may become quite long, and need to be split over several lines through some cleaver mechanics.
NML_375
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Try wordwrap

Code: Select all

proc show:chaninfo {nick uhost hand chan arg} {
 foreach info [wordwrap [join [channel info $chan]] 100] {
  puthelp "privmsg $chan :$info"
 }
}

# user's wordwrap proc
proc wordwrap {str {len 70} {splitChr { }}} {
 set out [set cur {}]; set i 0
 foreach word [split [set str][unset str] $splitChr] {
  if {[incr i [string len $word]]>$len} {
   lappend out [join $cur $splitChr]
   set cur [list $word]
   set i [string len $word]
  } {
   lappend cur $word
  }
  incr i
 }
 lappend out [join $cur $splitChr]
}
P
Puck
Voice
Posts: 10
Joined: Sat Mar 08, 2008 8:05 am
Location: Budapest, Hungary
Contact:

Post by Puck »

Thank you Very Much. It works fine (:
Post Reply