This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
starpossen
Op
Posts: 139 Joined: Tue Jan 10, 2006 1:08 am
Post
by starpossen » Mon May 05, 2008 5:14 pm
What I wish for is, a script with a public command, output denpending on which channel the command is called.
example:
Channel1
command: !link
Result: visit http://******1.com
Channel2
command: !link
Result: visit http://******2.com
Meaning, same input on both channels, but different output
depending on which channel the command is called.
strikelight
Owner
Posts: 708 Joined: Mon Oct 07, 2002 10:39 am
Contact:
Post
by strikelight » Mon May 05, 2008 7:04 pm
Code: Select all
# configuration #
# use lowercase for chan names
set linktext(default) http://www.default.com/
set linktext(#chan1) http://www.chan1.com/
set linktext(#chan2) http://www.chan2.com/
# etc..
#end of config #
bind pub - !link proc:linktext
proc proc:linktext {nick uhost hand chan text} {
global linktext
set chan [string tolower $chan]
if {![info exists linktext($chan)]} {
putserv "PRIVMSG $chan :$linktext(default)"
} else {
putserv "PRIVMSG $chan :$linktext($chan)"
}
}
starpossen
Op
Posts: 139 Joined: Tue Jan 10, 2006 1:08 am
Post
by starpossen » Mon May 05, 2008 7:30 pm
Awsome, this works perfectly, thanks alot, I was wondering, where would I alter the script, so it would notice the one using the comand, so it won't show the output to the entire channel?
strikelight
Owner
Posts: 708 Joined: Mon Oct 07, 2002 10:39 am
Contact:
Post
by strikelight » Mon May 05, 2008 7:38 pm
change the two lines that have:
to:
starpossen
Op
Posts: 139 Joined: Tue Jan 10, 2006 1:08 am
Post
by starpossen » Mon May 05, 2008 7:52 pm
Damn.. awsome quick response and thanks again, I have yet another question (sorry to bug you)
I tried using some text formatting like so:
Code: Select all
set linktext(#chan1) \002link can be found at\002 http://link
But I guess that was very far from correct since the bot crashed.
strikelight
Owner
Posts: 708 Joined: Mon Oct 07, 2002 10:39 am
Contact:
Post
by strikelight » Mon May 05, 2008 8:21 pm
You'll need to encapsulate multiple arguments (words) in quotes or brackets...
ie.
set var "arg arg2"
starpossen
Op
Posts: 139 Joined: Tue Jan 10, 2006 1:08 am
Post
by starpossen » Mon May 05, 2008 8:43 pm
Okay, now i'm lost, could you please explain to me like I was very young hehe.
strikelight
Owner
Posts: 708 Joined: Mon Oct 07, 2002 10:39 am
Contact:
Post
by strikelight » Mon May 05, 2008 8:49 pm
<spoonfeed>
Code: Select all
set linktext(#chan1) "\002link can be found at\002 http://link"
</spoonfeed>
starpossen
Op
Posts: 139 Joined: Tue Jan 10, 2006 1:08 am
Post
by starpossen » Mon May 05, 2008 9:05 pm
Okay I feel stupid now, that was obvious, maybe next time I should be rested before asking questions,thanks for dinner though