Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ windowmenu sub-menus

windowmenu sub-menus

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #15 on Sun 17 Oct 2010 10:11 PM (UTC)
Message
These are not necessarily Lua functions (they use COM to be compatible with all scripting languages).

However if you were prepared for only Lua to have this second value, yes that could be done.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #16 on Tue 19 Oct 2010 08:19 PM (UTC)
Message
Modified in version 4.65 to return a number if the first character of the string is the "!" character. This is compatible with all scripting languages and is the simplest to implement.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Mr.lundmark   (51 posts)  Bio
Date Reply #17 on Sat 23 Oct 2010 07:22 AM (UTC)
Message
Return a number? Is the number the index in the first list or the second list? Or will there be any way to get both indices?
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #18 on Sat 23 Oct 2010 07:48 AM (UTC)
Message
http://www.gammon.com.au/scripts/showrelnote.php?version=4.65&productid=0

Point 6.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Mr.lundmark   (51 posts)  Bio
Date Reply #19 on Sat 23 Oct 2010 12:06 PM (UTC)
Message
Awesome! Thanks!
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #20 on Sat 23 Oct 2010 02:12 PM (UTC)
Message
Nick Gammon said:

These are not necessarily Lua functions (they use COM to be compatible with all scripting languages).

However if you were prepared for only Lua to have this second value, yes that could be done.

Oh I see. Yeah, that wouldn't be fair to other languages.
So what happens now if you want your menu option to start with "!"?

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #21 on Sat 23 Oct 2010 05:54 PM (UTC)
Message
Well, I am just me, but I cannot really think of any good reason to start a menu item with a !. Can you?
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #22 on Sat 23 Oct 2010 07:20 PM (UTC)

Amended on Sat 23 Oct 2010 07:21 PM (UTC) by Nick Gammon

Message
Fiendish said:

So what happens now if you want your menu option to start with "!"?


See:

http://www.gammon.com.au/scripts/doc.php?function=WindowMenu

WindowMenu docs said:

WARNING - we reserve non alpha-numeric characters in the first position of each item for future expansion. For example, perhaps in future versions "*Equip" might be used to tick the Equip item.


I have reserved those characters for future use in cases such as this.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #23 on Sat 23 Oct 2010 07:41 PM (UTC)
Message
Hmm... So what if we want to tick the first item and use the index-based return value? That would take up two positions. Maybe it should be something more like this?

"! | *first item"

If the first item starts with !, just enable the flag and drop that item from the list

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #24 on Sat 23 Oct 2010 08:07 PM (UTC)

Amended on Sat 23 Oct 2010 08:08 PM (UTC) by Nick Gammon

Message
Well, ticking isn't implemented, that was an example.

However to answer your question, if the first character is "!" then it is removed, and then the rest of the list treated in the usual way. However the fact that it was there is remembered for the way the results are returned.

Using the "!" in this way however falls within the scope of "reserved characters".

However the current behaviour is sort-of what you suggest anyway, the "!" is removed, so if you wanted to start a submenu, or use a "!" you could then do so.

It doesn't occupy a list position - I have clarified the documentation to make that clear.

[EDIT]

And if you didn't want numeric results, but wanted to use the "!" then you would use: (space) !

The documentation for WindowMenu says "Leading and trailing spaces are removed from each item." - and thus the extra space would not have any effect (apart from defeating the test of "!" in the first position).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #25 on Sat 23 Oct 2010 08:08 PM (UTC)
Message
Nick Gammon said:
It doesn't occupy a list position - I have clarified the documentation to make that clear.

Ahh, okay. Got it.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


73,651 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.