Page 1 of 1

Hidden scripts

Posted: 01 Nov 2008 18:33
by jacky
So as it is now we can hide scripts in script files of course, simply by giving them no caption and a label starting with an underscore. I'd like it very much if we could drop the "no caption" part and only make it that if the label starts with an underscore it's hidden, caption or not.

The benefit being that one could have a somewhat big menu on a script file, but only the main items would be shown when loaded, and to load the full menu (or any hidden items) one would have to use command load specifying the items. Would be a much better solution than our current way, which is loading the file loads the entire thing, and to only get the main/most used commands one needs to specify it on the loading command (as so use one, e.g. not possible with Scripting|Load Script File... or Load Selected Script File.

Re: Hidden scripts

Posted: 01 Nov 2008 21:18
by admin
Yo, makes total sense. Done.

Re: Hidden scripts

Posted: 03 Nov 2008 14:09
by jacky
admin wrote:Yo, makes total sense. Done.
Thanks a lot! :D

Little bug there : separators are ignored if they don't come after a visible menu :

Code: Select all

"you see this"
  msg "hi";
"secret : _hidden"
  msg "you don't see this one";
-
"Cancel"
No separator is shown on that one :?

Re: Hidden scripts

Posted: 03 Nov 2008 14:19
by admin
jacky wrote:
admin wrote:Yo, makes total sense. Done.
Thanks a lot! :D

Little bug there : separators are ignored if they don't come after a visible menu :

Code: Select all

"you see this"
  msg "hi";
"secret : _hidden"
  msg "you don't see this one";
-
"Cancel"
No separator is shown on that one :?
Oh yes! Fixed.

Re: Hidden scripts

Posted: 03 Nov 2008 15:14
by jacky
Another thing that'd be nice, on that matter :
we have ::load *; to show "visible" items (of current script file), and we can do ::load *, "label1;-;_label2;label3"; to specify which one we wants, so what would be really nice would be to add support for * as label so ::load *, *; would show all (visible+hidden) items!

Re: Hidden scripts

Posted: 04 Nov 2008 10:36
by admin
jacky wrote:Another thing that'd be nice, on that matter :
we have ::load *; to show "visible" items (of current script file), and we can do ::load *, "label1;-;_label2;label3"; to specify which one we wants, so what would be really nice would be to add support for * as label so ::load *, *; would show all (visible+hidden) items!
Goody, done. 8)

Re: Hidden scripts

Posted: 05 Nov 2008 11:38
by jacky
admin wrote:
jacky wrote:Another thing that'd be nice, on that matter :
we have ::load *; to show "visible" items (of current script file), and we can do ::load *, "label1;-;_label2;label3"; to specify which one we wants, so what would be really nice would be to add support for * as label so ::load *, *; would show all (visible+hidden) items!
Goody, done. 8)
Yep, except that this will now show all scripts, and I wish it would only show items, i.e. those with a caption. Meaning that hidden/internal scripts (i.e. no caption and a label starting with underscore) would remain hidden, because they are usually not meant to be shown/called manually.

Code: Select all

"Smthg : foo"
  msg "foo";
"- : _sep"
"Hidden : _bar"
  sub confirm("Are you sure?") ? "_doIt" : "nothing";
"_doIt"
  msg "bar";
-
"Full menu..."
  load *,*;
"Cancel : nothing"
In that example, script _doIt should not be shown by load *,* because while _sep and _bar are hidden items, _doIt is an hidden/internal script, and isn't meant to ever be manually triggered (or else we'd give it a caption).

Re: Hidden scripts

Posted: 05 Nov 2008 12:58
by admin
jacky wrote:
admin wrote:
jacky wrote:Another thing that'd be nice, on that matter :
we have ::load *; to show "visible" items (of current script file), and we can do ::load *, "label1;-;_label2;label3"; to specify which one we wants, so what would be really nice would be to add support for * as label so ::load *, *; would show all (visible+hidden) items!
Goody, done. 8)
Yep, except that this will now show all scripts, and I wish it would only show items, i.e. those with a caption. Meaning that hidden/internal scripts (i.e. no caption and a label starting with underscore) would remain hidden, because they are usually not meant to be shown/called manually.

Code: Select all

"Smthg : foo"
  msg "foo";
"- : _sep"
"Hidden : _bar"
  sub confirm("Are you sure?") ? "_doIt" : "nothing";
"_doIt"
  msg "bar";
-
"Full menu..."
  load *,*;
"Cancel : nothing"
In that example, script _doIt should not be shown by load *,* because while _sep and _bar are hidden items, _doIt is an hidden/internal script, and isn't meant to ever be manually triggered (or else we'd give it a caption).
Yep, makes sense.