Re: Ircle Script
Re: Ircle Script
- Subject: Re: Ircle Script
- From: JollyRoger <email@hidden>
- Date: Thu, 22 Feb 2001 18:38:26 -0600
on 2/22/2001 3:04 PM, Stephen Swift (aka Burnum) at email@hidden wrote:
>
I'm trying to create a script for Ircle to do the following:
>
Connect to a server
>
If server is full connect to another server
>
Join a channel
Hi Stephen,
Did you know there is a list dedicated to ircle scripting? The ircle web
site (
http://ircle.com/related.shtml) has instructions on how to subscribe.
>
I'm running into the following problems:
>
Ircle's Dictionary and I aren't getting along together. I have figured out
>
how to do certain actions such as connect and join via the type command, but
>
there should be a better way. I'm looking at the connection class but AS
>
isn't liking anything I try.
I'm sure I can help. What have you tried so far? What isn't working? Give
specifics.
>
AS can't decide to join a channel or try another server until the connection
>
has been completed (either failed or success). On IRC that could be between
>
30sec to 2 min. I don't want to use the delay command. So I'm wondering if
>
there is a way to use booleans to inquire whether ircle is connecting,
>
connected, or disconnected. Again I can't figure out how from the
>
dictionary.
You should have received a script called "events" with your ircle package.
if not, just say the word and I'll send it to you. It contains example
handlers for every event ircle sends out to loaded scripts.
To start, take a look at connectionevent(). This handler is called when a
connection event occurs (such as "connection opening", connection closed",
etc.). The connectionevent() handler looks like this:
on connectionevent(con, conevent)
-- con : connection number (1..10) NUMBER
-- con: 11 and up for dcc connections (NEW)
-- coneevent: one of namesearchfailed,
ipsearchfailed,namefound,ipfound,openfailed,established,closing,pleaseclose,
closed
tell application "ircle"
display ("connection " & (con as string) & " event")
end tell
end connectionevent
When you receive the connection "established" event, you are connected.
Note, however, that just being connected doesn't mean the server is ready
for a /join command. If you want to wait until the server is ready for
commands, you may want to do something different. What I do is wait for the
numeric server message 376 - the "End of MOTD" message. You can watch for
this event using the numeric() handler:
on numeric(con, command, thestring)
if (command = 376) then -- end of MOTD (server should be ready now)
-- send server commands
end if
return false
end numeric
To join a channel, I usually just tell Ircle to type the join command.
HTH
JR
References: | |
| >Ircle Script (From: "Stephen Swift (aka Burnum)" <email@hidden>) |