<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/Scripting_the_GUI_-_Tutorial_3?action=history&amp;feed=atom</id>
	<title>Scripting the GUI - Tutorial 3 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/Scripting_the_GUI_-_Tutorial_3?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;action=history"/>
	<updated>2026-05-16T13:04:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=60346&amp;oldid=prev</id>
		<title>Surge at 22:39, 5 November 2018</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=60346&amp;oldid=prev"/>
		<updated>2018-11-05T22:39:12Z</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 22:39, 5 November 2018&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-l469&quot;&gt;Line 469:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 469:&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;[[Category:GUI_Tutorials]]&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;[[Category:GUI_Tutorials]]&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;[[hu:Scripting the GUI - Tutorial 3]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-26154:rev-60346 --&gt;
&lt;/table&gt;</summary>
		<author><name>Surge</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=26154&amp;oldid=prev</id>
		<title>Ccw at 19:32, 24 June 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=26154&amp;oldid=prev"/>
		<updated>2011-06-24T19:32:42Z</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 19:32, 24 June 2011&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-l301&quot;&gt;Line 301:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 301:&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;Next, we will look at the font of the label text.&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;Next, we will look at the font of the label text.&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 set the font, use [[guiSetFont]] and pass the string name of the font you want to use (available to see on the [[GUI &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Fonts&lt;/del&gt;]] page).&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 set the font, use [[guiSetFont]] and pass the string name of the font you want to use (available to see on the [[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Standard &lt;/ins&gt;GUI &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Font Names&lt;/ins&gt;]] page).&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;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&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;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;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;guiSetFont(newsLabel,&amp;quot;default-bold-small&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;guiSetFont(newsLabel,&amp;quot;default-bold-small&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22197:rev-26154 --&gt;
&lt;/table&gt;</summary>
		<author><name>Ccw</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22197&amp;oldid=prev</id>
		<title>R3mp at 01:04, 6 January 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22197&amp;oldid=prev"/>
		<updated>2010-01-06T01:04:29Z</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 01:04, 6 January 2010&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-l467&quot;&gt;Line 467:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 467:&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;lt;/syntaxhighlight&amp;gt;&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;lt;/syntaxhighlight&amp;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;That concludes this section of the tutorial.&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;That concludes this section of the tutorial.&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;[[Category:GUI_Tutorials]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22190:rev-22197 --&gt;
&lt;/table&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22190&amp;oldid=prev</id>
		<title>R3mp at 22:44, 5 January 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22190&amp;oldid=prev"/>
		<updated>2010-01-05T22:44:11Z</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 22:44, 5 January 2010&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-l196&quot;&gt;Line 196:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 196:&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;guiSetPosition(yourElement,400,0.5,false)&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;guiSetPosition(yourElement,400,0.5,false)&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;&amp;lt;/syntaxhighlight&amp;gt;&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;lt;/syntaxhighlight&amp;gt;&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 final argument &amp;quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;true&lt;/del&gt;&amp;quot; means both 400 and 0.5 will be read as pixel values.&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 final argument &amp;quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;false&lt;/ins&gt;&amp;quot; means both 400 and 0.5 will be read as pixel values.&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;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;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22189:rev-22190 --&gt;
&lt;/table&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22189&amp;oldid=prev</id>
		<title>R3mp at 22:43, 5 January 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22189&amp;oldid=prev"/>
		<updated>2010-01-05T22:43:19Z</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 22:43, 5 January 2010&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-l186&quot;&gt;Line 186:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 186:&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;end&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;end&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;&amp;lt;/syntaxhighlight&amp;gt;&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;lt;/syntaxhighlight&amp;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;Note the use of '''relative''' position values in the final line of the function. &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;&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;In this case, it is far easier than calculating pixel values.&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;&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;You can use both relative and absolute in the same script if you want to, the only limitation is that you cannot mix them in the same function call. The type of values you are using is defined by the final argument (true or false).&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; &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;This means you cannot do the following and have it set to 400 pixels in, but 0.5% down&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;&amp;lt;syntaxhighlight lang=&quot;lua&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;guiSetPosition(yourElement,400,0.5,false)&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;&amp;lt;/syntaxhighlight&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;The final argument &quot;true&quot; means both 400 and 0.5 will be read as pixel values.&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;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;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22187:rev-22189 --&gt;
&lt;/table&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22187&amp;oldid=prev</id>
		<title>R3mp at 21:50, 5 January 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22187&amp;oldid=prev"/>
		<updated>2010-01-05T21:50:30Z</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 21:50, 5 January 2010&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-l47&quot;&gt;Line 47:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 47:&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;Not only is this good practice in general, but it means that we can freely move parts of the label beyond the edge of the gridlist without them showing, which is critical to the visual effect of this tutorial.&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;Not only is this good practice in general, but it means that we can freely move parts of the label beyond the edge of the gridlist without them showing, which is critical to the visual effect of this tutorial.&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;Also notice the use of the 'resourceRoot' variable. This is an MTA variable that holds the root value of the resource you are using it in.&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;Also notice the use of the 'resourceRoot' variable. This is an MTA variable that holds the root &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;element &lt;/ins&gt;value of the resource you are using it in.&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;The 'currentItem' variable is what we will use to keep track of which news item we are currently showing&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;The 'currentItem' variable is what we will use to keep track of which news item we are currently showing&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22186:rev-22187 --&gt;
&lt;/table&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22186&amp;oldid=prev</id>
		<title>R3mp at 21:19, 5 January 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22186&amp;oldid=prev"/>
		<updated>2010-01-05T21:19:29Z</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 21:19, 5 January 2010&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;'''Scripting the GUI - Tutorial 3 (Scrolling News &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;GUI&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;'''Scripting the GUI - Tutorial 3 (Scrolling News &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Feed&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;In this tutorial we will explore how to create a simple scrolling news feed GUI,  &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;In this tutorial we will explore how to create a simple scrolling news feed GUI,  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22184:rev-22186 --&gt;
&lt;/table&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22184&amp;oldid=prev</id>
		<title>R3mp: Created page with ''''Scripting the GUI - Tutorial 3 (Scrolling News GUI)'''  In this tutorial we will explore how to create a simple scrolling news feed GUI,  allowing you to quickly and easily sh…'</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_3&amp;diff=22184&amp;oldid=prev"/>
		<updated>2010-01-05T21:14:10Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;#039;&amp;#039;&amp;#039;Scripting the GUI - Tutorial 3 (Scrolling News GUI)&amp;#039;&amp;#039;&amp;#039;  In this tutorial we will explore how to create a simple scrolling news feed GUI,  allowing you to quickly and easily sh…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''Scripting the GUI - Tutorial 3 (Scrolling News GUI)'''&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will explore how to create a simple scrolling news feed GUI, &lt;br /&gt;
allowing you to quickly and easily show server updates and other server information to your players.&lt;br /&gt;
We will store all news items in a clientside xml file and use some simple xml reading to load them into the game.&lt;br /&gt;
&lt;br /&gt;
We will then animate the news item to scroll along the bottom of the screen, updating the news text once it has scrolled beyond the edge of the screen.&lt;br /&gt;
&lt;br /&gt;
'''Note that this tutorial assumes you are familiar with all the content covered in the [[Introduction to Scripting GUI|GUI Scripting Introduction]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting up the News Feed==&lt;br /&gt;
To begin, open up a clientside lua file (if you have been following the [[Introduction to Scripting GUI|GUI Scripting Introduction]], this is gui.lua) to work with.&lt;br /&gt;
&lt;br /&gt;
===Creating the GUI===&lt;br /&gt;
As with the previous tutorial, you should be suitably familiar with GUI creation already so we will not go into too much detail here. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createNewsFeed()&lt;br /&gt;
	-- get the screen width and height&lt;br /&gt;
	local sWidth, sHeight = guiGetScreenSize()&lt;br /&gt;
 &lt;br /&gt;
	-- create the gridlist, using some maths to find the bottom-centre of the screen&lt;br /&gt;
	local Width,Height = 800,45&lt;br /&gt;
	local X = (sWidth/2) - (Width/2)&lt;br /&gt;
	local Y = sHeight - (Height/2)&lt;br /&gt;
	&lt;br /&gt;
	-- the gridlist will act as the background to our news reel&lt;br /&gt;
	newsGridlist = guiCreateGridList(X,Y,Width,Height,false)&lt;br /&gt;
	&lt;br /&gt;
	-- create the label in the same place, but as a child of the gridlist&lt;br /&gt;
	-- also make it half the height of the gridlist, as half of the gridlist is off the bottom of the screen&lt;br /&gt;
	newsLabel = guiCreateLabel(X,Y,Width,Height/2,&amp;quot;Test text&amp;quot;,false,newsGridlist)&lt;br /&gt;
	&lt;br /&gt;
	-- call our function to read the news out of the xml file&lt;br /&gt;
	loadNews()&lt;br /&gt;
	&lt;br /&gt;
	-- load the first news item in the table&lt;br /&gt;
	updateNewsItem(1)&lt;br /&gt;
	&lt;br /&gt;
	-- define a global variable called 'currentItem' with the value 1&lt;br /&gt;
	currentItem = 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;,resourceRoot,createNewsFeed)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note that the label is created as a child of the gridlist. &lt;br /&gt;
Not only is this good practice in general, but it means that we can freely move parts of the label beyond the edge of the gridlist without them showing, which is critical to the visual effect of this tutorial.&lt;br /&gt;
&lt;br /&gt;
Also notice the use of the 'resourceRoot' variable. This is an MTA variable that holds the root value of the resource you are using it in.&lt;br /&gt;
&lt;br /&gt;
The 'currentItem' variable is what we will use to keep track of which news item we are currently showing&lt;br /&gt;
&lt;br /&gt;
===Writing the News===&lt;br /&gt;
Now that we have our GUI created, we need some news to fill it with.&lt;br /&gt;
To do this, we will read our news items out of a clientside xml file.&lt;br /&gt;
&lt;br /&gt;
So, navigate to your resource directory and create a new xml file called newsfeed.xml (don't forget to add it to your meta.xml with the appropriate client tag).&lt;br /&gt;
&lt;br /&gt;
Inside this file enter the following information:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;root&amp;gt;&lt;br /&gt;
	&amp;lt;news&amp;gt;This is an example news item.&amp;lt;/news&amp;gt;&lt;br /&gt;
	&amp;lt;news&amp;gt;From the 'Scripting the GUI' tutorial.&amp;lt;/news&amp;gt;&lt;br /&gt;
	&amp;lt;news&amp;gt;Showing scrolling news text.&amp;lt;/news&amp;gt;&lt;br /&gt;
	&amp;lt;news&amp;gt;Written on a GUI news feed.&amp;lt;/news&amp;gt;&lt;br /&gt;
&amp;lt;/root&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As you can see, each news item is defined as a &amp;lt;news&amp;gt; node with the value being the news text you want to display.&lt;br /&gt;
There is no limit on how many news items you can add.&lt;br /&gt;
&lt;br /&gt;
===Collecting the News===&lt;br /&gt;
Once we have written all our news items, we will need to collect them all and store them in a table on the client.&lt;br /&gt;
We will do this when the resource starts, saving us from having to repeatedly access the xml for new news items.&lt;br /&gt;
&lt;br /&gt;
First, we need to define a table to store the items in:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local newsItems = {}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Add this line to the top of your script.&lt;br /&gt;
Make sure it is not inside a function otherwise it will not exist outside of that function (as denoted by the prefix &amp;quot;local&amp;quot;).&lt;br /&gt;
When defined in the main body of the script it will exist in all functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, we will need to load the xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function loadNews()&lt;br /&gt;
	-- load our &amp;quot;newsfeed.xml&amp;quot; file&lt;br /&gt;
	local newsfile = xmlLoadFile(&amp;quot;newsfeed.xml&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	-- if it was successfully loaded&lt;br /&gt;
	if newsfile then&lt;br /&gt;
	&lt;br /&gt;
		-- always remember to unload files once you are finished&lt;br /&gt;
		xmlUnloadFile(newsfile)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''Always remember to unload files once you are finished using them.'''&lt;br /&gt;
&lt;br /&gt;
Finally, we can add some more code to our loadNews function to read the news items into our newsItems table:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function loadNews()&lt;br /&gt;
	local newsfile = xmlLoadFile(&amp;quot;newsfeed.xml&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	if newsfile then&lt;br /&gt;
		-- loop through all the children of the root node (the &amp;quot;news&amp;quot; nodes)&lt;br /&gt;
		for index,itemNode in ipairs(xmlNodeGetChildren(newsfile)) do&lt;br /&gt;
			-- get the text (the news item) from the node&lt;br /&gt;
			local item = xmlNodeGetValue(itemNode)&lt;br /&gt;
			&lt;br /&gt;
			-- insert it into our newsItems table&lt;br /&gt;
			table.insert(newsItems,item)&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		xmlUnloadFile(newsfile)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
We now have a table called 'newsItems' holding all of our news text from the xml file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Updating the News==&lt;br /&gt;
Now that we have our GUI created and our news items ready, we need to write some code to update the news item being shown to players.&lt;br /&gt;
As stated earlier, our news items will be shown on our 'newsLabel' GUI label.&lt;br /&gt;
&lt;br /&gt;
To do this, we will write a simple function to get the next news item from our 'newsItems' table and display it in our label.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- define our function with a newIndex parameter, so that we can pass which news item we want to show&lt;br /&gt;
function updateNewsItem(newIndex)&lt;br /&gt;
	-- get the new news item from the table&lt;br /&gt;
	local item = newsItems[newIndex]&lt;br /&gt;
	&lt;br /&gt;
	-- update the label text&lt;br /&gt;
	guiSetText(newsLabel,item)&lt;br /&gt;
	&lt;br /&gt;
	-- update the 'currentItem' global variable&lt;br /&gt;
	currentItem = newIndex&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Sizing the Label===&lt;br /&gt;
To make our news scrolling as accurate as possible, we need to be able to make the GUI label the same size as the news item text it is showing.&lt;br /&gt;
&lt;br /&gt;
While this may seem like a tricky thing to do, it is made very easy with the function [[guiLabelGetTextExtent]].&lt;br /&gt;
This will tell us the extent, or width, of the text currently shown in our label.&lt;br /&gt;
So with a few modifications to our 'updateNewsItems' function, we get:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function updateNewsItem(newIndex)&lt;br /&gt;
	local item = newsItems[newIndex]&lt;br /&gt;
	&lt;br /&gt;
	guiSetText(newsLabel,item)&lt;br /&gt;
	&lt;br /&gt;
	currentItem = newIndex&lt;br /&gt;
	&lt;br /&gt;
	-- get the current dimensions of the gui label&lt;br /&gt;
	local width,height = guiGetSize(newsLabel,false)&lt;br /&gt;
	&lt;br /&gt;
	-- get the text width of the label&lt;br /&gt;
	local extent = guiLabelGetTextExtent(newsLabel)&lt;br /&gt;
	&lt;br /&gt;
	-- update the size of the label with the new width (we do not change the height)&lt;br /&gt;
	guiSetSize(newsLabel,extent,height,false)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Positioning the Label===&lt;br /&gt;
Now that our GUI label is the correct width, we need to move it to a position where it is ready to scroll onto the screen.&lt;br /&gt;
&lt;br /&gt;
Again, we can do this with a small modification to our 'updateNewsItems' function:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function updateNewsItem(newIndex)&lt;br /&gt;
	local item = newsItems[newIndex]&lt;br /&gt;
	&lt;br /&gt;
	guiSetText(newsLabel,item)&lt;br /&gt;
	&lt;br /&gt;
	currentItem = newIndex&lt;br /&gt;
	&lt;br /&gt;
	local width,height = guiGetSize(newsLabel,false)&lt;br /&gt;
	&lt;br /&gt;
	local extent = guiLabelGetTextExtent(newsLabel)&lt;br /&gt;
	&lt;br /&gt;
	guiSetSize(newsLabel,extent,height,false)&lt;br /&gt;
	&lt;br /&gt;
	-- set the positon to the far right side of the gridlist, ready to scroll on to the left&lt;br /&gt;
	guiSetPosition(newsLabel,1,0,true)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scrolling the News==&lt;br /&gt;
The next step is to animate our news feed.&lt;br /&gt;
&lt;br /&gt;
===Looking at Frames===&lt;br /&gt;
To do this, we will introduce a new event: [[onClientRender]].&lt;br /&gt;
As stated on the [[onClientRender]] wiki page, this event is called every time GTA renders a new frame (ie: very often).&lt;br /&gt;
&lt;br /&gt;
As usual, to use this event we will need to create an event handler for it:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;,root,scrollNews)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This will call our scrollNews function every frame, which we will then use to update the position of our news item.&lt;br /&gt;
&lt;br /&gt;
'''Make sure you add this handler after you have defined your scrollNews function.'''&lt;br /&gt;
&lt;br /&gt;
For our purposes, [[onClientRender]] has one main advantage over, for example, [[setTimer]].&lt;br /&gt;
As it is called every frame (and therefore is dependant on the players FPS), the movement of the news item will always appear to be completely smooth,&lt;br /&gt;
unlike using a timer which would often appear to lag.&lt;br /&gt;
&lt;br /&gt;
===Moving the News===&lt;br /&gt;
In our 'updateNewsItem' function, we position the 'newsLabel' to the far right, so we will scroll in from the right to the left.&lt;br /&gt;
&lt;br /&gt;
For this we will simply move the X position by -1 every frame:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scrollNews()&lt;br /&gt;
	-- if the newsLabel exists&lt;br /&gt;
	if newsLabel then&lt;br /&gt;
		-- get the current position of the label&lt;br /&gt;
		local x,y = guiGetPosition(newsLabel,false)&lt;br /&gt;
		&lt;br /&gt;
		-- set the new x position of the label as the old position -1&lt;br /&gt;
		guiSetPosition(newsLabel,x-1,y,false)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Looping around===&lt;br /&gt;
Now that our news scrolls across the screen, we need to be able to check when it has scrolled too far to the left&lt;br /&gt;
so we can start scrolling from the far-right side again.&lt;br /&gt;
&lt;br /&gt;
We will also need to update the news item, so we should check the next item exists, and if it doesn't, go back to the first.&lt;br /&gt;
&lt;br /&gt;
For this we will use some simple maths in a modification to our 'scrollNews' function:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scrollNews()&lt;br /&gt;
	local x,y = guiGetPosition(newsLabel,false)&lt;br /&gt;
	&lt;br /&gt;
	local labelWidth, labelHeight = guiGetSize(newsLabel,false)&lt;br /&gt;
	&lt;br /&gt;
	-- if the far right position of the label (x + labelWidth) is greater than or equal to 0 (ie: still showing on the gridlist)&lt;br /&gt;
	if ((x-1) + labelWidth) &amp;gt;= 0 then&lt;br /&gt;
		-- compensate for a small off-by-one bug in MTA&lt;br /&gt;
		if x &amp;lt;= 0 then x = x - 1 end&lt;br /&gt;
		&lt;br /&gt;
		-- update the position as normal&lt;br /&gt;
		guiSetPosition(newsLabel,x-1,y,false)&lt;br /&gt;
		&lt;br /&gt;
	-- otherwise, we move on to the next item and reset the position&lt;br /&gt;
	else&lt;br /&gt;
		-- get the total number of items in the 'newsItems' table&lt;br /&gt;
		local totalItems = #newsItems&lt;br /&gt;
		&lt;br /&gt;
		-- if the next item on our list does not exist in our table&lt;br /&gt;
		if (currentItem + 1) &amp;gt; totalItems then&lt;br /&gt;
			-- loop back to the first item in the list&lt;br /&gt;
			updateNewsItem(1)&lt;br /&gt;
		else&lt;br /&gt;
			-- otherwise move onto the next item in the list&lt;br /&gt;
			updateNewsItem(currentItem + 1)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Notice the use of the '#' symbol to get the size of the 'newsItems' table. &lt;br /&gt;
This is the Lua length operator, but it only works on tables that have numerical indexes (like an array or a list).&lt;br /&gt;
It also works on strings, eg: #&amp;quot;hello&amp;quot; would return 5.&lt;br /&gt;
&lt;br /&gt;
That completes this section of the tutorial.&lt;br /&gt;
For ideas on how to further improve and advance this code, continue reading the next section.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Improving the code==&lt;br /&gt;
This section will detail several ways to improve upon the code you now have.&lt;br /&gt;
&lt;br /&gt;
===GUI Customisation===&lt;br /&gt;
To give your GUI a more unique feel, you have the ability to customise some aspects of your GUI elements.&lt;br /&gt;
&lt;br /&gt;
For ideas on what is possible, browse the [[Client_Scripting_Functions#GUI_functions|MTA GUI functions]].&lt;br /&gt;
&lt;br /&gt;
For the purposes of this tutorial, we will be using Font, Colour and Alpha.&lt;br /&gt;
&lt;br /&gt;
To start, we will change the alpha of the background gridlist GUI element we are using.&lt;br /&gt;
To set the alpha, use [[guiSetAlpha]] and pass a value between 1 and 0; 1 being fully opaque and 0 being fully transparent.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
guiSetAlpha(newsGridlist,0.8)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Place this line of code in your 'createNewsFeed' function, after your gridlist has been created.&lt;br /&gt;
&lt;br /&gt;
I find an alpha level of 0.8 looks best, however this is personal preference and you can experiment to suit your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, we will look at the font of the label text.&lt;br /&gt;
To set the font, use [[guiSetFont]] and pass the string name of the font you want to use (available to see on the [[GUI Fonts]] page).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
guiSetFont(newsLabel,&amp;quot;default-bold-small&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Place this line of code in your 'createNewsFeed' function, after your label has been created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, we will look at setting the colour of the label text.&lt;br /&gt;
To set the colour, use [[guiLabelSetColor]] and pass the individual red,green and blue values.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
guiLabelSetColor(newsLabel,255,70,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Place this line of code in your 'createNewsFeed' function, after your label has been created.&lt;br /&gt;
&lt;br /&gt;
This will give your news items an orange-red colour.&lt;br /&gt;
&lt;br /&gt;
===Multiple News Items===&lt;br /&gt;
In its current form, this code is only capable of showing one news item at a time.&lt;br /&gt;
However, with a few modifications we can show multiple news items at once, one after another.&lt;br /&gt;
&lt;br /&gt;
To begin with, we need to make sure we have a 'newItems' table defined at the very start of our script,&lt;br /&gt;
as well as a 'distance' variable that will control the pixel distance between each news item:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local newsItems = {}&lt;br /&gt;
local distance = 30&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
So put these lines at the top of the file.&lt;br /&gt;
&lt;br /&gt;
Next, we will not know how many items we have (and consequently, how many labels we need) until we have loaded the file.&lt;br /&gt;
With that in mind, we will move around some of the code in our 'createNewsFeed' function to support this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createNewsFeed()&lt;br /&gt;
	-- get the screen width and height&lt;br /&gt;
	local sWidth, sHeight = guiGetScreenSize()&lt;br /&gt;
 &lt;br /&gt;
	-- create the gridlist, using some maths to find the bottom-centre of the screen&lt;br /&gt;
	local Width,Height = 800,45&lt;br /&gt;
	local X = (sWidth/2) - (Width/2)&lt;br /&gt;
	local Y = sHeight - (Height/2)&lt;br /&gt;
	&lt;br /&gt;
	-- the gridlist will act as the background to our news reel&lt;br /&gt;
	newsGridlist = guiCreateGridList(X,Y,Width,Height,false)&lt;br /&gt;
	&lt;br /&gt;
	guiSetAlpha(newsGridlist,0.8)&lt;br /&gt;
	&lt;br /&gt;
	-- call our function to read the news out of the xml file, before we create the labels&lt;br /&gt;
	loadNews()&lt;br /&gt;
		&lt;br /&gt;
	-- define a table to hold our labels&lt;br /&gt;
	newsLabel = {}&lt;br /&gt;
	&lt;br /&gt;
	-- now we can loop all our news items, and create a label for each one&lt;br /&gt;
	for index,item in ipairs(newsItems) do&lt;br /&gt;
	&lt;br /&gt;
		-- because we now have one label for every item, we can just set the text here and it wont need to be changed again.&lt;br /&gt;
		newsLabel[index] = guiCreateLabel(0,0,Width,Height/2,item,false,newsGridlist)&lt;br /&gt;
		&lt;br /&gt;
		guiSetFont(newsLabel[index],&amp;quot;default-bold-small&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
		guiLabelSetColor(newsLabel[index],255,70,0)		&lt;br /&gt;
&lt;br /&gt;
		-- modify the width of the label to fit the text&lt;br /&gt;
		local extent = guiLabelGetTextExtent(newsLabel[index])		&lt;br /&gt;
		guiSetSize(newsLabel[index],extent,Height/2,false)&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		-- get the size of the gridlist&lt;br /&gt;
		local x,y = guiGetSize(newsGridlist,false)&lt;br /&gt;
		&lt;br /&gt;
		-- loop from 1 until index-1 in steps of 1&lt;br /&gt;
		-- this allows us to loop every label before the label we are currently on&lt;br /&gt;
		for i=1, index-1, 1 do&lt;br /&gt;
			-- tally up the sizes of all labels before our current one and store them in x&lt;br /&gt;
			local width = guiGetSize(newsLabel[i],false)&lt;br /&gt;
			x = x + width&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- put a 'distance' pixel gap between each news item&lt;br /&gt;
		x = x + (distance*(index-1))&lt;br /&gt;
		&lt;br /&gt;
		-- set the positon to the far right side of the gridlist, ready to scroll on to the left&lt;br /&gt;
		guiSetPosition(newsLabel[index],x,0,false)	&lt;br /&gt;
	end	&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we need to update our 'updateNewsItem' function to account for having multiple labels:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function updateNewsItem(newIndex)&lt;br /&gt;
	-- find the index of the news item directly infront (in the looping order) of the newIndex item&lt;br /&gt;
	local index = newIndex - 1&lt;br /&gt;
	if index == 0 then index = #newsItems end&lt;br /&gt;
	&lt;br /&gt;
	-- find the position of the right-edge of the label directly infront of the newIndex label&lt;br /&gt;
	local x = guiGetPosition(newsLabel[index],false) &lt;br /&gt;
	local width = guiGetSize(newsLabel[index],false)&lt;br /&gt;
	x = x + width&lt;br /&gt;
&lt;br /&gt;
	-- add a 'distance' pixel gap in&lt;br /&gt;
	x = x + distance&lt;br /&gt;
&lt;br /&gt;
	-- check the new position isnt actually on the gridlist (ie: so it wont suddenly appear in the centre of the list)&lt;br /&gt;
	local gridlistWidth = guiGetSize(newsGridlist,false)&lt;br /&gt;
	&lt;br /&gt;
	if x &amp;lt; gridlistWidth then&lt;br /&gt;
		-- if it is, simple move it back to the edge&lt;br /&gt;
		x = gridlistWidth&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- set the new position&lt;br /&gt;
	guiSetPosition(newsLabel[newIndex],x,0,false)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, we need to make some small adjustments to our 'scrollNews' function:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scrollNews()&lt;br /&gt;
	if newsItems then&lt;br /&gt;
		-- loop every news item&lt;br /&gt;
		for index,item in ipairs(newsItems) do&lt;br /&gt;
			local x,y = guiGetPosition(newsLabel[index],false)&lt;br /&gt;
			&lt;br /&gt;
			local labelWidth, labelHeight = guiGetSize(newsLabel[index],false)&lt;br /&gt;
			&lt;br /&gt;
			-- if the far right position of the label (x + labelWidth) is greater than or equal to 0 (ie: still showing on the gridlist)&lt;br /&gt;
			if ((x-1) + labelWidth) &amp;gt;= 0 then&lt;br /&gt;
				-- compensate for a small off-by-one bug in MTA&lt;br /&gt;
				if x &amp;lt;= 0 then x = x - 1 end&lt;br /&gt;
			&lt;br /&gt;
				-- update the position as normal&lt;br /&gt;
				guiSetPosition(newsLabel[index],x-1,y,false)&lt;br /&gt;
				&lt;br /&gt;
			-- otherwise, we move on to the next item and reset the position&lt;br /&gt;
			else&lt;br /&gt;
				updateNewsItem(index)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have multiple news items scrolling along your news feed simultaneously.&lt;br /&gt;
&lt;br /&gt;
===Globally controlled scroll speed===&lt;br /&gt;
As with the 'distance' variable above, we can set a global variable for controlling the scroll speed of the news items as well.&lt;br /&gt;
Note that the speed will still be dependant on the players FPS (ie: lower FPS means slightly slower scrolling).&lt;br /&gt;
&lt;br /&gt;
To do this, we simply need to create the variable at the start of our code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local scrollSpeed = 1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Put this line at the top of your file.&lt;br /&gt;
&lt;br /&gt;
Then, we just replace the instance of &amp;quot;x-1&amp;quot; in our 'scrollNews' function with &amp;quot;x-scrollSpeed&amp;quot;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scrollNews()&lt;br /&gt;
		...&lt;br /&gt;
				-- update the position as normal&lt;br /&gt;
				guiSetPosition(newsLabel[index],x-scrollSpeed,y,false)&lt;br /&gt;
		...&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
That concludes this section of the tutorial.&lt;/div&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
</feed>