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.

An easy scripting question (but not for me ;))

Old posts that have not been replied to for several years.
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

hi folks!

i'm new to eggdrop coding/scripting, and I got a question:

when someone says: "hey bot, you're ugly", then the bot should reply "look into th mirror, stupiid idiot" or something like it :smile:

how to realize it?

thx for your help!
Greetz,
eiSi
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

Code: Select all

bind pubm - * pubm:parsemsg

proc pubm:parsemsg {nick uhost hand chan text} {
  if {![regexp "hey bot, you're ugly" $text]} { return }
  putserv "PRIVMSG $chan :$nick, Look in the mirror, stupid."
}

<font size=-1>[ This Message was edited by: Wcc on 2002-03-08 16:30 ]</font>
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

a thx! :smile:

can you help me another time?

when a user types sentence with e.g. pencil in it, for example: hey, my pencil is cool! then the bot should say: i love pencils or anything else... :smile:

thx!!
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

Something like:

Code: Select all

bind pubm - * pubm:parsemsg2

proc pubm:parsemsg2 {nick uhost hand chan text} {
  if {![string match "<lower-case message to match here>" [string tolower $text]]} { return }
  putserv "PRIVMSG $chan :<reply here>"
}

There is a really good Eggdrop Tcl tutorial on http://www.suninet.nl/tclguide/tclguide.html.
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

ok thx! i will test it today! :smile:
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

no sorry, that don't works, got another idea?

thx!! :smile:

oh and can you tell me whats wrong with this code please?:

bind msg - * lex_msg

proc lex_msg {nick uhost hand chan arg} {
global words botnick
set words $arg
if {$words == "lex where are you?"} { putserv "PRIVMSG $nick :I'm here, $nick: --channels--" ; return 1}
return 1
}

then the bot should say all channels in which he is... can you tell me how to do that? thanks for your help!! sorry, but I'm an eggdrop noob :smile:

<font size=-1>[ This Message was edited by: eisi on 2002-03-09 07:35 ]</font>
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

You had to replace the text in <>'s with the text you want to use..

As for your code:

Code: Select all

bind msg - * lex_msg 

proc lex_msg {nick uhost hand chan arg} { 
  set words $arg 
  if {[string match "lex where are you?" [string tolower $words]]} { putserv "PRIVMSG $nick :I'm here, $nick: [channels]" } 
  return 1 
} 
[code]
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

yep, thx!

for my code... I have replaced the <>'s with my text, but it only works, if I only type the one word, e.g. "pencil" and nothing else..

thx again.. :smile:
Greetz,
eiSi
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

thx again, but the msg prodecure don't works, I don't know why... mmh I will try it again... :smile:
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

Code: Select all

proc lex_msg {nick uhost hand arg} {
The msg bind does not take a 'chan' arg.
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

ah ok, i think there was my fault! thx!
Greetz,
eiSi
i
illuSiON

Post by illuSiON »

Is it possible that the Bot replies a random message. For example:
If someone says "Hi" the bot can answer "Hi" or "hey" or "hum"
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

yeah, i think so, but i dont know how...

but the code for my bot's "where are you" proc isn't working yet, I don't know why..
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

ahh I found something for you:

Code: Select all

# random responses to the word "hello"
set ranhello {
  "Hi there"
  "hello, whats up"
  "hello"
  "hi"
  "hey whats up"
  "yeah, yeah hi HI"
  "hello, nice to see yea!"
  "Hi i'm happy today!!"
}
bind pub - hello pub_hello2
# random hello proc
proc pub_hello2 {nick uhost hand chan $ranhello} {
  global ranhello
  if [rand 2] {
    putchan $chan "[lindex $ranhello [rand [llength $ranhello]]] $nick"
    }
    return 1
}
that should help you! :smile:
i
illuSiON

Post by illuSiON »

Thanks, it works :smile:
Locked