mIRC Home    About    Download    Register    News    Help

Print Thread
#149175 14/05/06 08:29 PM
Joined: Sep 2005
Posts: 116
I
Vogon poet
OP Offline
Vogon poet
I
Joined: Sep 2005
Posts: 116
i dont fully understnads the submenu but anyway..

wut im trying todo is create a menu to show a overviuew of all channels that have been added to my script ad the parematers of witch they have been added

not thae number of channels is verry dynamicly so. so winder if any1 know a way to make the number of menu items dynamicly

of course i could put in a $iif for each seperated channel but since it can iether be 0 or 1 or 100 for exanple its a bad idea

i wonder i i could make a small while loop that would sort of return menu lines ?

#149176 15/05/06 12:56 AM
Joined: Dec 2002
Posts: 417
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
if you are talking about dialog window menues.

The command structure is simular to the dialog commands for the event triggers for sclick, edit and menu

on *:dialog:DTABLE:menu:#: { command }




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
#149177 15/05/06 06:18 PM
Joined: Sep 2005
Posts: 116
I
Vogon poet
OP Offline
Vogon poet
I
Joined: Sep 2005
Posts: 116
actuialy i mean basic menu's

menu channel { }

#149178 15/05/06 07:25 PM
Joined: Dec 2002
Posts: 417
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
then you would right the code like you would for the nicklist
But you will have to specify the nick if you plan on using any codes that will target a nick, and you have to add them to the proper window menu in popups

You can make just about any code work in the channel menu like this

Code:
 

Mrc Loader
.Load:/load -rs [ $$hfile="Enter the Mrc to Load..." $mircdir\*.mrc ] 
.-
.UnLoad:/unload -rs [ $$hfile="Enter the Mrc to UnLoad..." $mircdir\*.mrc ] 
.-
.Run:/run [ $$hfile="Enter the file to run..." $mircdir\*.* ] 

 


Now if you are adding a channel menu to a script you can use codes like this. so they do not have to be written into the Remote Popup Channel

Code:
  

menu channel {
  Mrc Loader
  .Load:/load -rs [ $$hfile="Enter the Mrc to Load..." $mircdir\*.mrc ] 
  .-
  .UnLoad:/unload -rs [ $$hfile="Enter the Mrc to UnLoad..." $mircdir\*.mrc ] 
  .-
  .Run:/run [ $$hfile="Enter the file to run..." $mircdir\*.* ] 
}




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
#149179 15/05/06 07:36 PM
Joined: Sep 2005
Posts: 116
I
Vogon poet
OP Offline
Vogon poet
I
Joined: Sep 2005
Posts: 116
well i got a gic and good working channel menu already

the thing is

inside the channel menu u can choose addchannel (to add a channel to my script)

u can acutaly config my entire plugin try the menu but now coems the hard part

if i got like 5 channels added i go to voiw that channel menu for each seperated channel in mirc to find witch 5 i got added :tongue:

i thoghu it would be 1337 to have a channellist -> channel1 channel2 channel3

but that number of channels is dynamic lso the names and stuff so it has tobe a dynamic menu..

#149180 15/05/06 08:08 PM
Joined: Dec 2002
Posts: 417
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
This is a version of what I use for the channel menu for adding, removing and joining multi channels from the channel menu

Code:
 
Channel Menu
.Auto Join : autoj
.-
.Add Auto Join Channel # : {
  if ( %autojoin1 == $null ) { set %autojoin1 1. # | goto end }
  if ( %autojoin2 == $null ) { set %autojoin2 2. # | goto end }
  if ( %autojoin3 == $null ) { set %autojoin3 3. # | goto end }
  if ( %autojoin4 == $null ) { set %autojoin4 4. # | goto end }
  if ( %autojoin5 == $null ) { set %autojoin5 5. # | goto end }
  else { echo 1 »14»15»12 You have too many channels in your channel list | halt }
  :end
  echo 1 »14»15» 4 # 12has been added to your channel list.
}
.Join Auto Set Channel
..%autojoin1:join $remove(%autojoin1,1. )
..%autojoin2:join $remove(%autojoin2,2. )
..%autojoin3:join $remove(%autojoin3,3. )
..%autojoin4:join $remove(%autojoin4,4. )
..%autojoin5:join $remove(%autojoin5,5. )
.Unset Auto Join Channel
..%autojoin1:unset %autojoin1 
..%autojoin2:unset %autojoin2 
..%autojoin3:unset %autojoin3
..%autojoin4:unset %autojoin4 
..%autojoin5:unset %autojoin5 
 




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
#149181 16/05/06 01:11 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Here is a simple example of a dynamic menu using $submenu and is related to channels so you get a better idea of whats going on.
Code:
menu channel {
  demonstration
  .$submenu($demo($1,$chan))
}
alias demo {
  //echo -st demo $1-
  if ($1 == begin) { return - } 
  if ($1 == end)   { return - }
  if ($chan($1)) {
    if ($chan($1) == $2) { return Users $right($calc(10000 + $nick($chan($1),0)),4) $chan($1) $chr(9) Active Channel : democommand $chan($1) }
    else                 { return Users $right($calc(10000 + $nick($chan($1),0)),4) $chan($1) : democommand $chan($1) }
  }
}
alias democommand {
  //echo -t $1 DemoCommand tripped for this channel
}


what happens when $submenu($demo($1,$chan)) is encountered during the right click menu building process is the following
(1) $demo($1,$chan) is called as an identifier, $1has been loaded with the word "begin" $chan is the channel you called it from
(2) $demo($1,$chan) well then be called with $1 containing "1" then "2" then "3" etc up to 250 OR untill $demo returns nothing.
(3) $demo($1,$chan) is lastely called with $1 containing "end"
Now what ever you return from this identifier is used as the menu name and command
Please note that I included the active $chan to be passed to the $demo identifier becuase I wanted to, not becuase it was needed to be, only the $1 is needed

ok so whats the $demo do?
if its "begin" or "end" i return "-" because I want line seprators in my menu, if u dont want them then return $null
if its a number first i check if $chan(number) is a channel, and if it is, then i check if that channel name is $2 (aka $chan i passed it), and if so i return the users in channel the channel name, a tab and the words active channel THEN the : and THEN the command im going to call and the parameters to the command
if it wasnt the active channel i return the same just minus the tab and words active channel

just so your clear heres an example assuming 4 channels #qwerty #asdfgh #zxcvbn #poiuyt and that im in #asdfgh when i right click.
Code:
$demo($1,$chan) => $demo(begin,#asdfgh) => return -
$demo($1,$chan) => $demo(1,#asdfgh)     => return Users 0123 #qwerty : democommand #qwerty
$demo($1,$chan) => $demo(2,#asdfgh)     => return Users 0987 #asdfgh <tab> Active Channel : democommand #asdfgh
$demo($1,$chan) => $demo(3,#asdfgh)     => return Users 0234 #zxcvbn : democommand #zxcvbn
$demo($1,$chan) => $demo(4,#asdfgh)     => return Users 0876 #poiuyt : democommand #poiuyt
$demo($1,$chan) => $demo(5,#asdfgh)     => return
$demo($1,$chan) => $demo(end,#asdfgh)   => return -


PS: i left the line //echo -st demo $1- in so when ever you right click you can see in the status window exactly what is being sent to $demo for evaluation into a reply :-)

So just to sume up a $submenu($id($1)) well called $id with $1 in it being "begin" "1" "2" "3" upto "250" then "end", what you return from that $id is your submenu, it might be about channles it might be about $snick could be anything really.


Link Copied to Clipboard