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.

echo to chan

Help for those learning Tcl or writing their own scripts.
Post Reply
z
zee
Voice
Posts: 6
Joined: Thu Jan 05, 2006 10:20 pm

echo to chan

Post by zee »

This is from http://www.tclscript.com/egghttp_tut.shtml egghttp tutorial.

I'm getting it working exept that i can't echo the result to #chan.

Code: Select all

set url "http://www.blah..."
set thechan "#mychannel"

if {![info exists egghttp(version)]} {
	putlog "egghttp.tcl was NOT successfully loaded."
	putlog "egghttp_example.tcl has not been loaded as a result."
} else {
	proc your_callbackproc {sock} {
	global url
	set headers [egghttp:headers $sock]
	set body [egghttp:data $sock]
  
	regsub -all "\n" $body "" body
	regsub -all -nocase {<br>} $body "<br>\n" body

	regexp {a <b>(.*)</b> b} $body - served

#	putserv "PRIVMSG $thechan : $served"
	putlog "Website '$url' has served $served people so far."
	}

	bind pub - "!digg" digg

	proc digg {nick uhost hand chan arg} {
		global url 
		set sock [egghttp:geturl $url your_callbackproc]
		return 1
	}  
	putlog "egghttp_example.tcl has been successfully loaded."
}
The putserv "PRIVMSG $thechan : $served" doesn't work, but putlog does. what im doing wrong here ?
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Change:

Code: Select all

#   putserv "PRIVMSG $thechan : $served"
to:

Code: Select all

puthelp "PRIVMSG $thechan :$served"
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
z
zee
Voice
Posts: 6
Joined: Thu Jan 05, 2006 10:20 pm

Post by zee »

I tryed puthelp before, but its still does nothing.

At the same time it puts putlog, wich works...
z
zee
Voice
Posts: 6
Joined: Thu Jan 05, 2006 10:20 pm

Post by zee »

Code: Select all

set url "http://www.inflow.freesitedirect.com/randquote.php"
set thechan "#inflow"

bind pub - !digg digg

proc digg {nick uhost hand chan arg} {
	global url 
	set sock [egghttp:geturl $url your_callbackproc]
	return 1
}  

proc your_callbackproc {sock} {
	global url
	set headers [egghttp:headers $sock]
	set body [egghttp:data $sock]
  
	regsub -all "\n" $body "" body
	regsub -all -nocase {<br>} $body "<br>\n" body

	regexp {cc is <b>(.*)</b> end} $body - served

	putlog "$served"

}

putlog "egghttp_example.tcl has been successfully loaded."
ROFLMAO this is so screwed, even putting the variable $thechan in putlog screws up everything.

Still it can't puthelp/serv
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Did you realise that you didn't global thechan yet?
z
zee
Voice
Posts: 6
Joined: Thu Jan 05, 2006 10:20 pm

Post by zee »

thnx
Post Reply