egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

mrc to tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
albozz
Voice


Joined: 12 Jul 2016
Posts: 2

PostPosted: Wed Jul 13, 2016 6:39 am    Post subject: mrc to tcl Reply with quote

hello, anyone can help me with 1 tcl: on mIRC is this addons:
Code:

on *!:join:#help:{
  var %n = 1, %chan = #mainchan
  while ($ibl(%chan,%n)) {
    var %b = $ifmatch
    if (%b iswm $fulladdress) msg #help  $nick  has banned on #mainchan  from $gettok($ibl(%chan,%n).by,1,33) For $duration($calc($ctime - $ibl(%chan,%n).ctime)) Adress: ( %b )
    inc %n
  }
}

Anyone can help me to make it tcl for egg?
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3403
Location: Area 51

PostPosted: Wed Jul 13, 2016 11:36 am    Post subject: Reply with quote

Code:

namespace eval banCheck {
   set setup(help) "#help"
   set setup(main) "#mainchan"
   set setup(message) "%bywho banned %ban on %channel %when ago"
   
   set setup(duration) {
      604800 {" week" " weeks"}
      86400 {" day" " days"}
      3600 {" hour" " hours"}
      60 {" minute" " minutes"}
      1 {" second" " seconds"}
   }

   # don't edit past this line unless you know what you are doing

   bind join * * [namespace current]::check

   proc check {nick uhost hand chan} {
      variable setup
      if {[isbotnick $nick] || ![string equal -nocase $setup(help) $chan]} return
      if {![validchan $setup(main)] || ![botonchan $setup(main)]} return
      set chanbans [chanbans $setup(main)]
      set mask "$nick!$uhost"
      foreach {ban bywho age} [join $chanbans] {
         if {[string match -nocase $ban $mask]} {
            set when [elapsedTime $age]
            set bywho [lindex [split $bywho "!"] 0]
            set message [string map [list "%bywho" $bywho "%ban" $ban "%channel" $setup(main) "%when" $when] $setup(message)]
            puthelp "PRIVMSG $chan :$message"
         }
      }
   }

   # user's awesome duration http://forum.egghelp.org/viewtopic.php?p=79046#79046
   proc elapsedTime {time} {
      variable setup
      foreach {secs names} $setup(duration) {
         if {$time<$secs} continue
         set val [expr {$time/$secs}]
         lappend out $val[lindex $names [expr {$val!=1}]]
         if {![incr time [expr {-$val*$secs}]]} break
      }
      join $out
   }
}

If i got this right with my limited knowledge of mIRC's scripting language then give this a try cos i haven't done any testing what so ever so let me know if dose/doesn't do what you asked for. Smile

Feel free to change the message or the order of the words as you please as long as you keep the %variable as is and it will be replaced with the actual value.

Edit: Fixed.
_________________
You may say anything about me, but don't misspell my name.


Last edited by caesar on Thu Jul 14, 2016 1:09 am; edited 1 time in total
Back to top
View user's profile Send private message
albozz
Voice


Joined: 12 Jul 2016
Posts: 2

PostPosted: Wed Jul 13, 2016 3:49 pm    Post subject: .. Reply with quote

The tcl script doesnt work and the bot doesnt give any messages in the irc server/channel , either in telnet
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3403
Location: Area 51

PostPosted: Thu Jul 14, 2016 1:12 am    Post subject: Reply with quote

The string match wasn't getting the proper result due to the elements order. Now it's fixed and should work as expected.
Code:

* Rejoined channel #help
<@bot> bot banned *!*@*.users.undernet.org on #mainchan 2 minutes 12 seconds ago
<@bot> bot banned caesar!*@* on #mainchan 4 seconds ago

where the #mainchan had two bans: *!*@*.users.undernet.org and caesar!*@*

Apart the order I also added:
Code:

set bywho [lindex [split $bywho "!"] 0]

cos as it previously was, the result would have been the entire address and not just the nick of the person setting the ban, for example:
Code:

<@bot> bot!bot@hidden.host banned *!*@*.users.undernet.org on #mainchan 4 minutes 24 seconds ago

if you wish to have this rather than the nick then remove the above mentioned line from the code.
_________________
You may say anything about me, but don't misspell my name.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber