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.

mrc to tcl

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
a
albozz
Voice
Posts: 8
Joined: Tue Jul 12, 2016 1:40 pm
Location: Albania
Contact:

mrc to tcl

Post by albozz »

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

Code: Select all

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?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

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. :)

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.
Last edited by caesar on Thu Jul 14, 2016 1:09 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
a
albozz
Voice
Posts: 8
Joined: Tue Jul 12, 2016 1:40 pm
Location: Albania
Contact:

..

Post by albozz »

The tcl script doesnt work and the bot doesnt give any messages in the irc server/channel , either in telnet
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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

Code: Select all

* 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: Select all

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: Select all

<@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.
Once the game is over, the king and the pawn go back in the same box.
Post Reply