| View previous topic :: View next topic |
| Author |
Message |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Sat Nov 14, 2020 4:18 pm Post subject: Using Bind msg and Bind Pub for one Proc |
|
|
Is it possible to let Bind Msg and Bind Pub use the same proc?
Like
| Code: |
bind pub - !blah blah:blah
bind msg - blah blah:blah
proc blah:blah {nick host hand chan text} {
putserv "PRIVMSG $chan :blah"
}
|
but somehow remove the variable "text" in the proc when using bind msg?
Thanks in advanced  _________________ ComputerTech |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sat Nov 14, 2020 6:55 pm Post subject: |
|
|
No, you can't. In msg, you don't have the channel.
You can just do the following to "translate" pub to msg:
| Code: | bind pub - !blah pub:blah
bind msg - !blah blah
proc pub:blah {nick uhost handle chan text} {
blah $nick $uhost $handle $text
}
proc blah {nick uhost handle text} {
putserv "PRIVMSG $nick :hello"
} |
Or you can do the other way, but you'll have to force msg to be something like "!blah #chan hello pple":
| Code: | bind pub - !blah blah
bind msg - !blah msg:blah
proc blah {nick uhost handle chan text} {
putserv "PRIVMSG $chan :$text"
}
proc msg:blah {nick uhost handle text} {
set chan [join [lindex [split $text] 0]]
# check that $chan is really a channel or exit
set msg [join [lrange [split $text] 1 end]]
blah $nick $uhost $handle $chan $msg
} |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat Nov 14, 2020 6:59 pm Post subject: Re: Using Bind msg and Bind Pub for one Proc |
|
|
| ComputerTech wrote: |
...
but somehow remove the variable "text" in the proc when using bind msg?
|
When calling the proc with a bind msg, how is it going to know what channel to post in? Is it fixed?.... just one channel?... and thus you can hard code it?
In other words: Need more info. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
|