| View previous topic :: View next topic |
| Author |
Message |
albozz Voice
Joined: 12 Jul 2016 Posts: 8 Location: Albania
|
Posted: Wed Jul 13, 2016 6:39 am Post subject: mrc to tcl |
|
|
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 |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Jul 13, 2016 11:36 am Post subject: |
|
|
| 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.
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. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Thu Jul 14, 2016 1:09 am; edited 1 time in total |
|
| Back to top |
|
 |
albozz Voice
Joined: 12 Jul 2016 Posts: 8 Location: Albania
|
Posted: Wed Jul 13, 2016 3:49 pm Post subject: .. |
|
|
| The tcl script doesnt work and the bot doesnt give any messages in the irc server/channel , either in telnet |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu Jul 14, 2016 1:12 am Post subject: |
|
|
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. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|