links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
A complicated example of Squeak IRC bot usage
Last updated at 11:57 am UTC on 17 January 2006

<elvislives> (That is a longwinded way of making him do the much simpler: bot status)
<elvislives> oi status?
<oi> I was invoked on 20 September 2003 3:30:05 pm. 48 days have elapsed. I have been queried a total of 178 times.
<elvislives> oi history
<oi> oi jjGMT
<oi> oi status?
<oi> oi, how old are you?
<oi> oi how old are you?
<oi> oi: no, how old are you is <eval>bot status
<elvislives> there it is


I will give a summary of what the above is supposed to demonstrate. The bot is already programmed with a status command. I would like it also to reply this same information when someone asks, "how old are you?" This turned out to be a little tricky, plus my memory of how the <eval> rule works was shaky.

I had to go into a private channel to play around a bit with oi until I could get just what I wanted! Rather than fill a public room full of your false steps and foibles – it is definitely better to conduct your training session elsewhere.

Ok. I finally got the right command. But – my goal is not just to make this one hack. I would like others to see my final result so that my colleagues can have similar success in the future! So, we invoke the history command. This is pretty sophisticated in the end – but I believe it makes sense in this setting. The history in this case is not all that interesting. However, it has the one thing I wanted, which was the final result that ended up as the existing new rule in the bot's vocab for "how old are you?"

There is one last thing to comment that may trouble people. After the <eval> in the rule you see a reference to 'bot'. This is a predefined binding that is set in the Squeak Bot's compiler class. 'bot' is actually an instVar in the bot's compiler's namespace. For more about this you will have to check out the squeak IRC bot's Rare and Obscure, but Documented, features

Webb McDonald © 2003