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.

Tiddles the cat ...

Old posts that have not been replied to for several years.
Locked
F
Feanixxx
Voice
Posts: 23
Joined: Sun Jul 27, 2003 11:30 am

Tiddles the cat ...

Post by Feanixxx »

Hi All :)

I have a pet cat written in mIrc that scans the text input and responds acordingly, with several hundred actions.
My girlfriend loves him, of course :) I now wish to convert him to eggdrop tcl.

This is the basic skeleton of the mirc script (just the one word and a couple of responses)

on 1:text:hello*:#: { /Greeting }
on 1:text:hiya*:#: { /Greeting }

alias Greeting {
/set %bt.rand $rand(1,2)
if (%bt.rand == 1) { .describe $chan purrs happily at $nick }
if (%bt.rand == 2) { .describe $chan gently headbutts $nick }
}


And this is what I've come up with so far to say hello as a CTTP Action:

bind pub - hello my_talk_handler
bind pub - Hello my_talk_handler

proc my_talk_handler {nick uhost hand chan text} {
putserv "PRIVMSG $chan :\001ACTION says Hello to $nick"
return 0
}

Can anyone point me any further in terms of using PUBM to get the whole text, parsing the text in TCL and so forth?

My lovelife is at serious risk over this ...........
F
Feanixxx
Voice
Posts: 23
Joined: Sun Jul 27, 2003 11:30 am

Post by Feanixxx »

Hmm, I think I'm getting there, I now have:

# Bindings
bind pubm - "% *hello*" Greeting
bind pubm - "% *Hello*" Greeting

proc Greeting {nick uhost hand chan text} {
global our_chan
if {$chan != $our_chan} {return 0}
set num {rand [4]}
if {$num == 0} {putserv "PRIVMSG $our_chan :\001ACTION says Hello to $nick"}
return 0
}

Just cannot get the RAND statement working - it sets $num to "rand[4]" rather than a number - any clues, anyone ?
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

set var "[command arg]"
photon?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

set num [rand 4]
but the result will be a number from 0 to 3, so by transforming it to:

Code: Select all

set num [expr [rand 4] +1]
will become from 1 to 4, bouth included.
Once the game is over, the king and the pawn go back in the same box.
F
Feanixxx
Voice
Posts: 23
Joined: Sun Jul 27, 2003 11:30 am

Post by Feanixxx »

Yes, that works fine, thank you, I should be able to finish it myself now :) Plus my lovelife looks safer ....
Locked