mIRC Home    About    Download    Register    News    Help

Print Thread
#162656 21/10/06 06:15 AM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
I have repsond script but there is something i can't find out.
I have this in my code:
Code:
 if (ik isin $strip($1-)) || (mij isin $strip($1-)) { 
 


BUT.... when ik or mij are part of words( bike or like ) it also responds and that is not what i wanted.
how do i set ik and mij to be one word and not part of a word?

#162657 21/10/06 06:52 AM
Joined: Oct 2006
Posts: 15
S
syr Offline
Pikka bird
Offline
Pikka bird
S
Joined: Oct 2006
Posts: 15
try this
if (ik == $strip($1-)) || (mij == $strip($1-)) {

#162658 21/10/06 11:11 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Quote:
I have repsond script but there is something i can't find out.
I have this in my code:
Code:
 if (ik isin $strip($1-)) || (mij isin $strip($1-)) { 
 


BUT.... when ik or mij are part of words( bike or like ) it also responds and that is not what i wanted.
how do i set ik and mij to be one word and not part of a word?


Code:
on *:text:*:#:{
  if (ik iswm $strip($matchtok($1-,ik,1,32))) { cmd }
}


$matchtok will find a perfect single match for $v1 this is one of the several methods of doing it. So bike wouldnt return nothing while Bike this Hike because ik said so. would return a match @ token 5 only even though that Bike and Hike have Ik in it.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#162659 21/10/06 11:28 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
That's unnecessarily longwinded.

You can just use:

if ($istok($strip($1-),ik,32)) { ... }


--> returns $true if an occurance of "ik" is found, delimited by spaces
--> returns $false in all other cases

Or you could use the following to cater for both "ik" and "mij":

if ($regex($1-,/(?<= |^)(?:ik|mij)(?= |$)/Si)) { ... }


If this event will only have code related to this match, then you could move the regex code (with a slight modification) to the matchtext of the event, and use the $ event prefix.

on $*:text:/(?<= |^)(ik|mij)(?= |$)/Si:#: code


Gone.

Link Copied to Clipboard