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 

/msg bot, reply to channel

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Schubi
Voice


Joined: 06 Sep 2007
Posts: 5

PostPosted: Fri Sep 07, 2007 5:23 am    Post subject: /msg bot, reply to channel Reply with quote

Hello,

I've been trying to write a script that lets the bot send a message to the channel after sending a query to the bot:

/msg Bot User
<Bot> User: Ha Ha!

I tried to adapt some scripts that I found, but as I'm not familiar with coding it's a bit hard (and I already tried serveral variants of this one):

Code:
# /msg <bot> <nick>

bind msg * laugh msg:laugh

proc msg:laugh {nick host hand text} {
   putserv "PRIVMSG $chan :$nick: Ha Ha!"
}


# bind msg <flags> <command> <proc>
# procname <nick> <user@host> <handle> <text>
# Description: used for /msg commands. The first word of the user's
# msg is the command, and everything else becomes the text argument.

Thanks for taking a look,

Schubi
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Fri Sep 07, 2007 6:24 am    Post subject: Re: /msg bot, reply to channel Reply with quote

What channel? There's no channel associated with a message sent directly to the bot.
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
Schubi
Voice


Joined: 06 Sep 2007
Posts: 5

PostPosted: Fri Sep 07, 2007 7:36 am    Post subject: Reply with quote

Code:
bind msg - laugh msg:laugh

set chan "#test"

proc msg:laugh {nick host hand text} {
   putserv "PRIVMSG $chan :$nick: Ha Ha!"


Still something missing...?!
Back to top
View user's profile Send private message
YooHoo
Owner


Joined: 13 Feb 2003
Posts: 939
Location: Redwood Coast

PostPosted: Fri Sep 07, 2007 9:15 am    Post subject: Reply with quote

Schubi wrote:
Code:
bind msg - laugh msg:laugh

set chan "#test"

proc msg:laugh {nick host hand text} {
   putserv "PRIVMSG $chan :$nick: Ha Ha!"


Still something missing...?!
yup. anytime you use a variable in a procedure, you need to declare it within the proc.
Code:
bind msg - laugh msg:laugh

set laughchan "#test"

proc msg:laugh {nick host hand text} {
  global laughchan
   putserv "PRIVMSG $laughchan :$nick Ha Ha!"
}

_________________
Mr. Green
Johoho's TCL for beginners
Mr. Green
Back to top
View user's profile Send private message Send e-mail
Schubi
Voice


Joined: 06 Sep 2007
Posts: 5

PostPosted: Sun Sep 09, 2007 2:56 pm    Post subject: Reply with quote

Thank you - but still not working. :-/ I guess it has something to do with $nick (but now idea how the script gets the "/msg bot <nick>" value)
Back to top
View user's profile Send private message
Schubi
Voice


Joined: 06 Sep 2007
Posts: 5

PostPosted: Sun Sep 23, 2007 11:34 am    Post subject: Reply with quote

After a long, long time:

Code:
## NELSON 1.0.0
set chan "#testa"
bind msg - laugh nelson

## /msg botnick laugh <idiot>
proc nelson {nick uhost handle arg} {
 global chan botnick
  if { $arg == "" || $arg eq " " } {
                putserv "PRIVMSG $nick :Usage: /msg $botnick laugh <idiot>"
                return 0
        }
    putserv "PRIVMSG $chan :$arg: Haa Haa!"
}

putlog "Loaded NELSON 1.0.0"
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Sep 23, 2007 7:31 pm    Post subject: Reply with quote

Just so you know, the bot does have built-in capability to do the same thing, eg .act or .say (check the built-in helpfiles via dcc, .help act, .help say)

One other tip, you can use [string trim] to make sure there's no spaces so you don't need to test for " "

eg:

set arg [string trim $arg]
Back to top
View user's profile Send private message
Schubi
Voice


Joined: 06 Sep 2007
Posts: 5

PostPosted: Mon Oct 01, 2007 5:05 pm    Post subject: Reply with quote

Thanks for the info!
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 -> Script Requests 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