英文:
Is that possible to use script to change the preference inside global info
问题
我想使用脚本来更改全局信息中的保存图像首选项。我想在保存图像之前将其更改为“忽略注释”。但是我在手册中没有找到任何有用的信息。如果有人知道如何更改,请告诉我。提前感谢。
陈 ZX
英文:
all:
I'd like to use script to change the preference of Save Image inside Global Info. I'd like to change it to "Ignore the annotation(s)" before saving image. But I didn't find any useful information in the manual. If someone knows how to change it, please let me know. Thanks in advance.
Regards
答案1
得分: 1
正如你所发现的,这些“保存图像”首选参数没有官方支持的脚本接口。然而,有一些未记录的全局标签存储着它们的当前值。可以访问和更改这些全局标签,但是是否能够实际产生期望的结果取决于GMS的版本以及脚本的编写和执行细节。所以请将以下示例作为尝试的一种方式,但请注意在你的特定环境中可能不完全按照你的期望工作。
TagGroup globalTagGroup = GetPersistentTagGroup();
String tagPath = "Private:Save Image:Burn Annotation Option";
Number burnAnnotationOption;
globalTagGroup.TagGroupGetTagAsNumber(tagPath, burnAnnotationOption);
OKDialog("当前保存图像的烧录注释选项: " + burnAnnotationOption);
Number ignoreAnnotationOption = 0;
globalTagGroup.TagGroupSetTagAsNumber(tagPath, ignoreAnnotationOption);
请注意,这个全局标签位于“Private”标题下。通常,读取这些标签以获取内部DM参数的当前设置是足够安全的,但通过设置相关标签来更改这些参数是不受支持且不总是按照期望工作的。
英文:
As you have discovered, there is no officially supported script interface to these Save Image preference parameters. However, there are undocumented global tags that store their current values. One can access and change these global tags, but whether such changes will actually produce the desired result depends on the version of GMS and details of how your script is written and executed. So consider the following example as something to try, but please note that it may not quite work as you wish in your particular context.
TagGroup globalTagGroup = GetPersistentTagGroup();
String tagPath = "Private:Save Image:Burn Annotation Option";
Number burnAnnotationOption;
globalTagGroup.TagGroupGetTagAsNumber(tagPath, burnAnnotationOption);
OKDialog("Current burn annotation option for Save Image: " + burnAnnotationOption);
Number ignoreAnnotationOption = 0;
globalTagGroup.TagGroupSetTagAsNumber(tagPath, ignoreAnnotationOption);
Note that this global tag is under the "Private" heading. Generally, it is safe enough to read such tags to get at the current settings of internal DM parameters, but changing such parameters by setting the associated tag is not supported and does not always work as one would like.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论