|
Joined: Dec 2006
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Dec 2006
Posts: 6 |
Maybe I'm making a mistake, or this is a bug set %channel. $+ [ $chan ] $address($nick,2)This returns (with #imagica in this case): %channel.#imagica *!*@Plummet.users.quakenet.org msg $chan $address($nick,2) is in %channel. $+ [ $chan ]This returns (again with #imagica): *!*@Plummet.users.quakenet.org is in #imagica Is this normal? Please, help me out here
Last edited by ka0z; 05/12/06 04:01 PM.
|
|
|
|
Joined: Oct 2003
Posts: 313
Fjord artisan
|
Fjord artisan
Joined: Oct 2003
Posts: 313 |
msg $chan $address($nick,2) is in %channel. $+ [ $chan ] The %channel. evaluates as $null, and [ $chan ] evaluates to the same as $chan, so you have $null $+ $chanWhat you maybe want is $($+(%,channel.,$chan),2) . I thought that [ %channel. $+ [ $chan ] ] should work , too, but it seems not to - I guess I'm missing something here.
Sais
|
|
|
|
Joined: Dec 2006
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Dec 2006
Posts: 6 |
Thank you for the fast reply, got 1 question though. $($+(%,channel.,$chan),2) What exactly does this do? Sorry ;( Thanks
|
|
|
|
Joined: Apr 2004
Posts: 759
Hoopy frood
|
Hoopy frood
Joined: Apr 2004
Posts: 759 |
[ %channel. [ $+ [ $chan] ] ]
I only use evaluation brackets when i want change the order of evaluation. I personally like the $($+(),N) way of things better.
$maybe
|
|
|
|
Joined: Oct 2003
Posts: 313
Fjord artisan
|
Fjord artisan
Joined: Oct 2003
Posts: 313 |
$+() is a concatenator: A $+ B can also be written as $+(A,B) $(A,N) evaluates its argument(A) N times.
So
$( $+(%,channel.,$chan) , 2)
evaluates $+(%,channel.,$chan) 2 times, as follows:
0: $+(%,channel.,$chan) 1: %channel.#chan 2: *!*@host
Sais
|
|
|
|
Joined: Dec 2006
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Dec 2006
Posts: 6 |
$+() is a concatenator: A $+ B can also be written as $+(A,B) $(A,N) evaluates its argument(A) N times.
So
$( $+(%,channel.,$chan) , 2)
evaluates $+(%,channel.,$chan) 2 times, as follows:
0: $+(%,channel.,$chan) 1: %channel.#chan 2: *!*@host so if I tried this as on *:text:hello:#imagica: { msg $chan $( $+(%,channel.,$chan) , 2) } this would return $null, thus unable to send the empty message to the channel. Because that's what it did when I tried it
Last edited by ka0z; 05/12/06 04:36 PM.
|
|
|
|
Joined: Apr 2004
Posts: 759
Hoopy frood
|
Hoopy frood
Joined: Apr 2004
Posts: 759 |
$() is short for $eval(string,N) it allow you to evaluate a string N or more times. what you do is make a string with $+() like so: $+(%,channel.,$chan) which return the string %channel.#channel however we want the contents of the variable the string represents so we need to force a 2nd evaluation. $eval($+(%,channel.,$chan),2) or $($+(%,channel.,$chan),2) is the same thing. $(,1) is the default depth of evaluation so //echo -a $eval($+(%,myname.,me),1) is the same as //echo -a $+(%,myname.,me) you can stop evaluation by doing \ //echo -a $($+(%,myname.,$me),0) but as with so many things in life you have a shortcut for that as well //echo -a $!+(%,myname.,$me)
;setting and getting dynamic variables
alias test {
set $+(%,test.,$me) Hello
echo -a $($+(%,test.,$me),2)
}
$maybe
|
|
|
|
Joined: Dec 2006
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Dec 2006
Posts: 6 |
on *:text:*:#imagica: { if ($find($1) == $me) { msg $chan $+(%,channel.,$chan) msg $chan $( $+(%,channel.,$chan) , 2) if ($address($nick,2) isin $( $+(%,channel.,$chan),1) { msg $chan FTW } } } This gives this: 18:02.52 ( @GlowuZ ) %channel.#ka0z 18:02.53 ( @GlowuZ ) *!*@Plummet.users.quakenet.org But no "FTW" is my code wrong or something? This is starting to annoy me
|
|
|
|
Joined: Oct 2003
Posts: 313
Fjord artisan
|
Fjord artisan
Joined: Oct 2003
Posts: 313 |
on *:text:*:#imagica: { ... msg $chan $( $+(%,channel.,$chan) , 2) if ($address($nick,2) isin $( $+(%,channel.,$chan),1) {
...
Why are you using $(...,2) in one place (where it works), and then switching to $(...,1) in the other (where it doesn't)?
Sais
|
|
|
|
Joined: Dec 2006
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Dec 2006
Posts: 6 |
Why are you using $(...,2) in one place (where it works), and then switching to $(...,1) in the other (where it doesn't)?
Because it doesn't work ;( And the $(...,2) doesn't work either.. %channel.#ka0z *!*@Plummet.users.quakenet.org btw
|
|
|
|
Joined: Oct 2003
Posts: 313
Fjord artisan
|
Fjord artisan
Joined: Oct 2003
Posts: 313 |
... if ($address($nick,2) isin $( $+(%,channel.,$chan),2)) { ...
(Didn't you get an "* /if: invalid format" error?)
Sais
|
|
|
|
Joined: Dec 2006
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Dec 2006
Posts: 6 |
if ($address($nick,2) isin $( $+(%,channel.,$chan) , 2)) {
works now, and all after I made my bot message my $address($nick,2) to the channel.
I was trying to see if my bot for some reason maybe had a wrong address so I added a msg $chan $address($nick,2) before the if statement above, and then it worked.
Very strange. Oh well, thanks for all the help guys.
|
|
|
|
|