egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

help with switch commmand

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
ghostscript
Voice


Joined: 08 Feb 2006
Posts: 13
Location: unknown

PostPosted: Mon Mar 06, 2006 10:32 pm    Post subject: help with switch commmand Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Mar 06, 2006 11:03 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Mar 07, 2006 4:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber