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.

Status Information Combined With Bans Counter

Old posts that have not been replied to for several years.
Locked
User avatar
blood_x
Halfop
Posts: 77
Joined: Tue Nov 20, 2001 8:00 pm
Location: KL, Malaysia
Contact:

Status Information Combined With Bans Counter

Post by blood_x »

Hi All,

Anyone can help me on how can I combine 2 TCL scripts (Status.tcl v1.0.0 By Kissmine and Ban Counter by BarkerJr) into 1 script. For example, I would like to publish my eggdrop total banlist when someone trigger !status (not one trigger for !bans and one for !status ONLY trigger !status then Ban Counter appears) as below;

proc asus_status {nick uhost hand chan vasus} {
global botnick asus timezone version admin uptime server server-online
catch {exec hostname} asus(hostname)
if {$asus(msgtype) == "2"} {
set asus_who $chan
} else {
set asus_who $nick
}
asus_msg $asus_who "\002Status\002 - [ctime [unixtime]] $timezone"
if {$asus(bot) == "0"} {set asus(bote) Eggdrop} else {set asus(bote) Windrop}
asus_msg $asus_who "I am $botnick, running $asus(bote) [lindex $version 0]"
asus_msg $asus_who "Running on $asus(hostname) [unames]"
asus_msg $asus_who "Owner $admin"
asus_msg $asus_who "Have [countusers] People In User File"
asus_msg $asus_who "Total Bans: $ctr bans" <- FROM BAN COUNTER SCRIPT.
asus_msg $asus_who "Channels, [channels]"
if {$asus(bot) == "0"} {catch {exec uptime} asus(uptime)} else {set asus(uptime) [duration [expr [clock clicks] / 1000]]}
asus_msg $asus_who "Online for [asus_time $uptime]"
asus_msg $asus_who "Box Stats: $asus(uptime)"
asus_msg $asus_who "Connected to $server for [asus_time ${server-online}]"
asus_msg $asus_who "\002End of Status\002 - Status.Tcl v$asus(version)"
}

Original Scripts as below;

A). Status.tcl

### What is your bot (Eggdrop = 0 / Windrop = 1)
### Default: set asus(bot) "0"
set asus(bot) "0"

### What type of msg do you want (MSG = 0 / NOTICE = 1 / CHAN = 2)
### Note: If you set 2, the bot will Msg the chan the status
### Otherwise it will msg/notice the users that triggers it
set asus(msgtype) "2"

### What is the trigger that you like???
### Default: set asus(trig) "!"
set asus(trig) "!"

### What flag is needed to trigger
### Default: set asus(flag) "m"
set asus(flag) "m"

### Plz dont edit anything past this line ###
### Unless you know what you are doing ###

set asus(version) "1.0.0"
putlog "Status.tcl v$asus(version) by Kissmine \002loaded\002"

bind PUB $asus(flag) $asus(trig)status asus_pub_status
bind MSG $asus(flag) status asus_msg_status

proc asus_msg {who what} {
global asus
if {$asus(msgtype) == "1"} {
puthelp "NOTICE $who :$what"
} else {
puthelp "PRIVMSG $who :$what"
}
}

proc asus_pub_status {nick uhost hand chan vasus} {
global asus botnick
asus_status $nick $uhost $hand $chan $vasus
}

proc asus_msg_status {nick uhost hand vasus} {
global asus botnick
set chan [lindex [split $vasus] 0]
if {$asus(msgtype) == "2"} {
if {[lindex $vasus 0] == ""} {
puthelp "NOTICE $nick :Usage: /msg $botnick status <#chan>"
return 0
}
}
asus_status $nick $uhost $hand $chan $vasus
}

proc asus_status {nick uhost hand chan vasus} {
global botnick asus timezone version admin uptime server server-online
catch {exec hostname} asus(hostname)
if {$asus(msgtype) == "2"} {
set asus_who $chan
} else {
set asus_who $nick
}
asus_msg $asus_who "\002Status\002 - [ctime [unixtime]] $timezone"
if {$asus(bot) == "0"} {set asus(bote) Eggdrop} else {set asus(bote) Windrop}
asus_msg $asus_who "I am $botnick, running $asus(bote) [lindex $version 0]"
asus_msg $asus_who "Running on $asus(hostname) [unames]"
asus_msg $asus_who "Owner $admin"
asus_msg $asus_who "Have [countusers] People In User File"
asus_msg $asus_who "Channels, [channels]"
if {$asus(bot) == "0"} {catch {exec uptime} asus(uptime)} else {set asus(uptime) [duration [expr [clock clicks] / 1000]]}
asus_msg $asus_who "Online for [asus_time $uptime]"
asus_msg $asus_who "Box Stats: $asus(uptime)"
asus_msg $asus_who "Connected to $server for [asus_time ${server-online}]"
asus_msg $asus_who "\002End of Status\002 - Status.Tcl v$asus(version)"
}

