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.
Help for those learning Tcl or writing their own scripts.
CrazyCat
Revered One
Posts: 1306 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed May 25, 2022 5:59 am
Hi there,
I'm trying to use
picoirc but I can't have any result.
I probably misunderstood how it works, so if anyone knows...
My (actual) try:
Code: Select all
package require picoirc
proc test {} {
set myirc [::picoirc::connect cbirc testor "irc://irc.zeolia.net/test"]
}
proc cbirc {context state args} {
puts "Callback is here with $args"
switch $state {
init {
puts "Initialized with $context"
}
connect {
puts "connected ?"
::picoirc::post $context "/join #test2"
}
close {
puts "Well, close with $args"
}
debug {
puts "D --> $args"
}
default {
puts $state
}
}
}
And when using:
Code: Select all
crazycat@dev:~$ tclsh
% source ircclient.tcl
% test
Callback is here with
Initialized with ::picoirc::irc1
::picoirc::irc1
And nothing appear in IRC, neither in my ircd logs...
CrazyCat
Revered One
Posts: 1306 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed May 25, 2022 7:37 am
Ok, here is the answer
13:23:35 <mjanssen> CrazyCat: your eventloop is not running
13:23:54 <mjanssen> instead of directly calling test do after 10 test ; vwait forever
13:24:17 <CrazyCat> mjanssen> oh ? let me try that
13:24:18 <mjanssen> after 10 test ; will schedule the call to test as soon as the eventloop starts running
13:24:29 <mjanssen> vwait forever ; will start the event loop
13:26:34 <CrazyCat> oh yes it works !