mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2012
Posts: 299
Epic Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2012
Posts: 299
My suggestion is to add an extra parameter in scripts when creating a menu, so the syntax can look like this: menu[:number]

When we create new pop-up menus in the "Remote" tab, then there is no way to select a specific row location for the newly created item.

For example:
Code
menu channel {
  New item: Command
}

In this case, this "New item" will be installed last in the list in the pop-up menu, and only after all items that have been created in the "Popups -> View/Channel" tab.


When implementing my idea it will be possible to embed the line (or several lines at once) "New item" in to the specified place in the pop-up menu.

In this example, all new items should be inline at position "5" in the menu list:
Code
menu:5 channel {
  New item 1: Command
  New item 2: Command
}


    [Linked Image from i.ibb.co]


Note: This should not affect the backward compatibility of previously created scripts without this parameter. The new parameter should only serve to enhance writing scripting capabilities, as an add-on (at choice).




🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
It seems to me like $submenu already does this. As far as position, what if all scripts want their position to be 5th, or 1st?

Joined: Jan 2012
Posts: 299
Epic Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2012
Posts: 299
As far as I know, the identifier "$submenu" works a little differently than the requested parameter. It makes it possible to arrange the order of only submenu items and will not help to set the item to the desired line menu.
But if such a method exists and you can give some good examples (apart from example available in manual) how to use this identifier for what is described above, I would be very grateful.

Regarding the second question, then it is assumed that the developer of scripts will be independently tune (edit) the arrangement of menu items in the order he needs in every single taken script or will use all by default as it works now. Otherwise, in my opinion, the expected and logical behavior will be the determination of the last date of the script creation, and all subsequent scripts with the same parameter will set the item in the menu one line below in descending order of date. Anyway it will not work that all the items can be simultaneously on the same line.

So that, if this idea turns out to be interesting and in demand, then can be pondered here all the difficulties that have arisen and ways of solving.



🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Is there a technical reason that prevents you from changing the order of your scripts? Script order is the only sensible fallback for conflicting positions and that's already how the menu order is decided anyway.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Not a bad idea.

If two menus ask for the positon 5, then the first one will get it the way mIRC currently look for script files order, next one would just get the next available position.
However, consider the case where you have two menus, the first one asking for position 1 but has 3 items, and the second menu asks for position 2, should the second menu items be added at position 2, *breaking* in half the previous menu? Should it generate an error?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I don't think it should be an error for 2 different scripts to both ask for position N in the menu, just like it's not an error for 2 scripts to be loaded to the top script position with /load -rs1

For this feature to work, it very likely needs to have the ability to know what's the current design of the menu. Something like the following being in a menu can change the needed insert position for things beneath it, depending on active conditions:

$iif($1 isop $chan,Label) : command

Something similar to how $script() works, like $menu(nicklist,0) $menu(channel,5)

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
I mentioned generating an error when the menu is not a single item and when inserting at position N could break a menu in half or more, and I specifically said something for the case you're mentioning.

mIRC is generating the menu so it already know what's the exact design of the menu, it's entirely possible for mIRC to modify the order, it's just that the current design makes a lot of sense, and this suggestion, while not a bad idea in itself, doesn't make more sense if any.

I think @OP wants full control of the popups menu of his @window, which is extremely fair, and it's already a big problem when people have menu * { in their script, bloating your own popups menu.
I think to solve this much deeper issue, we need a prefix event for the menu event, which would indicate that if this scripted menu event is the first one to be used to build the popups menu for the @win, then only that popups menu would be used, guaranteeing you that either you get your popups as you want, or else it means there's another menu matching that window name, and you can get rid of it.

Code
menu:! @win {

}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2012
Posts: 299
Epic Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2012
Posts: 299
Originally Posted by Loki12583
Is there a technical reason that prevents you from changing the order of your scripts? Script order is the only sensible fallback for conflicting positions and that's already how the menu order is decided anyway.

Yes, there is at least one reason for this, which is described in another topic #Post268763. If in your list accumulates enough a lot of scripts (and this usually happens with regular creation scripting) then it becomes problematic to search and change the position of scripts every time in order to change the position of items in the created menus. It would be much easier to be able to change this in a newly created script where there is a new menu item.


Originally Posted by Wims
However, consider the case where you have two menus, the first one asking for position 1 but has 3 items, and the second menu asks for position 2, should the second menu items be added at position 2, *breaking* in half the previous menu? Should it generate an error?

In theory, this should not cause error or confusion in the ordering of menu items. In my opinion, it will be logical that the first menu will take the position of items from "1-3", but if the second menu is created (edit) later in time than the first, then its items should be embedded in position "2". All other elements go down below inline elements. (But probably it is possible in other ways to determine the rights of priority).


For example, we have different menus created at different times in two different scripts.

Created in 19:35 - 25/04/2021
Code
menu:1 channel {
  New item 1: Command
  New item 2: Command
  New item 3: Command
}

Created in 14:18 - 27/04/2021
Code
menu:2 channel {
  New item 4: Command
  New item 5: Command
  -
}

Then the menu might look like this:

    [Linked Image from i.ibb.co]


I think that when creating new menus, the autor will be guided preview at the already existing menu, in order to understand exactly where he needs to place the new menu items.
Anyway, I would like to try this in the new beta version to experience and see how it works on practice. Thanks for your questions and interesting comments (for to further thinking reflection).



🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
if the suggestion is to have script priority based on the scriptfile's timestamp, I would be completely against that, considering this would cause havoc any time one of the scripts was edited in another section. Scripts should have their action priority based on their $script(N) order.

Along with the addition of $menu(menutype,N), scripts should be able to figure out what needs to be done, and should be able to play nice with each other.


Link Copied to Clipboard