mIRC Home    About    Download    Register    News    Help

Print Thread
menu question #186114
17/09/07 06:53 PM
17/09/07 06:53 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
pouncer  Offline OP
Hoopy frood
P

Joined: Oct 2005
Posts: 827
I want to add a menu to my

menu nicklist {
}

but i only want it to appear in the menu IF there exists such a dialog called 'userlist2'

is this possible guys? if the dialog doesnt exists i dont want the menu to appear at all

Re: menu question [Re: pouncer] #186115
17/09/07 07:02 PM
17/09/07 07:02 PM
Joined: Dec 2002
Posts: 3,547
Kent, England
S
SladeKraven Offline
Hoopy frood
SladeKraven  Offline
Hoopy frood
S

Joined: Dec 2002
Posts: 3,547
Kent, England
It is possible, but that would involve alot of looping through scripts to see if "dialog userlist2 {" is in any of your scripts. $dialog only returns information about dialogs that are currently open.

Re: menu question [Re: pouncer] #186116
17/09/07 07:06 PM
17/09/07 07:06 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
hixxy  Offline
Hoopy frood
H

Joined: Sep 2005
Posts: 2,876
Code:
alias dialogexists {
  var %i = 1
  while ($script(%i)) {
    if ($read($v1,nr,/^(?:n\d+=)?dialog(?: -l)? $$1 \{$/i)) { return $true }
    inc %i
  }
  return $false
}
on *:start:{ set %userlist2.exists $dialogexists(userlist2) }

menu nicklist {
  $iif(%userlist2.exists,<your menu here>): <command here>
}

Re: menu question [Re: hixxy] #186119
17/09/07 07:39 PM
17/09/07 07:39 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
pouncer  Offline OP
Hoopy frood
P

Joined: Oct 2005
Posts: 827
ah i see, thanks hixxy for the code