mIRC Home    About    Download    Register    News    Help

Print Thread
#65008 23/12/03 06:33 PM
Joined: Dec 2003
Posts: 10
A
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2003
Posts: 10
Okay, I've sorta modified the slap to allow the user to select his/her weapon. The command looks like this:
Code:
 Slap!:/me slaps $$1 around a bit with a $$?="Weapon?" $+ . 


However, if I were to put somthing like 'apple' the result is:
/me slaps Bob around a bite with a apple.

I want the script to automatically determine whether to use 'a' or 'an' depending on what the user enters.

Any ideas?

#65009 23/12/03 06:58 PM
Joined: Nov 2003
Posts: 227
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
Code:
Slap:{
  .echo -q $$?="Weapon" 
  me slaps $$1 around a bit with $iif($regex($!,^[aeiou]),an,a) $! $+ .
}


the regex is just to check if the input starts with a, e, i, o or u
the ^ means begining with, so the $iif return an if its true and a if not.

#65010 23/12/03 07:26 PM
Joined: Nov 2003
Posts: 227
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
Probably made that more complex than it should have been, and i didnt allow for upper case. probaby better to use
Code:
Slap:{ 
 .echo -q $$?="Weapon"   
me slaps $$1 around a bit with $iif($left($!,1) isin aeiou,an,a) $! $+ .
}


#65011 24/12/03 02:03 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Or just:
Code:
Slap: me slaps $$1 around a bit with $iif($left($$?="Weapon",1) isin aeiou,an,a) $! $+ .


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#65012 24/12/03 06:02 PM
Joined: Dec 2003
Posts: 10
A
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2003
Posts: 10
Wow. Thanks... never really thought of isin...

/me slaps himself around a bit with mIRC's Help file...


Link Copied to Clipboard