mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In a menu, I want to have a single item as an option if a specific script is loaded, but if it's not loaded, then I want different items listed.
Specifically the items are for /whois & /whowas commands

Pseudo-Code:
menu * {
if $script(who2.mrc) {
whois/whowas who2 $iif($menu == nicklist,$snicks)
}
else {
.whois $iif($menu == nicklist,$iif(!$1,$$?="Nick",$1))
.whowas $$?="Nick"
}
}

Hopefully that's clear enough for someone to show how I can do it as a proper menu item (since that doesn't work as is)

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I think you are looking for the $iif identifier:

Code:
menu * {
  $iif($script(who2.mrc),whois/whowas):who2 $iif($menu == $nicklist,$snick)

  $iif(!$script(who2.mrc),Who)
  .$iif(!$script(who2.mrc),whois):whois $iif($menu == nicklist,$iif(!$1,$$?="Nick",$1))
  .$iif(!$script(who2.mrc),whowas):whowas $$?="Nick"
}


Notice the . and : go OUTSIDE the $iif statement.

-genius_at_work

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks, I knew about the $iif, but wasn't sure if there was a way to use the if/else format rather than multiple $iif's...guess not.

Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
You can use less $iif's
Code:
menu * {
  $iif($script(who2.mrc),whois/whowas):who2 $iif($menu == $nicklist,$snick)
  $iif(!$script(who2.mrc),Who)
  .$iif($menu == nicklist,whois):whois $$?1="Nick"
  .whowas:whowas $$?="Nick"
}

Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Code:
menu * {
  $iif($script(who2.mrc),whois/whowas):who2 $iif($menu == $nicklist,$snick)
  $iif(!$script(who2.mrc),Who)
  .$iif($menu == nicklist,whois):whois $$?1="Nick"
  .whowas:whowas $$?[color:red]1[/color]="Nick"
}

Missed the 1 before

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Why have the 1 in $$?1="Nick"

Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
$$?1 means '$1' is used if it is supplied, if there is no '$1' you are prompted for input.

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
that is very slick, where is that documented?

Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
In /help aliases wink

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Quote:
You can also do $$?1 or $?1 which means try to fill this value with parameter one if it exists. If parameter one doesn't exist, ask for it. In the first case the parameter is necessary for the command to be executed, in the second case it isn't.


Don't feel bad that you were un-aware of it, took me 5 minutes to find it after being told where to look. LOL

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Very nice. I didn't know about that either.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard