| View previous topic :: View next topic |
| Author |
Message |
ghostscript Voice
Joined: 08 Feb 2006 Posts: 13 Location: unknown
|
Posted: Mon Mar 06, 2006 10:32 pm Post subject: help with switch commmand |
|
|
Hi guys, I am running eggdrop 1.6.17; I am trying to make my bot respond to comments made in private msg between the bot and user. We are having trouble getting the bot to respond dynamically to user input. Here is a sample of my code; any suggestions would be greatly appreciated.
| Code: |
bind pub - !takethis pub_takethis
bind msg - !question pub_question
proc pub_takethis {nick mask hand channel args} {
set args_list [split $args "."]
set tnick [lindex $args_list 0]
set tcase [lindex $args_list 1]
set tchannel [lindex $args_list 2]
putquick "PRIVMSG #bot_city :$tchannel"
putquick "PRIVMSG $tchannel :!take"
putquick "PRIVMSG #bot_city :!taken $tcase.$tchannel"
putquick "PRIVMSG $tnick :Hello there\! My name is AgentBot. Give me a few moments to open and read over the case notes. I'll be right with you."
}
proc pub_question {nick mask hand channel args} {
putquick "PRIVMSG #bot_city :$nick it Worked!!"
switch {$arg} {
1 putquick { "PRIVMSG $nick :So this is a video issue." }
2 putquick { "PRIVMSG $nick :so this is an audio issue." }
3 putquick { "PRIVMSG $nick :so this is a startup issue." }
default putquick { "PRIVMSG $nick :It could be anything." }
}
} |
|
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Mon Mar 06, 2006 11:03 pm Post subject: |
|
|
| Code: |
switch $arg {
1 {set str "one"}
2 {set str "two"}
3 {set str "three"}
}
puthelp "privmsg $nick :$str"
|
_________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Mar 07, 2006 4:25 pm Post subject: |
|
|
| Code: |
switch $arg {
1-2 {set str "one or two"}
3-4 {set str "three or for"}
5 {set str "five"}
}
puthelp "privmsg $nick :$str"
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|