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.

DCC File Sends

Old posts that have not been replied to for several years.
Locked
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

DCC File Sends

Post by Weirdo »

ok, 2nd post for today, hope i aint pushing my luck. I am trying to add more onto this rule script by giving an option which will send the FAQ, Rules and Op rules, in an info.txt file. When someoe does !rule_send it should send

Code: Select all

bind pub - !rule_send pub:infosend
proc pub:infosend { nick host hand chan text} {
	global runchan infofile
	if {[$chan != $runchan] || [onchan $runchan $nick] == 0 } {return 0}
	dccsend $infofile $nick
}
What it gives me is #weirdo - invalid command name.

$runchan = #weirdo

Any help?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

You will need to load the transfer and filesys modules for this to work.
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

Still does this with the modules turned on (they were off before)

[17:04:29] <Minako> [17:04] Tcl error [pub:infosend]: invalid command name "#weirdo"
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Weirdo wrote:Still does this with the modules turned on (they were off before)

[17:04:29] <Minako> [17:04] Tcl error [pub:infosend]: invalid command name "#weirdo"
1. ==> [$chan != $runchan]

putting a [ and a ] around it makes it a command.

2. ==> [onchan $runchan $nick]

check out doc/tcl-commands.doc

3. ==> $chan != $runchan || [onchan $nick $runchan] == 0

first you test that the channel the trigger came from is $runchan and then you test if the nick is on $runchan.
Suppose that $chan == $runchan, what does the [onchan] test then return? :roll:
Last edited by egghead on Thu Oct 17, 2002 12:17 pm, edited 3 times in total.
P
Photon
Op
Posts: 170
Joined: Wed Aug 28, 2002 8:00 am
Location: Liverpool, England

Post by Photon »

if {[$chan != $runchan]

doesnt anything in [] get executed?

surely all you need is if{$chan != $runchan} {}?

[edit] Doh ... just too late.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Photon wrote: [edit] Doh ... just too late.
He now gets the message in stereo ;)
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

Code: Select all

if {{$chan == $runchan} || {onchan $runchan $nick} == 0 } {return 0}
[17:53:44] <Minako> [17:53] Tcl error [pub:infosend]: expected boolean value but got "$chan != $runchan"


onchan <nickname> [channel]
Returns: 1 if someone by that nickname is on the specified channel (or
any channel if none is specified); 0 otherwise
Module: irc

Have i got the right usage of this, as if its 0, then the proc will stop, if its 1 then itll continue. Does the channel need to be specified in the onchan?

Cause of this boolean thingy, havent got a reading for the second run chan[/code]
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Weirdo wrote:

Code: Select all

if {{$chan == $runchan} || {onchan $runchan $nick} == 0 } {return 0}
[17:53:44] <Minako> [17:53] Tcl error [pub:infosend]: expected boolean value but got "$chan != $runchan"


onchan <nickname> [channel]
Returns: 1 if someone by that nickname is on the specified channel (or
any channel if none is specified); 0 otherwise
Module: irc

Have i got the right usage of this, as if its 0, then the proc will stop, if its 1 then itll continue. Does the channel need to be specified in the onchan?

Cause of this boolean thingy, havent got a reading for the second run chan[/code]
Hmm, stereo was not good enough :)

1. ==> {$chan == $runchan}
Do not put { } around it.

2. {onchan $runchan $nick}
put [ ] around this, since [onchan] is a command that returns something (0 or 1).

3. You write:

onchan $runchan $nick

and tcl-commands.doc writes:

onchan <nickname> [channel].

You see the difference in the order/location of the nickname and the channelname?

4. Even if you use the [onchan] correctly, are you sure this test is needed?
Last edited by egghead on Thu Oct 17, 2002 1:04 pm, edited 1 time in total.
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

Code: Select all

bind pub - !rule_send pub:infosend
proc pub:infosend { nick host hand chan text} {
	global runchan infofile
	if {$chan != $runchan || {onchan $runchan $nick} == 0 } {return 0}
	dccsend $infofile $nick
}
And believe it or not.....
[18:03:26] <Minako> [18:03] Begin DCC send info.txt to Weirdo
[18:03:29] <Minako> [18:03] Finished dcc send info.txt to Weirdo
It works

So why is it that the first expression shouldnt be in brackets, yet the second one does? Not sure i quite undertsand that
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Weirdo wrote:

Code: Select all

bind pub - !rule_send pub:infosend
proc pub:infosend { nick host hand chan text} {
	global runchan infofile
	if {$chan != $runchan || {onchan $runchan $nick} == 0 } {return 0}
	dccsend $infofile $nick
}
And believe it or not.....
[18:03:26] <Minako> [18:03] Begin DCC send info.txt to Weirdo
[18:03:29] <Minako> [18:03] Finished dcc send info.txt to Weirdo
It works

So why is it that the first expression shouldnt be in brackets, yet the second one does? Not sure i quite undertsand that
1. $chan != $runchan, tcl substitutes the actual values of $chan and $runchan and then evaluates the "!="

2. {onchan $runchan $nick} == 0, is still wrong. putting it like that will make it a string with the value "onchan $runchan $nick". The variables are not substituted. And that string is tested against == 0, which will always result in 0.

You MUST remove the { } and you MUST put [ ] around it if you want to use it as a command.

And once again: you MUST SWAP $runchan and $nick in the onchan command if you really really want to use that test.

And once again: do you really NEED this test?

:evil:
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

Want to know the stupid thing...

I only just noticed they were the wrong way round :P

I also removed the Second test cause i dont think i need it now that you come to think about it :P
Locked