|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Mon Jan 05, 2009 6:23 pm
[3.03a] Is %window func acts as designed? |
From the help:
Syntax: %window(name)
Return true if the specified window name is currently open.
Code: |
#WIN "Test"
#PRINT %window("TestA")
#PRINT %window("Test")
#PRINT %window("Tes")
#PRINT %window("Te")
#PRINT %window("T")
#PRINT %window("")
|
Output:
0
1
1
1
1
0 |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Jan 05, 2009 8:49 pm |
I believe it is... although it may not quite be what you would expect.
The behavior is consistent with both CMUD 2.37 and zMUD 7.21 (which is expected since the function has been around for some time. The thing is that the function doesn't do an exact match, so if you provide a string and the string is the starting portion of a window name then it will return true.
It's debatable if it should be the behavior. I'll start a poll and let Zugg decide. Since it's pretty old changing it may break compatibility with old scripts which does reduce the likelihood he'll want to change it. |
|
_________________ Asati di tempari! |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jan 05, 2009 10:36 pm |
Yes, it's a left-over for zMUD compatibility. Window names have always allowed partial matches. In your example, you have always been able to do:
t:hello
to send something to whatever window starts with a "t" (like "test"). |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Mon Jan 05, 2009 11:31 pm |
Thanks for your explanations. And yes, it is not what I would expect... although I can live with it.
Tech, could you add a note to the help topic instead of a poll? |
|
_________________ My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads |
|
|
|
|
|