mIRC Home    About    Download    Register    News    Help

Print Thread
#186114 17/09/07 06:53 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
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

pouncer #186115 17/09/07 07:02 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
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.

pouncer #186116 17/09/07 07:06 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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>
}

hixxy #186119 17/09/07 07:39 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
ah i see, thanks hixxy for the code


Link Copied to Clipboard