| View previous topic :: View next topic |
| Author |
Message |
chaokusc Voice
Joined: 25 Apr 2006 Posts: 18
|
Posted: Tue Apr 25, 2006 1:50 pm Post subject: How do i fix my reply on word script ? |
|
|
I got this simple reply script written out so if somone says brb my bot says $nick says Be Right Back
| Code: | bind pub - brb pub_brb
proc pub_brb {nick uhost hand chan $brb_msg} {
putchan $chan "\002$nick\002 says Be Right Back"
} |
My question is, how can i make the bot not reply to anything after the brb ?
| Quote: | <FoX> brb
<testbot> FoX says Be Right Back
<FoX> brb im going out
<testbot> FoX says Be Right Back |
|
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Tue Apr 25, 2006 2:03 pm Post subject: Re: How do i fix my reply on word script ? |
|
|
| chaokusc wrote: |
My question is, how can i make the bot not reply to anything after the brb ?
| Quote: | <FoX> brb
<testbot> FoX says Be Right Back
<FoX> brb im going out
<testbot> FoX says Be Right Back |
|
Try this:
| Code: |
bind pub - brb pub_brb
proc pub_brb {nick uhost hand chan args} {
if {$args == ""} {
putchan $chan "\002$nick\002 says Be Right Back"
}
}
|
|
|
| Back to top |
|
 |
chaokusc Voice
Joined: 25 Apr 2006 Posts: 18
|
Posted: Tue Apr 25, 2006 3:24 pm Post subject: |
|
|
| It still does it DragnLord, is there any other way ? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Tue Apr 25, 2006 4:43 pm Post subject: |
|
|
oops, that's why I usually use the simpler variable form
| Code: |
bind pub - brb pub_brb
proc pub_brb {n u h c t} {
if {$t == ""} {
putchan $c "\002$n\002 says Be Right Back"
}
}
|
|
|
| Back to top |
|
 |
chaokusc Voice
Joined: 25 Apr 2006 Posts: 18
|
Posted: Wed Apr 26, 2006 11:59 am Post subject: |
|
|
| ^^ Thank You |
|
| Back to top |
|
 |
chaokusc Voice
Joined: 25 Apr 2006 Posts: 18
|
Posted: Wed Apr 26, 2006 1:47 pm Post subject: |
|
|
Sorry for the double post but can anyone help me with the reply on this?
I just wish to know why $nick is not replaced with the nick of the person who typed superm4n
| Code: | set superm4nreply {
"Its a Bird, Its a Plane, No Its \0024Superm4n\002"
"\0024Superm4n\002 i think \002$nick\002 wants you"
"\002$nick\002 do you know why \0024Superm4n\002 wears his underwear on the outside ?"
"\002$nick\002 do you know why \0024Superm4n\002 wears \002red\002 underwear ?"
}
bind pub - superm4n pub_superm4n
proc pub_superm4n {nick u h chan t} {
global superm4nreply
if {$t == ""} {
set output [lindex $superm4nreply [rand [llength $superm4nreply]]]
putchan $chan "$output"
}
} |
If your not interested in giving me the full help thats fine, clues are welcome  |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Wed Apr 26, 2006 2:31 pm Post subject: |
|
|
1) use putlog to show variables in dcc as the script runs
| Code: |
proc pub_superm4n {nick u h chan t} {
putlog "got $nick in $chan"
global superm4nreply
if {$t == ""} {
set output [lindex $superm4nreply [rand [llength $superm4nreply]]]
putlog "output: $output"
putchan $chan "$output"
}
}
|
(btw, for this to work as written "superm4n" has to be the only word said)
2) search a lot more about rand and expr |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Fri Apr 28, 2006 3:46 am Post subject: |
|
|
he will have to double evaluate it, like:
eval "putchan $chan \"$output\""
or
eval "puthelp \"PRIVMSG $chan :$output\"" _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
chaokusc Voice
Joined: 25 Apr 2006 Posts: 18
|
Posted: Fri Apr 28, 2006 2:31 pm Post subject: |
|
|
I managed to fix it with this code
| Code: | # Superm4n
set bigmanreply {
"Its a Bird, Its a Plane, No Its \0024Superm4n\002"
"\0024Superm4n\002 i think \002$nick\002 wants your attention"
"\002$nick\002 do you know why \0024Superm4n\002 wears his underwear on the outside ?"
"\002$nick\002 do you know why \0024Superm4n\002 wears red underwear ?"
}
bind pub - superm4n pub_bigman
proc pub_bigman {nick u h chan t} {
global bigmanreply
if {$t == ""} {
set output [lindex $bigmanreply [rand [llength $bigmanreply]]]
regsub -all {\$nick} $output $nick output
putchan $chan "$output"
}
} |
This also let me allow $nick in bigmanreply
Thanks for all of your reply, and DragnLord i will look into rand and expr |
|
| Back to top |
|
 |
|