更改全局信息中的首选项是否可能使用脚本?

huangapple go评论47阅读模式
英文:

Is that possible to use script to change the preference inside global info

问题

all:
我想使用脚本来更改全局信息中“保存图像”首选项。我想在保存图像之前将其更改为“忽略注释”。但是在手册中我没有找到任何有用的信息。如果有人知道如何更改它,请告诉我。提前致谢。

问候

陈 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

Chen ZX
更改全局信息中的首选项是否可能使用脚本?

答案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.

huangapple
  • 本文由 发表于 2023年8月9日 15:48:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/76865633-2.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定