I have been looking for an example of catching user input.
For example it !test
what is your name
The user replies joe
How to catch that reply which i could then write to a file or what ever.
Just and example or a pointer would be most helpfull
generally, you catch user's output via [bind pubm] on channel or [bind msgm] on private
if you need to track the response of a particular user on a particular question, you need to implement a mechanism for associating user's nick with his/her response; the obvious and natural way of doing that is using Tcl associative array:
bind pubm - * getname
bind pub - !ask askname
proc askname {n u h c t} {
putserv "privmsg $c :$t, what's your name?"
set n [string tolower $t]
set ::name($n) asked
}
proc getname {n u h c t} {
set n [string tolower $n]
if [info exists ::name($n)] {
puthelp "privmsg $c :$n's name is $t"
unset ::name($n)
}
}
so, when you type !ask goober, the bot will output "goober, what's your name?", then upon first response from goober the bot will react with "goober's name is <response>"
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use
I also have a question about some interaction with user but on party-line. How to force bot o leave party-line for some time and create a diffrent "channel" only with that one user.
For example:
user type a command, let it be ".register". Bot ask him directly "your username". User type what he want. Then bot ask him for "serial number", and again user type something. Then bot check if everything is OK, send proper reply and finish whole procedure.
I know that i can do it like this: ".register username serial" but i want some interaction ;)
well, on the party line it's even easier since you have dedicated communication channel with that user which you access by its DCC sock index
of course, before proceeding with any interactive action, you need to seize control of that index by using [control], in order to be able to capture user's input
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use