是否可以在gml文件中使用html标签?

发布于 2024-11-03 17:18:59 字数 72 浏览 2 评论 0原文

有没有办法在 gml 文件中使用 html 锚标记。我想创建一个指向 gml 文件中位置/点的超链接。 我该怎么办? 提前致谢..

is there any way to use html anchor tag in a gml file..I want to create a hyperlink to location/point in a gml file.
how can i do so???
thanks in advance..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绮筵 2024-11-10 17:18:59

这是一种鲜为人知的 GML 技术,它极大地增强了 Game Maker 的功能,非常值得学习,但需要注意的是,它在 Studio 中不起作用,因为对命令有无数的新限制。回到 GM8.1(我现在只用过它),你使用这个技术应该没有问题。

该技术是通过 GML(批处理、vbs 等,或者在本例中为 HTLM)用另一种语言编写程序,通过 GML 执行它,然后删除该程序。

很简单,使用 file_text 命令创建一个具有正确内容和扩展名的文件,使用execute_program 执行它,然后使用file_delete 删除它。

特别针对此脚本:

  • argument0 是链接,包括协议。

  • argument1 是锚点,减去 #(为您处理)。

  • argument2 是完整的浏览器路径。

  • 论据3很重要。这是程序在删除临时链接文件之前等待的时间(以毫秒为单位)。

(即使被告知等待程序完成,execute_program 命令也会在临时文件加载后立即继续。如果是外部的,则重定向需要一些时间,具体取决于您的连接,因此中途删除临时文件将导致它10 毫秒对我来说效果很好。在这个设置中,程序将挂起,但如果您想设置一个基于警报的系统来阻止它挂起,那不会太难。)

在其他用途​​中。在不使用互联网的情况下使用这种技术(我经常使用小批量和 vbs 文件),“挂起时间”(双关语不是双关语)通常是不必要的。

此外,需要针对每台不同的计算机更改浏览器位置

file=file_text_open_write(temp_directory+"\tempLink.html")
file_text_write_string(file,'<!DOCTYPE html>')
file_text_writeln(file)
file_text_write_string(file,'<html>')
file_text_writeln(file)
file_text_write_string(file,'<body onload="')
file_text_write_string(file,"location.href='")
file_text_write_string(file,argument0+"#"+argument1+"';")
file_text_write_string(file,'">')
file_text_writeln(file)
file_text_write_string(file,'</body>')
file_text_writeln(file)
file_text_write_string(file,'</html>')

file_text_close(file)

execute_program(argument2,temp_directory+"\tempLink.html",true)

sleep(argument3)

file_delete(temp_directory+"\tempLink.html")

This is a little known GML technique that GREATLY increases the power of Game Maker, and is well worth learning, but as a note, it does NOT work in Studio, because of the countless new restrictions on commands. Go back to GM8.1 (I only ever use that now), and you should have no problem making use of this technique.

The technique is to write a program in another language through GML (batch, vbs, etc, or in this case, HTLM), execute it through GML, then delete the program.

Quite simply, use the file_text commands to create a file with the correct content and extension, execute it with execute_program, and then delete it with file_delete.

Specifically for this script:

  • argument0 is the link, including the protocol.

  • argument1 is the anchor, minus the # (that's handled for you).

  • argument2 is the full browser path.

  • argument3 is important. This is the time in milliseconds the program will wait before deleting the temporary link file.

(The execute_program command, even when told to wait for the program to complete, continues as soon as the temp file is loaded. If external, the redirect takes some time depending on your connection, so deleting the temporary file halfway through will cause it to fail. 10 milliseconds worked fine for me. The program will hang for this time in this setup, but if you would like to set up an alarm based system to stop it from hanging, that wouldn't be too hard.)

In other uses of this technique without the use of the internet (I use small batch and vbs files a lot), the "hang time" (pun not intended) is usually not necessary.

In addition, the browser location will need to be changed for each different computer

file=file_text_open_write(temp_directory+"\tempLink.html")
file_text_write_string(file,'<!DOCTYPE html>')
file_text_writeln(file)
file_text_write_string(file,'<html>')
file_text_writeln(file)
file_text_write_string(file,'<body onload="')
file_text_write_string(file,"location.href='")
file_text_write_string(file,argument0+"#"+argument1+"';")
file_text_write_string(file,'">')
file_text_writeln(file)
file_text_write_string(file,'</body>')
file_text_writeln(file)
file_text_write_string(file,'</html>')

file_text_close(file)

execute_program(argument2,temp_directory+"\tempLink.html",true)

sleep(argument3)

file_delete(temp_directory+"\tempLink.html")
柳絮泡泡 2024-11-10 17:18:59

抱歉我希望这是可能的,但除非你想花很多时间在 dll 上,否则这是不可能的。但是您可以创建一个脚本并在代码中的任何地方重用它...

script0(argument0,argument1...)

Sorry I wish It was possible but it's not unless you want to spend a lot of time with dll's. BUT you can create a Script and reuse it everywhere in your code...

script0(argument0,argument1...)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文