| View previous topic :: View next topic |
| Author |
Message |
Hamish Voice
Joined: 27 Mar 2006 Posts: 25
|
Posted: Sun Oct 08, 2006 6:31 am Post subject: [SOLVED YO] Help with a bind |
|
|
bind pub - ! random:stuff
But it only works when someone types !
I want it to work when someone types
!randomthing
!stuff
!lollllers
Basically when someone types anything after it. _________________ Thanks, Hamish.
Last edited by Hamish on Tue Oct 17, 2006 12:03 pm; edited 1 time in total |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Oct 08, 2006 2:06 pm Post subject: |
|
|
Try with 'pubm' then. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sun Oct 08, 2006 7:46 pm Post subject: |
|
|
| Code: | | bind pub - !randomthing random:stuff |
... etc _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
Hamish Voice
Joined: 27 Mar 2006 Posts: 25
|
Posted: Mon Oct 09, 2006 6:06 am Post subject: |
|
|
Yes but there is lots of different possible !commands I could have. I used this:
bind pubm - "% !*" proc:stuff
And that worked.
But I need a way so I can store all the possible commands after that, I tried in a text file but It didn't quite work, can someone help? _________________ Thanks, Hamish. |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Mon Oct 09, 2006 10:15 pm Post subject: |
|
|
You're better off using if's to test the input for specific keywords, otherwise people will type all kinds of random junk and you'll soon find your bot behaving badly.
There are plenty of example scripts for making triggers, using either a specific comamnd with pub, or using wildcards with pubm. Check the tcl archive. |
|
| Back to top |
|
 |
Hamish Voice
Joined: 27 Mar 2006 Posts: 25
|
Posted: Tue Oct 10, 2006 4:40 am Post subject: |
|
|
I made a list out of the possible triggers then used lsearch to check if what the user entered was a trigger.
But now.
I have two triggers:
bind pubm - "% !*" stuff:private
bind pubm - "% @*" stuff:public
But when someone types !something - It activates both procedures!
Also is there a command like, setchaninfo but to set a user's default info line instead of just the info line for that channel? _________________ Thanks, Hamish. |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Tue Oct 10, 2006 11:10 am Post subject: |
|
|
| Hamish wrote: | But when someone types !something - It activates both procedures!  |
Sounds like you have some old binds left over from an earlier experiment.
.restart your bot to get rid of the old binds.
Here's another way to do what you're doing using an array (not tested as usual )
| Code: | # don't inclide the prefix character in the array keys
# because it is trimmed off in the stuff proc to allow
# having several prefixes for the same command
array set stuff {
omg {what did your god do?}
lol {what are you laughing at?}
help {help yourself.}
hello {hi there!}
}
bind pubm - "% !*" stuff
bind pubm - "% @*" stuff
proc stuff {n u h t a} {
global stuff
if {[scan $a "%*c%s" w]&&[info exists stuff($w)]} {
puthelp "PRIVMSG $t :$stuff($w)"
}
}
# to make it work with private messages, add this:
bind msgm - !* pstuff
proc pstuff {n u h a} {stuff $n $u $h $n $a} |
| Hamish wrote: | | Also is there a command like, setchaninfo but to set a user's default info line instead of just the info line for that channel? |
| Code: | | setuser $hand info "whatever" |
EDIT: messed up scan pattern  _________________ Have you ever read "The Manual"?
Last edited by user on Tue Oct 10, 2006 4:05 pm; edited 1 time in total |
|
| Back to top |
|
 |
Hamish Voice
Joined: 27 Mar 2006 Posts: 25
|
Posted: Tue Oct 10, 2006 1:42 pm Post subject: |
|
|
Dude, you rock!
Thanks. _________________ Thanks, Hamish. |
|
| Back to top |
|
 |
Hamish Voice
Joined: 27 Mar 2006 Posts: 25
|
Posted: Fri Oct 13, 2006 7:13 am Post subject: |
|
|
Ok I did what you said but now when I type:
@trigger It simply does nothing.
!trigger Works great, ofcourse. _________________ Thanks, Hamish. |
|
| Back to top |
|
 |
|