<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.thedarkmod.com/index.php?action=history&amp;feed=atom&amp;title=GUI_Scripting%3A_On_Entity%27s_Surface</id>
	<title>GUI Scripting: On Entity&#039;s Surface - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.thedarkmod.com/index.php?action=history&amp;feed=atom&amp;title=GUI_Scripting%3A_On_Entity%27s_Surface"/>
	<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;action=history"/>
	<updated>2026-04-18T11:09:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;diff=30089&amp;oldid=prev</id>
		<title>Geep: Add category tag</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;diff=30089&amp;oldid=prev"/>
		<updated>2022-11-04T17:35:22Z</updated>

		<summary type="html">&lt;p&gt;Add category tag&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:35, 4 November 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l141&quot;&gt;Line 141:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 141:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* For a visualization of the more interactive surface GUI possible in Doom 3, see [https://jaredemitchell.com/scripting-examples/ this example screenshot from Jared Mitchell].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* For a visualization of the more interactive surface GUI possible in Doom 3, see [https://jaredemitchell.com/scripting-examples/ this example screenshot from Jared Mitchell].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* TDM differs from Doom3 when it comes to handling multiple entity surfaces with gui_parms, because, among other reasons, TDM provides handles. For more about the Doom3 approach, see [https://modwiki.dhewm3.org/doom3world/index.php?thread_id=26461 this post by S@TaNiC, originally on modwiki].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* TDM differs from Doom3 when it comes to handling multiple entity surfaces with gui_parms, because, among other reasons, TDM provides handles. For more about the Doom3 approach, see [https://modwiki.dhewm3.org/doom3world/index.php?thread_id=26461 this post by S@TaNiC, originally on modwiki].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{GUI}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Geep</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;diff=29924&amp;oldid=prev</id>
		<title>Geep: /* For More */</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;diff=29924&amp;oldid=prev"/>
		<updated>2022-10-20T17:30:28Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;For More&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:30, 20 October 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l139&quot;&gt;Line 139:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 139:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==For More==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==For More==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* This article is based on [https://forums.thedarkmod.com/index.php?/topic/21464-gui-on-a-world-object/ this forum thread and greebo&amp;#039;s insights].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* This article is based on [https://forums.thedarkmod.com/index.php?/topic/21464-gui-on-a-world-object/ this forum thread and greebo&amp;#039;s insights].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* For &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;examples &lt;/del&gt;of the more interactive surface GUI possible in Doom 3, see [https://jaredemitchell.com/scripting-examples/ this example screenshot from Jared Mitchell].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* For &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a visualization &lt;/ins&gt;of the more interactive surface GUI possible in Doom 3, see [https://jaredemitchell.com/scripting-examples/ this example screenshot from Jared Mitchell].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* TDM differs from Doom3 when it comes to handling multiple entity surfaces with gui_parms, because, among other reasons, TDM provides handles. For more about the Doom3 approach, see [https://modwiki.dhewm3.org/doom3world/index.php?thread_id=26461 this post by S@TaNiC, originally on modwiki].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* TDM differs from Doom3 when it comes to handling multiple entity surfaces with gui_parms, because, among other reasons, TDM provides handles. For more about the Doom3 approach, see [https://modwiki.dhewm3.org/doom3world/index.php?thread_id=26461 this post by S@TaNiC, originally on modwiki].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Geep</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;diff=29923&amp;oldid=prev</id>
		<title>Geep at 17:27, 20 October 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;diff=29923&amp;oldid=prev"/>
		<updated>2022-10-20T17:27:51Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:27, 20 October 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Basic Technique===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Basic Technique===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Let&amp;#039;s assume your entity is a func_static or derivative; such entities have spawnarg &amp;quot;gui_noninteractive 1&amp;quot; set by default.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Let&amp;#039;s assume your entity is a func_static or derivative; such entities have spawnarg &amp;quot;gui_noninteractive 1&amp;quot; set by default.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To apply your GUI, texture one of your entity&#039;s surfaces with standard material &quot;textures/common/entityGui&quot; (or your customized version of that). After fitting it to the surface with Surface Inspector, this will appear in DR as a blue rectangle with &quot;Entity GUI&quot; text. If you look into the material&#039;s description, you will see it includes a &quot;guisurf entity&quot; attribute. This means that the path to the gui will be found, not in the material definition, but in the entity&#039;s &quot;gui&quot; spawnarg. So add that to the entity. For an example, see&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To apply your GUI, texture one of your entity&#039;s surfaces with standard material &quot;textures/common/entityGui&quot; (or your customized version of that). After fitting it to the surface with Surface Inspector, this will appear in DR as a blue rectangle with &quot;Entity GUI&quot; text. If you look into the material&#039;s description, you will see it includes a &quot;guisurf entity&quot; attribute. This means that the path to the gui will be found, not in the material definition, but in the entity&#039;s &quot;gui&quot; spawnarg. So add that to the entity. For an example, see the cutscene_video material discussed in the Movie Theatre method of [[Full-Screen Video Cutscenes]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &lt;/del&gt;the cutscene_video material discussed in the Movie Theatre method of [[Full-Screen Video Cutscenes]].&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;At runtime, when the entity is spawned, its GUI is autoloaded.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;At runtime, when the entity is spawned, its GUI is autoloaded.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Ensuring the Fit===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Ensuring the Fit===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;As mentioned, after applying &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;GUi &lt;/del&gt;texture, be sure to use &quot;Fit&quot; in DR&#039;s Surface Inspector. Also, if you fit the texture and later resize the entity, be sure to re-fit the GUI texture. Surprisingly, if you make the entity smaller and don&#039;t refit, the texture rectangle will retain its original world size, exceeding the face of the entity. This will not be very evident in DR (except for the effect on a subtle brown border around the blue Entity GUI), but at runtime.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;As mentioned, after applying &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;GUI &lt;/ins&gt;texture, be sure to use &quot;Fit&quot; in DR&#039;s Surface Inspector. Also, if you fit the texture and later resize the entity, be sure to re-fit the GUI texture. Surprisingly, if you make the entity smaller and don&#039;t refit, the texture rectangle will retain its original world size, exceeding the face of the entity. This will not be very evident in DR (except for the effect on a subtle brown border around the blue Entity GUI), but at runtime.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Multiple GUIs or Custom GUI Materials===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Multiple GUIs or Custom GUI Materials===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l24&quot;&gt;Line 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(If your entity is a func_static or derivative, in DR&amp;#039;s Entity Inspector, selecting a &amp;quot;gui&amp;quot; spawnarg will give you a hint about these 3.)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(If your entity is a func_static or derivative, in DR&amp;#039;s Entity Inspector, selecting a &amp;quot;gui&amp;quot; spawnarg will give you a hint about these 3.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Alternatively, a custom material may directly specify the GUI with form &amp;quot;guisurf &amp;lt;guifile&amp;gt;&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Alternatively, a custom material may directly specify the GUI with form &amp;quot;guisurf &amp;lt;guifile&amp;gt;&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==For Model-Based Entities==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==For Model-Based Entities==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l58&quot;&gt;Line 58:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 58:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Now, say you want to alter the foregoing example so the visibility change happens, not on a fixed schedule, but instead every time you frob the object.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Now, say you want to alter the foregoing example so the visibility change happens, not on a fixed schedule, but instead every time you frob the object.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;IMPORTANT: For frob highlighting, an &quot;Entity GUI&quot; surface will appear non-existent , so knowing if the object&#039;s ready to frob can be tricky. When in doubt here, frob on one of the opaque sides instead, or (in 2.10) test with cvar &quot;r_frobOutline 2&quot; (TDM generally has separate objects to frob and to hold the &quot;Entity GUI&quot;, which solves this.)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;IMPORTANT: For frob highlighting, an &quot;Entity GUI&quot; surface will appear non-existent , so knowing if the object&#039;s ready to frob can be tricky. When in doubt here, frob on one of the opaque sides instead, or (in 2.10) test with cvar &quot;r_frobOutline 2&quot; (&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Even better, &lt;/ins&gt;TDM generally has separate objects to frob and to hold the &quot;Entity GUI&quot;, which solves this&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. For instance, see [[GUI Scripting: Sign Text Example]]&lt;/ins&gt;.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To your wall entity, add a standard spawnarg frob_action_script, with the name of a new script function (called &amp;quot;onFrob&amp;quot; here) placed in one of your FM&amp;#039;s .script files. The frob_action_script mechanism requires a void-returning function. So to get data back from the function, invent a GUI state variable &amp;quot;is_visible&amp;quot;. This is referenced in your .gui with a &amp;quot;gui::&amp;quot; prefix, and in your .script using standard TDM script function calls setGui... or getGui... Thus, this solution from greebo:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To your wall entity, add a standard spawnarg frob_action_script, with the name of a new script function (called &amp;quot;onFrob&amp;quot; here) placed in one of your FM&amp;#039;s .script files. The frob_action_script mechanism requires a void-returning function. So to get data back from the function, invent a GUI state variable &amp;quot;is_visible&amp;quot;. This is referenced in your .gui with a &amp;quot;gui::&amp;quot; prefix, and in your .script using standard TDM script function calls setGui... or getGui... Thus, this solution from greebo:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l138&quot;&gt;Line 138:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 138:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==For More==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==For More==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* This article is based on &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;[https://forums.thedarkmod.com/index.php?/topic/21464-gui-on-a-world-object/ this forum thread and greebo&#039;s insights&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* This article is based on [https://forums.thedarkmod.com/index.php?/topic/21464-gui-on-a-world-object/ this forum thread and greebo&#039;s insights].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* For examples of the more interactive surface GUI possible in Doom 3, see [https://jaredemitchell.com/scripting-examples/ this example screenshot from Jared Mitchell].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* For examples of the more interactive surface GUI possible in Doom 3, see [https://jaredemitchell.com/scripting-examples/ this example screenshot from Jared Mitchell].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* TDM differs from Doom3 when it comes to handling multiple entity surfaces with gui_parms, because, among other reasons, TDM provides handles. For more about the Doom3 approach, see [https://modwiki.dhewm3.org/doom3world/index.php?thread_id=26461 this post by S@TaNiC, originally on modwiki].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* TDM differs from Doom3 when it comes to handling multiple entity surfaces with gui_parms, because, among other reasons, TDM provides handles. For more about the Doom3 approach, see [https://modwiki.dhewm3.org/doom3world/index.php?thread_id=26461 this post by S@TaNiC, originally on modwiki].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Geep</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;diff=29922&amp;oldid=prev</id>
		<title>Geep at 00:57, 20 October 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;diff=29922&amp;oldid=prev"/>
		<updated>2022-10-20T00:57:38Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:57, 20 October 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Title: GUI Scripting: On Entity&#039;s Surface&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;This is a part of a series, whose hub is [[GUI Scripting Language]]&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;This is a part of a series, whose hub is [[GUI Scripting Language]]&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Introduction==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Introduction==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l12&quot;&gt;Line 12:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 11:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Let&amp;#039;s assume your entity is a func_static or derivative; such entities have spawnarg &amp;quot;gui_noninteractive 1&amp;quot; set by default.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Let&amp;#039;s assume your entity is a func_static or derivative; such entities have spawnarg &amp;quot;gui_noninteractive 1&amp;quot; set by default.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To apply your GUI, texture one of your entity&amp;#039;s surfaces with standard material &amp;quot;textures/common/entityGui&amp;quot; (or your customized version of that). After fitting it to the surface with Surface Inspector, this will appear in DR as a blue rectangle with &amp;quot;Entity GUI&amp;quot; text. If you look into the material&amp;#039;s description, you will see it includes a &amp;quot;guisurf entity&amp;quot; attribute. This means that the path to the gui will be found, not in the material definition, but in the entity&amp;#039;s &amp;quot;gui&amp;quot; spawnarg. So add that to the entity. For an example, see:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To apply your GUI, texture one of your entity&amp;#039;s surfaces with standard material &amp;quot;textures/common/entityGui&amp;quot; (or your customized version of that). After fitting it to the surface with Surface Inspector, this will appear in DR as a blue rectangle with &amp;quot;Entity GUI&amp;quot; text. If you look into the material&amp;#039;s description, you will see it includes a &amp;quot;guisurf entity&amp;quot; attribute. This means that the path to the gui will be found, not in the material definition, but in the entity&amp;#039;s &amp;quot;gui&amp;quot; spawnarg. So add that to the entity. For an example, see:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* the cutscene_video material discussed in the Movie Theatre method of [[Full-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;screen_Video_Cutscenes&lt;/del&gt;]].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* the cutscene_video material discussed in the Movie Theatre method of [[Full-&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Screen Video Cutscenes&lt;/ins&gt;]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;At runtime, when the entity is spawned, its GUI is autoloaded.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;At runtime, when the entity is spawned, its GUI is autoloaded.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Geep</name></author>
	</entry>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;diff=29920&amp;oldid=prev</id>
		<title>Geep: create this article</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_On_Entity%27s_Surface&amp;diff=29920&amp;oldid=prev"/>
		<updated>2022-10-20T00:39:11Z</updated>

		<summary type="html">&lt;p&gt;create this article&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Title: GUI Scripting: On Entity&amp;#039;s Surface&lt;br /&gt;
&amp;#039;&amp;#039;This is a part of a series, whose hub is [[GUI Scripting Language]]&amp;#039;&amp;#039;&lt;br /&gt;
==Introduction==&lt;br /&gt;
A mapper can apply a GUI to an entity&amp;#039;s surface, typically a rectangular face. Such a GUI cannot be interactive to the degree possible in Doom 3, because TDM disallows that (e.g., doesn&amp;#039;t show a mouse cursor) in order to improve frobbing. (For more about that, see [[GUI Scripting: Limitations of On-Surface GUIs]].)&lt;br /&gt;
&lt;br /&gt;
Still, as detailed below, you may be able to provide some useful visual effects, driven by gui timer, script timer, or repeated frobbing or external triggering. And non-interactive guis support videos.&lt;br /&gt;
&lt;br /&gt;
If you need to create a selection menu on a surface, that is possible with limitations; see [[GUI Scripting: In-World Menu Examples]]. Alternatively, instead of a surface GUI, cobble the desired functionality from buttons or frobable surfaces, script functions, and entity visibility toggling.&lt;br /&gt;
&lt;br /&gt;
==For Brush-Based Entities==&lt;br /&gt;
===Basic Technique===&lt;br /&gt;
Let&amp;#039;s assume your entity is a func_static or derivative; such entities have spawnarg &amp;quot;gui_noninteractive 1&amp;quot; set by default.&lt;br /&gt;
To apply your GUI, texture one of your entity&amp;#039;s surfaces with standard material &amp;quot;textures/common/entityGui&amp;quot; (or your customized version of that). After fitting it to the surface with Surface Inspector, this will appear in DR as a blue rectangle with &amp;quot;Entity GUI&amp;quot; text. If you look into the material&amp;#039;s description, you will see it includes a &amp;quot;guisurf entity&amp;quot; attribute. This means that the path to the gui will be found, not in the material definition, but in the entity&amp;#039;s &amp;quot;gui&amp;quot; spawnarg. So add that to the entity. For an example, see:&lt;br /&gt;
* the cutscene_video material discussed in the Movie Theatre method of [[Full-screen_Video_Cutscenes]].&lt;br /&gt;
&lt;br /&gt;
At runtime, when the entity is spawned, its GUI is autoloaded.&lt;br /&gt;
===Ensuring the Fit===&lt;br /&gt;
As mentioned, after applying GUi texture, be sure to use &amp;quot;Fit&amp;quot; in DR&amp;#039;s Surface Inspector. Also, if you fit the texture and later resize the entity, be sure to re-fit the GUI texture. Surprisingly, if you make the entity smaller and don&amp;#039;t refit, the texture rectangle will retain its original world size, exceeding the face of the entity. This will not be very evident in DR (except for the effect on a subtle brown border around the blue Entity GUI), but at runtime.&lt;br /&gt;
&lt;br /&gt;
===Multiple GUIs or Custom GUI Materials===&lt;br /&gt;
An entity can actually have up to 3 different &amp;quot;guisurf&amp;quot; materials on its surfaces, with this pairing:&lt;br /&gt;
* &amp;quot;guisurf entity&amp;quot;   (included in textures/common/entityGui)   &amp;amp; &amp;quot;gui&amp;quot;&lt;br /&gt;
* &amp;quot;guisurf entity2&amp;quot; (included in textures/common/entityGui2) &amp;amp; &amp;quot;gui2&amp;quot;&lt;br /&gt;
* &amp;quot;guisurf entity3&amp;quot; (included in textures/common/entityGui3) &amp;amp; &amp;quot;gui3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
(If your entity is a func_static or derivative, in DR&amp;#039;s Entity Inspector, selecting a &amp;quot;gui&amp;quot; spawnarg will give you a hint about these 3.)&lt;br /&gt;
Alternatively, a custom material may directly specify the GUI with form &amp;quot;guisurf &amp;lt;guifile&amp;gt;&amp;quot;.&lt;br /&gt;
==For Model-Based Entities==&lt;br /&gt;
The foregoing described a simple brush-derived entity. If the entity is based on a model (like a sign plaque), the usual approach is to pair it with an abutting &amp;quot;decal&amp;quot;, a patch turned into a func_static which then becomes the real entity to which the gui-related spawnargs are applied. If you intend to reuse this pairing, you can export it as a prefab.&lt;br /&gt;
&lt;br /&gt;
For details, in the context of a &amp;quot;text decal&amp;quot;, see [[Text Decals for Signs etc.# Customising and Making your Own]].&lt;br /&gt;
==Example of a Timed Visual Effect==&lt;br /&gt;
Suppose you have a simple func_static wall with some overall opaque texture. And you want to change one surface to flash alternatively between bright green and invisible. So, as above:&lt;br /&gt;
* Put an &amp;quot;Entity GUI&amp;quot; on the desired face.&lt;br /&gt;
* In your /guis/ folder, create a greenflash.gui file (as below), and add a &amp;quot;gui&amp;quot; spawnarg to your wall to point to it, e.g. &amp;quot;gui guis/greenflash.gui&amp;quot; &lt;br /&gt;
* You could also give the wall a spawnarg override &amp;quot;gui_noninteractive 0&amp;quot;, though it doesn&amp;#039;t seem to make a difference.&lt;br /&gt;
&lt;br /&gt;
Here&amp;#039;s a greenflash.gui file that flashes every second:  &lt;br /&gt;
 windowDef mygreenflash {&lt;br /&gt;
   rect 0, 0, 640, 480&lt;br /&gt;
   backcolor 0,1,0,1  // green&lt;br /&gt;
   visible 1&lt;br /&gt;
   notime 0&lt;br /&gt;
 &lt;br /&gt;
   onTime 0 {&lt;br /&gt;
     set &amp;quot;visible&amp;quot; &amp;quot;0&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   onTime 1000 {&lt;br /&gt;
     set &amp;quot;visible&amp;quot; &amp;quot;1&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   onTime 2000 {&lt;br /&gt;
     resetTime 0;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Example of a Frob-Driven Visual Effect==&lt;br /&gt;
Now, say you want to alter the foregoing example so the visibility change happens, not on a fixed schedule, but instead every time you frob the object.&lt;br /&gt;
&lt;br /&gt;
IMPORTANT: For frob highlighting, an &amp;quot;Entity GUI&amp;quot; surface will appear non-existent , so knowing if the object&amp;#039;s ready to frob can be tricky. When in doubt here, frob on one of the opaque sides instead, or (in 2.10) test with cvar &amp;quot;r_frobOutline 2&amp;quot; (TDM generally has separate objects to frob and to hold the &amp;quot;Entity GUI&amp;quot;, which solves this.)&lt;br /&gt;
&lt;br /&gt;
To your wall entity, add a standard spawnarg frob_action_script, with the name of a new script function (called &amp;quot;onFrob&amp;quot; here) placed in one of your FM&amp;#039;s .script files. The frob_action_script mechanism requires a void-returning function. So to get data back from the function, invent a GUI state variable &amp;quot;is_visible&amp;quot;. This is referenced in your .gui with a &amp;quot;gui::&amp;quot; prefix, and in your .script using standard TDM script function calls setGui... or getGui... Thus, this solution from greebo:&lt;br /&gt;
&lt;br /&gt;
 windowDef mygreenflash {&lt;br /&gt;
   rect 0, 0, 640, 480&lt;br /&gt;
   backcolor 0,1,0,1&lt;br /&gt;
   visible &amp;quot;gui::is_visible&amp;quot;&lt;br /&gt;
   notime 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;visible property&amp;quot; is now bound to the is_visible GUI state variable. Which is &amp;quot;0&amp;quot; by default, so the green window starts out hidden. The script toggles the visibility by inverting the state flag: &lt;br /&gt;
&lt;br /&gt;
 void onFrob(entity me)&lt;br /&gt;
 {&lt;br /&gt;
   sys.println(&amp;quot;frobbed&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
   // Invert the is_visible variable that is bound to the visible property of the mygreenflash window&lt;br /&gt;
   me.setGuiInt(1, &amp;quot;is_visible&amp;quot;, 1 - me.getGuiInt(1, &amp;quot;is_visible&amp;quot;));&lt;br /&gt;
   // Note: The first argument &amp;quot;1&amp;quot; refers to the first entity GUI as defined by the &amp;quot;gui&amp;quot; &amp;quot;guis/greenflash.gui&amp;quot; spawnarg&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The boolean inversion line is just a concise way to do:&lt;br /&gt;
   if(me.getGuiInt(1, &amp;quot;is_visible&amp;quot;) == 0) {&lt;br /&gt;
     me.setGuiInt(1, &amp;quot;is_visible&amp;quot;, 1);&lt;br /&gt;
   } else {&lt;br /&gt;
     me.setGuiInt(1, &amp;quot;is_visible&amp;quot;, 0);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
==Another Example of a Frob-Driven Visual Effect, with Transitions==&lt;br /&gt;
For the GUI, the foregoing binding solution is elegant, but not always possible. In this example, two overlapping background figures (stock images from tdm_gui01.pk4\dds\guis\assets\mainmenu) are alternatively faded in and out on each frob, using &amp;quot;transition&amp;quot; statements instead of &amp;quot;visible&amp;quot;. The onFrob function is changed to simply:&lt;br /&gt;
&lt;br /&gt;
 void onFrob(entity me) {&lt;br /&gt;
   sys.println(&amp;quot;frobbed&amp;quot;);&lt;br /&gt;
   me.setGuiInt(1, &amp;quot;frobbed&amp;quot;, 1); // Pulse the frobbed variable. GUI will reset it.&lt;br /&gt;
   // Note: The first argument &amp;quot;1&amp;quot; refers to the first entity GUI as defined by the &amp;quot;gui&amp;quot; &amp;quot;guis/test.gui&amp;quot; spawnarg&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
A helper variable whichbackground is added. This could easily be expanded to more that two images.&lt;br /&gt;
&lt;br /&gt;
 windowDef swapbackgrounds {&lt;br /&gt;
   rect 0, 0, 640, 480&lt;br /&gt;
   visible 1&lt;br /&gt;
   backcolor 0,0,0,1&lt;br /&gt;
   notime 0&lt;br /&gt;
   float whichbackground 0 // Only init to zero supported&lt;br /&gt;
 &lt;br /&gt;
   windowDef background0 {&lt;br /&gt;
     rect 160, 120, 320, 240&lt;br /&gt;
     matcolor 1,1,1,1&lt;br /&gt;
     background &amp;quot;guis/assets/mainmenu/sidefigure1&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   windowDef background1 {&lt;br /&gt;
     rect 160, 120, 320, 240&lt;br /&gt;
     matcolor 1,1,1,0&lt;br /&gt;
     background &amp;quot;guis/assets/mainmenu/sidefigure6&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   onTime 10 {&lt;br /&gt;
     if(&amp;quot;gui::frobbed&amp;quot;) {&lt;br /&gt;
       set &amp;quot;gui::frobbed&amp;quot; 0;&lt;br /&gt;
       if(&amp;quot;whichbackground&amp;quot; == 0) {&lt;br /&gt;
          set &amp;quot;whichbackground&amp;quot; &amp;quot;1&amp;quot;;&lt;br /&gt;
          transition &amp;quot;background0::matcolor&amp;quot; &amp;quot;1 1 1 1&amp;quot; &amp;quot;1 1 1 0&amp;quot; &amp;quot;2000&amp;quot;;&lt;br /&gt;
          transition &amp;quot;background1::matcolor&amp;quot; &amp;quot;1 1 1 0&amp;quot; &amp;quot;1 1 1 1&amp;quot; &amp;quot;2000&amp;quot;;&lt;br /&gt;
       } else {&lt;br /&gt;
          set &amp;quot;whichbackground&amp;quot; &amp;quot;0&amp;quot;;&lt;br /&gt;
          transition &amp;quot;background0::matcolor&amp;quot; &amp;quot;1 1 1 0&amp;quot; &amp;quot;1 1 1 1&amp;quot; &amp;quot;2000&amp;quot;;&lt;br /&gt;
          transition &amp;quot;background1::matcolor&amp;quot; &amp;quot;1 1 1 1&amp;quot; &amp;quot;1 1 1 0&amp;quot; &amp;quot;2000&amp;quot;;&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   onTime 100 {&lt;br /&gt;
     resetTime 0;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==For More==&lt;br /&gt;
* This article is based on [[https://forums.thedarkmod.com/index.php?/topic/21464-gui-on-a-world-object/ this forum thread and greebo&amp;#039;s insights]].&lt;br /&gt;
* For examples of the more interactive surface GUI possible in Doom 3, see [https://jaredemitchell.com/scripting-examples/ this example screenshot from Jared Mitchell].&lt;br /&gt;
* TDM differs from Doom3 when it comes to handling multiple entity surfaces with gui_parms, because, among other reasons, TDM provides handles. For more about the Doom3 approach, see [https://modwiki.dhewm3.org/doom3world/index.php?thread_id=26461 this post by S@TaNiC, originally on modwiki].&lt;/div&gt;</summary>
		<author><name>Geep</name></author>
	</entry>
</feed>