proc asus_time {time} {
set ltime [expr [unixtime] - $time]
set seconds [expr $ltime % 60]
set ltime [expr ($ltime - $seconds) / 60]
set minutes [expr $ltime % 60]
set ltime [expr ($ltime - $minutes) / 60]
set hours [expr $ltime % 24]
set days [expr ($ltime - $hours) / 24]
set asus_times ""
if {$days} {
append asus_times "$days "
if {$days == "1"} {
append asus_times "day "
} else {
append asus_times "days "
}
}
if {$hours} {
append asus_times "$hours "
if {$hours == "1"} {
append asus_times "hour "
} else {
append asus_times "hours "
}
}
if {$minutes} {
append asus_times "$minutes "
if {$minutes == "1"} {
append asus_times "minute "
} else {
append asus_times "minutes"
}
}
if {$seconds} {
append asus_times " $seconds "
if {$seconds == "1"} {
append asus_times "second"
} else {
append asus_times "seconds"
}
}
return $asus_times
}

B). Ban Counter

set cmdchar "!"

bind pub n|- ${cmdchar}bans pub:bans

proc pub:bans {nick uhost hand chan arg} {
set ctr 0
set bans [banlist]
while {[lindex $bans $ctr] != ""} {
set ctr [expr $ctr + 1]
}
puthelp "PRIVMSG $chan :$nick, Total Bans: $ctr bans."
return 1
}

Thanks for your help :)
Thank you for your support and commitments.

Sincerely,
fzAy®
http://www.iNTRACyber.com
(We Chat, We Share & We Learn)
P
Photon
Op
Posts: 170
Joined: Wed Aug 28, 2002 8:00 am
Location: Liverpool, England

Post by Photon »

after

Code: Select all

if {$asus(msgtype) == "2"} { 
set asus_who $chan 
} else { 
set asus_who $nick 
} 
(and before the first asus_msg bit) paste the code

Code: Select all

set ctr 0 
set bans [banlist] 
while {[lindex $bans $ctr] != ""} { 
set ctr [expr $ctr + 1] 
} 
That should do it. (from my brief scan of what you have).
User avatar
blood_x
Halfop
Posts: 77
Joined: Tue Nov 20, 2001 8:00 pm
Location: KL, Malaysia
Contact:

Post by blood_x »

Dear Photon,

It works, thanks! 8)

Here also, it is good if anyone can translate that script into html/php, so that user can view my eggdrop status on my web site. Anyone can make this tcl script?

Script As Edit By Photon and me, as below;

proc asus_msg {who what} {
global asus
if {$asus(msgtype) == "1"} {
puthelp "NOTICE $who :$what"
} else {
puthelp "PRIVMSG $who :$what"
}
}

proc asus_pub_status {nick uhost hand chan vasus} {
global asus botnick
asus_status $nick $uhost $hand $chan $vasus
}

proc asus_msg_status {nick uhost hand vasus} {
global asus botnick
set chan [lindex [split $vasus] 0]
if {$asus(msgtype) == "2"} {
if {[lindex $vasus 0] == ""} {
puthelp "NOTICE $nick :Usage: /msg $botnick status <#chan>"
return 0
}
}
asus_status $nick $uhost $hand $chan $vasus
}

proc asus_status {nick uhost hand chan vasus} {
global botnick asus timezone version admin uptime server server-online
catch {exec hostname} asus(hostname)
if {$asus(msgtype) == "2"} {
set asus_who $chan
} else {
set asus_who $nick
}
set ctr 0
set bans [banlist]
while {[lindex $bans $ctr] != ""} {
set ctr [expr $ctr + 1]
}
asus_msg $asus_who "\002Status\002 - [ctime [unixtime]] $timezone"
if {$asus(bot) == "0"} {set asus(bote) Eggdrop} else {set asus(bote) Windrop}
asus_msg $asus_who "I am $botnick, running $asus(bote) [lindex $version 0]"
asus_msg $asus_who "Running on $asus(hostname) [unames]"
asus_msg $asus_who "Owner $admin"
asus_msg $asus_who "Total Users: [countusers] Users In Database"
asus_msg $asus_who "Total Bans: $ctr Bans In Database"
asus_msg $asus_who "Channels, [channels]"
if {$asus(bot) == "0"} {catch {exec uptime} asus(uptime)} else {set asus(uptime) [duration [expr [clock clicks] / 1000]]}
asus_msg $asus_who "Online for [asus_time $uptime]"
asus_msg $asus_who "Box Stats: $asus(uptime)"
asus_msg $asus_who "Connected to underworld.undernet.org for [asus_time ${server-online}]"
asus_msg $asus_who "\002End of Status\002 - irc.ykznet.com"
}

proc asus_time {time} {
set ltime [expr [unixtime] - $time]
set seconds [expr $ltime % 60]
set ltime [expr ($ltime - $seconds) / 60]
set minutes [expr $ltime % 60]
set ltime [expr ($ltime - $minutes) / 60]
set hours [expr $ltime % 24]
set days [expr ($ltime - $hours) / 24]
set asus_times ""
if {$days} {
append asus_times "$days "
if {$days == "1"} {
append asus_times "day "
} else {
append asus_times "days "
}
}
if {$hours} {
append asus_times "$hours "
if {$hours == "1"} {
append asus_times "hour "
} else {
append asus_times "hours "
}
}
if {$minutes} {
append asus_times "$minutes "
if {$minutes == "1"} {
append asus_times "minute "
} else {
append asus_times "minutes"
}
}
if {$seconds} {
append asus_times " $seconds "
if {$seconds == "1"} {
append asus_times "second"
} else {
append asus_times "seconds"
}
}
return $asus_times
}
Thank you for your support and commitments.

Sincerely,
fzAy®
http://www.iNTRACyber.com
(We Chat, We Share & We Learn)
P
Photon
Op
Posts: 170
Joined: Wed Aug 28, 2002 8:00 am
Location: Liverpool, England

Post by Photon »

I would do html first.

You have to open a file (see docs) and write out to it html code which contains the strings you have already written.... I suggest you make an html document first that looks like you want it to, and then try and emulate it. WARNING : this html file has to be made world readable somewhere - if you have a public html dir in your shell account, that will do, but you'll probably have to chmod it.

php is the same sort of thing, but the code you have to write out is harder.

If you cant do html, I shall search out a primer on the net for you. Quick hint - in I.E use the view/source for inspiration.... :wink:
User avatar
blood_x
Halfop
Posts: 77
Joined: Tue Nov 20, 2001 8:00 pm
Location: KL, Malaysia
Contact:

Post by blood_x »

Dear Photon,

I've convert this script to be in html code, but seems as I load it on my eggdrop, it couldn't write the webpage. Can you check it for me..

Script as below;

#################################################
## Web Bot Status v1.0.0 By blood_x ##
## Update: http://www.ykznet.com/download/tcl/ ##
## Email: blood_x@ykznet.com ##
##---------------------------------------------##
## Purpose: This script is designed to ##
## publish bot status (includes some ##
## info such as server, uptime, ##
## eggdrop/windrop version.. etc) in ##
## your web server. ##
## Help: Please read "readme.txt" ##
## Support: tclsupport@ykznet.com or you can ##
## join Egghelp Forum at ##
## http://www.egghelp.org/forum/ ##
##---------------------------------------------##
## Script History: ##
## ##
## 1.0.0 - Basic Script made on 22/05/2003 ##
#################################################

#################################################
### Webpage Configuration ###
#################################################
set wbs_pagename "/www0/fzay/public_html/botstatus.php"
set wbs_title "$botnick Bot Status"
set wbs_pagecolor "#FFFFFF"
set wbs_fontface "Arial"
set wbs_fontsize "2"
set wbs_fontcolor "#000000"
set wbs_pgrefresh_time "3"
set wbs_pgmargin_top "0"
set wbs_pgmargin_left "0"
set wbs_server "irc.undernet.org"
set wbs_bot "0"
set wbs_version "1.0.0"

### Plz dont edit anything past this line ###
### Unless you know what you are doing ###

