mIRC Home    About    Download    Register    News    Help

Topic Options
#264403 - 27/11/18 03:06 AM raw embedded in ON event
Anti Offline
Ameglian cow

Registered: 06/03/15
Posts: 20
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 ?



Edited by Anti (27/11/18 03:23 AM)

Top
#264404 - 27/11/18 03:27 AM Re: raw embedded if ?! [Re: Anti]
KindOne Offline
Fjord artisan

Registered: 23/02/11
Posts: 306
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- }
_________________________
irc.swiftirc.net #msl (mIRC Scripting Language)

Top
#264420 - 28/11/18 01:31 AM Re: raw embedded if ?! [Re: KindOne]
Anti Offline
Ameglian cow

Registered: 06/03/15
Posts: 20
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




Edited by Anti (28/11/18 01:34 AM)

Top
#264421 - 28/11/18 01:50 AM Re: raw embedded if ?! [Re: Anti]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 966
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.

Top
#264439 - 28/11/18 09:59 PM Re: raw embedded if ?! [Re: maroon]
Anti Offline
Ameglian cow

Registered: 06/03/15
Posts: 20

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.




Edited by Anti (28/11/18 10:00 PM)

Top
#264441 - 29/11/18 12:14 AM Re: raw embedded if ?! [Re: Anti]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 966

Top
#264482 - 04/12/18 08:12 PM Re: raw embedded if ?! [Re: Anti]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2875
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.

Top