mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 580
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
First off, I love this suggestion. I have a few more ideas regarding menus...

First, a new identifer $menuselect. It would return the text of the menu item selected. Here is an example of why... My connect event changes a list, I call "recent servers". If a popup menu is created before changing this list, yet my selection occurs after changing this, the menu selection will most likely be invalid. Parsing a $menutext identifer would fix this problem.
Code:
; For the sake of example here, $menuselect equals "irc.irc.net 6667".
; since $svrname and $svrport could change between popup creation,
; and selection of menu item, use $menuselect instead
menu RecentServers {
  $iif($isrecent(1), $svrname(1) $svrport(1)):{ server $menuselect }
}


Second and best shown with code...
Code:
; Get rid of
menu status {
  Animal
  .$submenu($animal($1))
}
alias animal {
  if ($1 == begin) return -
  if ($1 == 1) return Cow:echo Cow
  if ($1 == 2) return Llama:echo Llama
  if ($1 == end) return -
}


Code:
; In favor of
menu status {
  Animal
  .$submenu(animal)
}
menu animal {
  Cow:echo Cow
  Llama:echo Llama
}

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Regarding the second suggestion... huh? The whole purpose of $submenu() is dynamic menus (menus with a dynamic number of items), how would your suggestion accomplish that?


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Dec 2002
Posts: 580
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
I see your reasoning, although such abilities already exists using $iif

This example menu item is only added to the menu if connected ($connected just checks $status for a status of connected and returns $true or $false)
Code:
menu test {
$iif($connected == $true, Disconnect):disconnect
}


NaquadaBomb
www.mirc-dll.com
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
$iif() (or any other method) won't help with cases where the total number of menu items is not known. A popular example is this: create a (sub)menu with all log files currently in $logdir, so that the user can click on an item and view the file in an editor:
Code:
menu status {
  Logs
  .$submenu($logsmenu($1))
}
alias logsmenu {
  if $1 == begin {
    close -@ @@ | window -hsl @@
    halt $findfile($logdir,*,0,1,@@)
  }
  if $line(@@,$1) { return $nopath($v1) : run notepad $+(",$v1,") }
  window -c @@
}

There is simply no way of doing this with $iif().


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Dec 2002
Posts: 580
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
I'll conceed keeping existing support... Although, both methods could be supported. If $1 is not an identifer then it's a menu. smile


NaquadaBomb
www.mirc-dll.com

Link Copied to Clipboard