proc wbs_time {time} {
set ltime [expr [unixtime] - $time]
set seconds [expr $ltime % 60]
set ltime [expr ($ltime - $seconds) / 60]
set minutes [expr $ltime % 60]
set ltime [expr ($ltime - $minutes) / 60]
set hours [expr $ltime % 24]
set days [expr ($ltime - $hours) / 24]
set wbs_times ""
if {$days} {
append wbs_times "$days "
if {$days == "1"} {
append wbs_times "day "
} else {
append wbs_times "days "
}
}
if {$hours} {
append wbs_times "$hours "
if {$hours == "1"} {
append wbs_times "hour "
} else {
append wbs_times "hours "
}
}
if {$minutes} {
append wbs_times "$minutes "
if {$minutes == "1"} {
append wbs_times "minute "
} else {
append wbs_times "minutes"
}
}
if {$seconds} {
append wbs_times " $seconds "
if {$seconds == "1"} {
append wbs_times "second"
} else {
append wbs_times "seconds"
}
}
return $wbs_times
}

proc wbs_status {} {
global botnick timezone version admin uptime server-online wbs_pagename wbs_title wbs_pagecolor wbs_fontface wbs_fontsize wbs_fontcolor wbs_pgrefereshtime wbs_pgmargin_top wbs_pgmargin_left wbs_server wbs_bot wbs_version
catch {exec hostname} wbs_hostname
if {$wbs_bot == "0"} {catch {exec uptime} wbs_uptime} else {set wbs_uptime [duration [expr [clock clicks] / 1000]]}
if {$wbs_bot == "0"} {set wbs_bote Eggdrop} else {set wbs_bote Windrop}
set ctr 0
set bans [banlist]
while {[lindex $bans $ctr] != ""} {set ctr [expr $ctr + 1]}
set $wbs_pagename [open $wbs_pagename w]
puts $wbs_pagename "<html>\n<head>\n <meta http-equiv=\"Refresh\" content=\"$wbs_pgrefresh_time\">\n <title>$wbs_title</title>\n</head>"
puts $wbs_pagename "<body bgcolor=\"$wbs_pagecolor\" text=\"$wbs_fontcolor\" topmargin=\"$wbs_pgmargin_top\" leftmargin=\"$wbs_pgmargin_left\">"
puts $wbs_pagename "<font face=\"$wbs_fontface\">"
puts $wbs_pagename "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"455\">"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"450\" colspan=\"2\" align=\"center\"><b><p><font size=\"$wbs_fontsize\">$botnick Status</font></p></b></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Status:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">[ctime [unixtime]] $timezone</font></p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Bot Version:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">$wbs_bote [lindex $version 0]</font></p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Online As:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">$botnick</font></p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Running On:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">$wbs_hostname [unames]</font></p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Owned By:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">$admin</font></p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Total Users:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">[countusers] users in database</p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Total Bans:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">$ctr bans in database</p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Channels:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">Active on [channels]</p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Online For:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">[wbs_time $uptime]</p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Box Stats:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">$wbs_uptime</p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "<tr>"
puts $wbs_pagename "<td width=\"5\">&</td>"
puts $wbs_pagename "<td width=\"130\"><b><p><font size=\"$wbs_fontsize\">Connected To:</font></p></b></td>"
puts $wbs_pagename "<td width=\"320\"><p><font size=\"$wbs_fontsize\">$wbs_server [wbs_time ${server-online}]</p></td>"
puts $wbs_pagename "</tr>"
puts $wbs_pagename "</table>"
puts $wbs_pagename "</body>"
puts $wbs_pagename "</html>"
close $wbs_pagename
return 1
}

putlog "Web Bot Status.tcl v$wbs_version by blood_x (blod_x@ykznet.com) \002loaded\002"

Thanks.
Thank you for your support and commitments.

Sincerely,
fzAy®
http://www.iNTRACyber.com
(We Chat, We Share & We Learn)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Are you shure there is such a "/www0/fzay/public_html/botstatus.php" dir on your box?
Once the game is over, the king and the pawn go back in the same box.
User avatar
blood_x
Halfop
Posts: 77
Joined: Tue Nov 20, 2001 8:00 pm
Location: KL, Malaysia
Contact:

Post by blood_x »

caesar wrote:Are you shure there is such a "/www0/fzay/public_html/botstatus.php" dir on your box?
Yeap..
Thank you for your support and commitments.

Sincerely,
fzAy®
http://www.iNTRACyber.com
(We Chat, We Share & We Learn)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Then add some putlogs and see where it stucks.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

and please do NOT post those long codes in this forum anymore! .. instead upload it to a webpage and post the url instead
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Indeed, this will be nice. My eyes hurt :)
Once the game is over, the king and the pawn go back in the same box.
Locked