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.

on join bind help

Help for those learning Tcl or writing their own scripts.
Post Reply
e
evotech
Voice
Posts: 8
Joined: Fri Feb 18, 2011 8:51 am

on join bind help

Post by evotech »

Hi, trying to get this script to work and send a notice on join. as far as i can tell it's according to the documentation.

Code: Select all

bind pub - .streams cmd:stream
bind pub - !test cmd:test
bind pub - !whoburnedthehousedown
bind join - * cmd:stream

proc cmd:stream { nick uhost handle chan text } {
   catch { exec cat /home/evotech/eggdrop/scripts/urls | perl /home/evotech/eggdrop/scripts/streams.pl } streams
   putnotc $nick "$streams"
}
It works if called, but not on join, whats wrong with the 'bind join - * cmd:stream' line?

Probably something minor :P

thanks
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

Try

Code: Select all

bind join - "#* *!*@*" cmd:stream
What your missing is the channel and user mask part of the bind.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

The bind is just fine, "*" is a wide enough mask to match pretty much anyone joining the channel. However, the argument list of cmd:stream does not match the required parameters of the join binding; it only passes on 4 (nickname, user@host, handle, and channel) while your cmd:stream proc has 5, as you already use it with pub bindings.

There are two fixes for this;
1. use a different proc for your join binding

Code: Select all

bind join - * join:stream
proc join:stream {nick host handle channel} {
  catch {exec cat /home/evotech/eggdrop/scripts/urls | perl /home/evotech/eggdrop/scripts/streams.pl} streams
  putnotc $nick $streams
}
2. Make the last argument (text) optional by assigning it a default value:

Code: Select all

bind join - * cmd:stream
proc cmd:stream {nick uhost handle chan {text ""}} {
  catch {exec cat /home/evotech/eggdrop/scripts/urls | perl /home/evotech/eggdrop/scripts/streams.pl} streams
  putnotc $nick "$streams"
}
NML_375
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

bind join <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel>
the join procedure expects 4 arguments while you have 5. You can trick it by replacing:

Code: Select all

proc cmd:stream { nick uhost handle chan text } {
with:

Code: Select all

proc cmd:stream {nick uhost handle chan {text ""}} {
Once the game is over, the king and the pawn go back in the same box.
e
evotech
Voice
Posts: 8
Joined: Fri Feb 18, 2011 8:51 am

Post by evotech »

cool!

idk if i even need the text paramenter, ill try just taking it out first
edit: without it the public call doesnt work so i used the second option and it works great :)

But yeah, many thanks!
Post Reply