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 

[SOLVED YO] Help with a bind

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


Joined: 27 Mar 2006
Posts: 25

PostPosted: Sun Oct 08, 2006 6:31 am    Post subject: [SOLVED YO] Help with a bind Reply with quote

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
View user's profile Send private message Send e-mail
caesar
Mint Rubber


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

PostPosted: Sun Oct 08, 2006 2:06 pm    Post subject: Reply with quote

Try with 'pubm' then.
_________________
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
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sun Oct 08, 2006 7:46 pm    Post subject: Reply with quote

Code:
bind pub - !randomthing random:stuff

... etc
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Hamish
Voice


Joined: 27 Mar 2006
Posts: 25

PostPosted: Mon Oct 09, 2006 6:06 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
rosc2112
Revered One


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

PostPosted: Mon Oct 09, 2006 10:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hamish
Voice


Joined: 27 Mar 2006
Posts: 25

PostPosted: Tue Oct 10, 2006 4:40 am    Post subject: Reply with quote

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! Confused

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
View user's profile Send private message Send e-mail
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Tue Oct 10, 2006 11:10 am    Post subject: Reply with quote

Hamish wrote:
But when someone types !something - It activates both procedures! Confused

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 Razz)
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 Razz
_________________
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
View user's profile Send private message
Hamish
Voice


Joined: 27 Mar 2006
Posts: 25

PostPosted: Tue Oct 10, 2006 1:42 pm    Post subject: Reply with quote

Dude, you rock!
Thanks.
_________________
Thanks, Hamish.
Back to top
View user's profile Send private message Send e-mail
Hamish
Voice


Joined: 27 Mar 2006
Posts: 25

PostPosted: Fri Oct 13, 2006 7:13 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
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