mIRC Home    About    Download    Register    News    Help

Print Thread
#166030 05/12/06 04:00 PM
Joined: Dec 2006
Posts: 6
K
ka0z Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Dec 2006
Posts: 6
Maybe I'm making a mistake, or this is a bug smile


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 smile





Last edited by ka0z; 05/12/06 04:01 PM.
ka0z #166033 05/12/06 04:14 PM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Quote:
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 $+ $chan

What you maybe want is
Code:
$($+(%,channel.,$chan),2)
.

I thought that
Code:
[ %channel. $+ [ $chan ] ] 
should work , too, but it seems not to - I guess I'm missing something here.



Sais
Sais #166036 05/12/06 04:21 PM
Joined: Dec 2006
Posts: 6
K
ka0z Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Dec 2006
Posts: 6
Thank you for the fast reply, got 1 question though.

Code:
$($+(%,channel.,$chan),2)


What exactly does this do?

Sorry ;(

Thanks

ka0z #166040 05/12/06 04:28 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Php Code:
[ %channel. [ $+ [ $chan] ] ] 

wink

I only use evaluation brackets when i want change the order of evaluation.
I personally like the $($+(),N) way of things better.


$maybe
ka0z #166041 05/12/06 04:29 PM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
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
Sais #166042 05/12/06 04:35 PM
Joined: Dec 2006
Posts: 6
K
ka0z Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Dec 2006
Posts: 6
Originally Posted By: Sais
$+() 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.
ka0z #166044 05/12/06 04:41 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
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)

Php Code:

;setting and getting dynamic variables
alias test { 
  set $+(%,test.,$me) Hello
  echo -a $($+(%,test.,$me),2)
}
 



$maybe
Mpdreamz #166047 05/12/06 05:03 PM
Joined: Dec 2006
Posts: 6
K
ka0z Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
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 frown

ka0z #166051 05/12/06 05:26 PM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Originally Posted By: ka0z
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
Sais #166053 05/12/06 05:34 PM
Joined: Dec 2006
Posts: 6
K
ka0z Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Dec 2006
Posts: 6
Originally Posted By: Sais

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

ka0z #166060 05/12/06 07:15 PM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
...
if ($address($nick,2) isin $( $+(%,channel.,$chan),2)) {
...

(Didn't you get an "* /if: invalid format" error?)


Sais
ka0z #166096 06/12/06 07:22 AM
Joined: Dec 2006
Posts: 6
K
ka0z Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
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.


Link Copied to Clipboard