mIRC Homepage
Posted By: Anti raw embedded in ON event - 27/11/18 03:06 AM
Hello,
why raw event embedded in ON *:TEXT: don't go ?

I have this code :

ON *:TEXT:*:?:{

if ( server1 isin $server ) { echo -a $nick usa simosnap }
if ( server2 isin $server ) { whois $nick }

raw 311:*:{ echo -a $1- }

}

If I'm using server2 , I must check the $nick server ( I check the $nick irc server using whois $nick and parsing the output with raw 311:*:{....} ),
if he's using a particular server I must do a action, else another.

The problem is that it is not possible include raw inside a if-then ( and not even in another event ) , this give me a understood output, something like this ( for the code above ) :

mario-- has been idle 0secs, signed on Tue Nov 27 09:32:58
mario-- End of /WHOIS list.
-
311:*:{ Unknown command

How may I solve this problem ?

Posted By: KindOne Re: raw embedded if ?! - 27/11/18 03:27 AM
https://en.wikichip.org/wiki/mirc/on_events/on_text


https://en.wikichip.org/wiki/mirc/raw_events


You cannot have one event inside of another event.

I guess you want something like this:


Code:
ON *:TEXT:*:?:{

if ( server1 isin $server ) { echo -a $nick usa simosnap }
if ( server2 isin $server ) { whois $nick }

}

raw 311:*:{ echo -a $1- }
Posted By: Anti Re: raw embedded if ?! - 28/11/18 01:31 AM
Originally Posted By: KindOne
https://en.wikichip.org/wiki/mirc/on_events/on_text


https://en.wikichip.org/wiki/mirc/raw_events


You cannot have one event inside of another event.

I guess you want something like this:


Code:
ON *:TEXT:*:?:{

if ( server1 isin $server ) { echo -a $nick usa simosnap }
if ( server2 isin $server ) { whois $nick }

}

raw 311:*:{ echo -a $1- }


yes, I solved this , the events cannot be embedded.

But I have another problem with this code:
Code:

raw 311:*:{

  set $+(%,server,_,$2) $1-
  if (server_name isin $+(%,server,_,$2)) { timer 1 10 msg $2 $read(C:\mIRC\testi\6b.txt) }
  else { timer 1 10 msg $2 $read(C:\mIRC\testi\6-skype.txt) }
}



This piece of code execure ever else statement , and not if. And I don't understand why.

$2 is the nick_name of the user.
Excuse me per my ignorance, but I amn't expert with
mIRC scripting.

Thanks for you help


Posted By: maroon Re: raw embedded if ?! - 28/11/18 01:50 AM
You are simply appending things together to create a text string which happens to begin with a percent sign, and not checking the contents of the variable. It's the difference between:

Code:
//if (       $+($,version)    > 7) echo -a match | else echo -a not match $v1 vs $v2
vs
//if ( $eval($+($,version),2) > 7) echo -a match $v1 vs $v2



People sometimes use $() in place of $eval() but that can be a little harder to read.
Posted By: Anti Re: raw embedded if ?! - 28/11/18 09:59 PM

Thank you for your answer.

What is the difference between $eval , $ and [[]] .
It's the same or there is some difference ?

In the mIRC help this isn't explained.


Posted By: maroon Re: raw embedded if ?! - 29/11/18 12:14 AM
A good read.
https://en.wikichip.org/wiki/mirc/variables
Posted By: hixxy Re: raw embedded if ?! - 04/12/18 08:12 PM
Originally Posted By: Anti
Originally Posted By: KindOne
https://en.wikichip.org/wiki/mirc/on_events/on_text


https://en.wikichip.org/wiki/mirc/raw_events


You cannot have one event inside of another event.

I guess you want something like this:


Code:
ON *:TEXT:*:?:{

if ( server1 isin $server ) { echo -a $nick usa simosnap }
if ( server2 isin $server ) { whois $nick }

}

raw 311:*:{ echo -a $1- }


yes, I solved this , the events cannot be embedded.

But I have another problem with this code:
Code:

raw 311:*:{

  set $+(%,server,_,$2) $1-
  if (server_name isin $+(%,server,_,$2)) { timer 1 10 msg $2 $read(C:\mIRC\testi\6b.txt) }
  else { timer 1 10 msg $2 $read(C:\mIRC\testi\6-skype.txt) }
}



This piece of code execure ever else statement , and not if. And I don't understand why.

$2 is the nick_name of the user.
Excuse me per my ignorance, but I amn't expert with
mIRC scripting.

Thanks for you help




You can use this instead:

If (server_name isin $1-) { ... }

No need to check the variable you have just set to $1- as $1- is still available.

Also, unless you know exactly what the contents of the text file you are trying to read are going to be, you should use the ‘n’ flag in $read() as otherwise there is a danger that mIRC will evaluate the contents.

$read(...,n)

There is a double-danger in your code as you’re using /timers, which evaluate everything twice. So you should use $!read(...,n) as this will prevent any evaluation problems.
© mIRC Discussion Forums