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.

need help with script i am trying to make

Old posts that have not been replied to for several years.
Locked
B
Big Jay
Voice
Posts: 4
Joined: Wed Jul 13, 2005 3:25 pm

need help with script i am trying to make

Post by Big Jay »

here is a short bit of code i wrote, far from finished but one step at a time ay :)

onlt prob is it doesnt do nothin atall. timer doesnt work i dont think. not sure

any ideas

Code: Select all

set statfile "/home/user/public_html/stats.php" 

set channel "#channel" 

if {![info exists stats_running]} {   
    timer 5 statfile:make                      
    set stats_running 1                 
}                                   


proc statfile:make {args} { 

global statfile channel botnick

set topic [topic $channel topic]
set setby [topic $channel nick]
set settime [ctime [topic $channel unixtime]]

set outputfile [open $statfile w]

puts $outputfile "<table width=100% cellspacing=0 cellpadding=0>"
puts $outputfile "	<tr>"
puts $outputfile "		<td>Stats for $channel</td>"
puts $outputfile "	</tr>"
puts $outputfile "	<tr>"
puts $outputfile "		<td>topic: $topic</td>"
puts $outputfile "	</tr>"
puts $outputfile "	<tr>"
puts $outputfile "		<td>Set by: $setby on $settime</td>"
puts $outputfile "	</tr>"
puts $outputfile "</table>"


close $statfile

putlog "Saving $channel stats..." 
timer 5 statfilet:make
return 1
} 
any help would be very much apreciated
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

first off, you have declared proc statfile:make as taking argument, but you don't supply an argument when calling it

secondly, you can't obtain the topic author's nick and timestamp this way; take a look here

also, when getting topic, you need to check whether the bot's actually on the channel - if it's not, you'll get an error

pay more attention to details when reading tcl-commands.doc
Locked