<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://x-lexikon.bosl.info/index.php?action=history&amp;feed=atom&amp;title=Globale_und_lokale_Variablen</id>
	<title>Globale und lokale Variablen - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://x-lexikon.bosl.info/index.php?action=history&amp;feed=atom&amp;title=Globale_und_lokale_Variablen"/>
	<link rel="alternate" type="text/html" href="https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;action=history"/>
	<updated>2026-08-07T14:17:14Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in X-Lexikon</subtitle>
	<generator>MediaWiki 1.44.3</generator>
	<entry>
		<id>https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;diff=45787&amp;oldid=prev</id>
		<title>Boronenherrscher am 14. Juli 2011 um 12:41 Uhr</title>
		<link rel="alternate" type="text/html" href="https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;diff=45787&amp;oldid=prev"/>
		<updated>2011-07-14T12:41:45Z</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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 14. Juli 2011, 14:41 Uhr&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;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&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;{{TutorialBar2|[[Grundlegende Befehle]]|[[X3:Terran Conflict Scripting-Tutorial]]|[[Selbstausführende Scripts ]]}}&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;{{TutorialBar2|[[Grundlegende Befehle]]|[[X3:Terran Conflict Scripting-Tutorial]]|[[Selbstausführende Scripts ]]}}&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;Im vorherigen Abschnitt dieses Tutorials haben wir etwas über Variablen gelernt. Doch die in Scripts benutzten Variablen sind nur auf dieses eine &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;script &lt;/del&gt;beschränkt. Es kann jedoch sein, dass auch mehrere Scripts auf ein und &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;dieselbe &lt;/del&gt;Variable zugreifen müssen, oder aber, dass eine bestimmte Variable auch nach der Beendigung eines bestimmten Scripts noch verfügbar ist.&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;Im vorherigen Abschnitt dieses Tutorials haben wir etwas über Variablen gelernt. Doch die in Scripts benutzten Variablen sind nur auf dieses eine &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Script &lt;/ins&gt;beschränkt. Es kann jedoch sein, dass auch mehrere Scripts auf ein und &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;die selbe &lt;/ins&gt;Variable zugreifen müssen, oder aber, dass eine bestimmte Variable auch nach der Beendigung eines bestimmten Scripts noch verfügbar ist.&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;==Globale Variablen==&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;==Globale Variablen==&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;Dies wird durch globale Variablen erreicht. Sie sind von jedem Script abrufbar.&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;Dies wird durch globale Variablen erreicht. Sie sind von jedem Script abrufbar.&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-l8&quot;&gt;Zeile 8:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 8:&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;Obiger Befehl dient dazu, eine globale Variable auf einen bestimmten Wert zu setzen. Er hat 2 Parameter, einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; und einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;&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;Obiger Befehl dient dazu, eine globale Variable auf einen bestimmten Wert zu setzen. Er hat 2 Parameter, einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; und einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;&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;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;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039; repräsentiert den Namen der globalen Variable. Dieser muss einmalig sein, denn ansonsten überschreibt ihr eine eventuell bestehende globale Variable. Allgemeine Namen wie &quot;Nummer&quot; oder &quot;Anzahl&quot; oder &quot;Ziel&quot; sind dabei äußerst ungünstig, daher hat sich folgendes Namensschema weit verbreitet: &quot;ScripterKürzel.Modulname.FunktionDerGlobalenVariable&quot;. Ich selbst könnte zum Beispiel eine globale Variable namens &#039;&#039;&#039;&quot;s304.militaerischer.angriff.Schiffszahl&quot;&#039;&#039;&#039;. Scripter Kürzel wäre hier also &quot;s304&quot;, &quot;militaerischer.angriff&quot; wäre der Name meines Modules und &quot;Schiffszahl&quot; wäre dann die Funktion der &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Globalen &lt;/del&gt;Variable.&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;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039; repräsentiert den Namen der globalen Variable. Dieser muss einmalig sein, denn ansonsten überschreibt ihr eine eventuell bestehende globale Variable. Allgemeine Namen wie &quot;Nummer&quot; oder &quot;Anzahl&quot; oder &quot;Ziel&quot; sind dabei äußerst ungünstig, daher hat sich folgendes Namensschema weit verbreitet: &quot;ScripterKürzel.Modulname.FunktionDerGlobalenVariable&quot;. Ich selbst könnte zum Beispiel eine globale Variable namens &#039;&#039;&#039;&quot;s304.militaerischer.angriff.Schiffszahl&quot;&#039;&#039;&#039; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;setzen&lt;/ins&gt;. Scripter&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&lt;/ins&gt;Kürzel wäre hier also &quot;s304&quot;, &quot;militaerischer.angriff&quot; wäre der Name meines Modules und &quot;Schiffszahl&quot; wäre dann die Funktion der &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;globalen &lt;/ins&gt;Variable.&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;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l31&quot;&gt;Zeile 31:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 31:&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;==Lokale Variablen==&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;==Lokale Variablen==&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;Manchmal möchte man aber auch nur Variablen haben, die auf einem bestimmten Objekt gespeichert sind, und die nur so lange verfügbar sind, wie das Objekt existiert.&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;Manchmal möchte man aber auch nur Variablen haben, die auf einem bestimmten Objekt gespeichert sind, und die nur so lange verfügbar sind, wie das Objekt existiert.&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;&amp;lt;br&amp;gt;Eine mögliche Verwendung wäre zum Beispiel, dass man die Anzahl der geladenen Raketen aller Objekte erfasst. Würde man dafür globale Variablen erstellen, so würden &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;die &lt;/del&gt;ewig weiterexistieren, obwohl es die zugehörigen Objekte vielleicht gar nicht mehr gibt.  &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;&amp;lt;br&amp;gt;Eine mögliche Verwendung wäre zum Beispiel, dass man die Anzahl der geladenen Raketen aller Objekte erfasst. Würde man dafür globale Variablen erstellen, so würden &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sie &lt;/ins&gt;ewig weiterexistieren, obwohl es die zugehörigen Objekte vielleicht gar nicht mehr gibt.  &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;Deswegen speichert man diese Variablen lokal auf dem jeweiligen Objekt.&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;Deswegen speichert man diese Variablen lokal auf dem jeweiligen Objekt.&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 colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l39&quot;&gt;Zeile 39:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 39:&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;und&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;und&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;RefObj&amp;gt; get local variable: name=&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;RefObj&amp;gt; get local variable: name=&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&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;Man sieht sofort, dass die Befehle sehr ähnlich zu denen der globalen Variablen sind. Im &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;grunde &lt;/del&gt;sind sie sogar gleich, jedoch gibt es hier einen Parameter mehr, und zwar &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;RefObj&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;.&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;Man sieht sofort, dass die Befehle sehr ähnlich zu denen der globalen Variablen sind. Im &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Grunde &lt;/ins&gt;sind sie sogar gleich, jedoch gibt es hier einen Parameter mehr, und zwar &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;RefObj&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#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;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;Dieser Parameter dient lediglich dazu, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;dass &lt;/del&gt;Bezugsobjekt festzulegen, auf dem die lokale Variable gespeichert ist oder gespeichert werden soll.&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;Dieser Parameter dient lediglich dazu, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;das &lt;/ins&gt;Bezugsobjekt festzulegen, auf dem die lokale Variable gespeichert ist oder gespeichert werden soll.&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;Beispiel:&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;Beispiel:&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;$Zielschiff -&amp;gt; set local variable: name=&amp;#039;s304.militaerischer.angriff.Schiffszahl&amp;#039; value=$schiffsanzahl&amp;lt;/nowiki&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;$Zielschiff -&amp;gt; set local variable: name=&amp;#039;s304.militaerischer.angriff.Schiffszahl&amp;#039; value=$schiffsanzahl&amp;lt;/nowiki&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;&amp;lt;br&amp;gt; Dieser Code dient dazu, auf dem unter &amp;quot;$Zielschiff&amp;quot; angegebenen Objekt die lokale Variable namens &amp;quot;s304.militearischer.angriff.Schiffszahl&amp;quot; auf den unter &amp;quot;$schiffsanzahl&amp;quot; gespeicherten Wert zu setzen.&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;br&amp;gt; Dieser Code dient dazu, auf dem unter &amp;quot;$Zielschiff&amp;quot; angegebenen Objekt die lokale Variable namens &amp;quot;s304.militearischer.angriff.Schiffszahl&amp;quot; auf den unter &amp;quot;$schiffsanzahl&amp;quot; gespeicherten Wert zu setzen.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Boronenherrscher</name></author>
	</entry>
	<entry>
		<id>https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;diff=43725&amp;oldid=prev</id>
		<title>4th Fleet Commander am 26. Februar 2011 um 14:24 Uhr</title>
		<link rel="alternate" type="text/html" href="https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;diff=43725&amp;oldid=prev"/>
		<updated>2011-02-26T14:24:16Z</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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 26. Februar 2011, 16:24 Uhr&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-l2&quot;&gt;Zeile 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 2:&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;Im vorherigen Abschnitt dieses Tutorials haben wir etwas über Variablen gelernt. Doch die in Scripts benutzten Variablen sind nur auf dieses eine script beschränkt. Es kann jedoch sein, dass auch mehrere Scripts auf ein und dieselbe Variable zugreifen müssen, oder aber, dass eine bestimmte Variable auch nach der Beendigung eines bestimmten Scripts noch verfügbar ist.&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;Im vorherigen Abschnitt dieses Tutorials haben wir etwas über Variablen gelernt. Doch die in Scripts benutzten Variablen sind nur auf dieses eine script beschränkt. Es kann jedoch sein, dass auch mehrere Scripts auf ein und dieselbe Variable zugreifen müssen, oder aber, dass eine bestimmte Variable auch nach der Beendigung eines bestimmten Scripts noch verfügbar ist.&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;==Globale Variablen&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;==Globale Variablen==&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;Dies wird durch globale Variablen erreicht. Sie sind von jedem Script abrufbar.&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;Dies wird durch globale Variablen erreicht. Sie sind von jedem Script abrufbar.&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 colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l29&quot;&gt;Zeile 29:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 29:&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;Nun wird der Wert der globalen Variable also in der Variable &amp;quot;$Schiffe&amp;quot; gespeichert.&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;Nun wird der Wert der globalen Variable also in der Variable &amp;quot;$Schiffe&amp;quot; gespeichert.&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=&lt;/del&gt;==Lokale Variablen&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;==Lokale Variablen==&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;Manchmal möchte man aber auch nur Variablen haben, die auf einem bestimmten Objekt gespeichert sind, und die nur so lange verfügbar sind, wie das Objekt existiert.&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;Manchmal möchte man aber auch nur Variablen haben, die auf einem bestimmten Objekt gespeichert sind, und die nur so lange verfügbar sind, wie das Objekt existiert.&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;&amp;lt;br&amp;gt;Eine mögliche Verwendung wäre zum Beispiel, dass man die Anzahl der geladenen Raketen aller Objekte erfasst. Würde man dafür globale Variablen erstellen, so würden die ewig weiterexistieren, obwohl es die zugehörigen Objekte gar nicht mehr gibt.  &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;&amp;lt;br&amp;gt;Eine mögliche Verwendung wäre zum Beispiel, dass man die Anzahl der geladenen Raketen aller Objekte erfasst. Würde man dafür globale Variablen erstellen, so würden die ewig weiterexistieren, obwohl es die zugehörigen Objekte &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vielleicht &lt;/ins&gt;gar nicht mehr gibt.  &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;Deswegen speichert man diese Variablen lokal auf dem jeweiligen Objekt.&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;Deswegen speichert man diese Variablen lokal auf dem jeweiligen Objekt.&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;/table&gt;</summary>
		<author><name>4th Fleet Commander</name></author>
	</entry>
	<entry>
		<id>https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;diff=43621&amp;oldid=prev</id>
		<title>4th Fleet Commander am 19. Februar 2011 um 16:55 Uhr</title>
		<link rel="alternate" type="text/html" href="https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;diff=43621&amp;oldid=prev"/>
		<updated>2011-02-19T16:55:20Z</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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 19. Februar 2011, 18:55 Uhr&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-l3&quot;&gt;Zeile 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 3:&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;Im vorherigen Abschnitt dieses Tutorials haben wir etwas über Variablen gelernt. Doch die in Scripts benutzten Variablen sind nur auf dieses eine script beschränkt. Es kann jedoch sein, dass auch mehrere Scripts auf ein und dieselbe Variable zugreifen müssen, oder aber, dass eine bestimmte Variable auch nach der Beendigung eines bestimmten Scripts noch verfügbar ist.&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;Im vorherigen Abschnitt dieses Tutorials haben wir etwas über Variablen gelernt. Doch die in Scripts benutzten Variablen sind nur auf dieses eine script beschränkt. Es kann jedoch sein, dass auch mehrere Scripts auf ein und dieselbe Variable zugreifen müssen, oder aber, dass eine bestimmte Variable auch nach der Beendigung eines bestimmten Scripts noch verfügbar ist.&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;===Globale Variablen===&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;===Globale Variablen===&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;Dies wird durch globale Variablen erreicht. Sie sind von jedem &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;script &lt;/del&gt;abrufbar.&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;Dies wird durch globale Variablen erreicht. Sie sind von jedem &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Script &lt;/ins&gt;abrufbar.&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;set global variable: name=&amp;lt;Var/String&amp;gt; value=&amp;lt;Value&amp;gt;&amp;lt;/nowiki&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;set global variable: name=&amp;lt;Var/String&amp;gt; value=&amp;lt;Value&amp;gt;&amp;lt;/nowiki&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;Obiger Befehl dient dazu, eine globale Variable auf einen bestimmten Wert zu setzen. Er hat 2 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Argumente&lt;/del&gt;, einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039; und einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;.&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;Obiger Befehl dient dazu, eine globale Variable auf einen bestimmten Wert zu setzen. Er hat 2 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Parameter&lt;/ins&gt;, einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039; und einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#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;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;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; repräsentiert den Namen der globalen Variable. Dieser muss einmalig sein, denn ansonsten überschreibt ihr eine eventuell bestehende globale Variable. Allgemeine Namen wie &amp;quot;Nummer&amp;quot; oder &amp;quot;Anzahl&amp;quot; oder &amp;quot;Ziel&amp;quot; sind dabei äußerst ungünstig, daher hat sich folgendes Namensschema weit verbreitet: &amp;quot;ScripterKürzel.Modulname.FunktionDerGlobalenVariable&amp;quot;. Ich selbst könnte zum Beispiel eine globale Variable namens &amp;#039;&amp;#039;&amp;#039;&amp;quot;s304.militaerischer.angriff.Schiffszahl&amp;quot;&amp;#039;&amp;#039;&amp;#039;. Scripter Kürzel wäre hier also &amp;quot;s304&amp;quot;, &amp;quot;militaerischer.angriff&amp;quot; wäre der Name meines Modules und &amp;quot;Schiffszahl&amp;quot; wäre dann die Funktion der Globalen Variable.&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;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; repräsentiert den Namen der globalen Variable. Dieser muss einmalig sein, denn ansonsten überschreibt ihr eine eventuell bestehende globale Variable. Allgemeine Namen wie &amp;quot;Nummer&amp;quot; oder &amp;quot;Anzahl&amp;quot; oder &amp;quot;Ziel&amp;quot; sind dabei äußerst ungünstig, daher hat sich folgendes Namensschema weit verbreitet: &amp;quot;ScripterKürzel.Modulname.FunktionDerGlobalenVariable&amp;quot;. Ich selbst könnte zum Beispiel eine globale Variable namens &amp;#039;&amp;#039;&amp;#039;&amp;quot;s304.militaerischer.angriff.Schiffszahl&amp;quot;&amp;#039;&amp;#039;&amp;#039;. Scripter Kürzel wäre hier also &amp;quot;s304&amp;quot;, &amp;quot;militaerischer.angriff&amp;quot; wäre der Name meines Modules und &amp;quot;Schiffszahl&amp;quot; wäre dann die Funktion der Globalen Variable.&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-l20&quot;&gt;Zeile 20:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 20:&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt; get global variable: name=&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt; get global variable: name=&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&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;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;Dieser hat wieder 2 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Argumente&lt;/del&gt;. Einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039; und einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;.&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;Dieser hat wieder 2 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Parameter&lt;/ins&gt;. Einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039; und einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#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;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;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; dient wieder dazu, den Namen der globalen Variable abzurufen.&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;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; dient wieder dazu, den Namen der globalen Variable abzurufen.&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-l39&quot;&gt;Zeile 39:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 39:&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;und&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;und&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;RefObj&amp;gt; get local variable: name=&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;RefObj&amp;gt; get local variable: name=&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&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;Man sieht sofort, dass die Befehle sehr ähnlich zu denen der globalen Variablen sind. Im grunde sind sie sogar gleich, jedoch gibt es hier &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ein Argument &lt;/del&gt;mehr, und zwar &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;RefObj&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;.&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;Man sieht sofort, dass die Befehle sehr ähnlich zu denen der globalen Variablen sind. Im grunde sind sie sogar gleich, jedoch gibt es hier &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;einen Parameter &lt;/ins&gt;mehr, und zwar &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;RefObj&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#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;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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Dieses Argument &lt;/del&gt;dient lediglich dazu, dass Bezugsobjekt festzulegen, auf dem die lokale Variable gespeichert ist oder gespeichert werden soll.&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Dieser Parameter &lt;/ins&gt;dient lediglich dazu, dass Bezugsobjekt festzulegen, auf dem die lokale Variable gespeichert ist oder gespeichert werden soll.&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;Beispiel:&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;Beispiel:&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;$Zielschiff -&amp;gt; set local variable: name=&amp;#039;s304.militaerischer.angriff.Schiffszahl&amp;#039; value=$schiffsanzahl&amp;lt;/nowiki&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;$Zielschiff -&amp;gt; set local variable: name=&amp;#039;s304.militaerischer.angriff.Schiffszahl&amp;#039; value=$schiffsanzahl&amp;lt;/nowiki&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;&amp;lt;br&amp;gt; Dieser Code dient dazu, auf dem unter &amp;quot;$Zielschiff&amp;quot; angegebenen Objekt die lokale Variable namens &amp;quot;s304.militearischer.angriff.Schiffszahl&amp;quot; auf den unter &amp;quot;$schiffsanzahl&amp;quot; gespeicherten Wert zu setzen.&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;br&amp;gt; Dieser Code dient dazu, auf dem unter &amp;quot;$Zielschiff&amp;quot; angegebenen Objekt die lokale Variable namens &amp;quot;s304.militearischer.angriff.Schiffszahl&amp;quot; auf den unter &amp;quot;$schiffsanzahl&amp;quot; gespeicherten Wert zu setzen.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>4th Fleet Commander</name></author>
	</entry>
	<entry>
		<id>https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;diff=43507&amp;oldid=prev</id>
		<title>4th Fleet Commander am 12. Februar 2011 um 20:58 Uhr</title>
		<link rel="alternate" type="text/html" href="https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;diff=43507&amp;oldid=prev"/>
		<updated>2011-02-12T20:58:24Z</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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 12. Februar 2011, 22:58 Uhr&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-l6&quot;&gt;Zeile 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 6:&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;set global variable: name=&amp;lt;Var/String&amp;gt; value=&amp;lt;Value&amp;gt;&amp;lt;/nowiki&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;set global variable: name=&amp;lt;Var/String&amp;gt; value=&amp;lt;Value&amp;gt;&amp;lt;/nowiki&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;Obiger Befehl dient dazu, eine globale Variable auf einen bestimmten Wert zu setzen. &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Sie &lt;/del&gt;hat 2 Argumente, einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039; und einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;.&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;Obiger Befehl dient dazu, eine globale Variable auf einen bestimmten Wert zu setzen. &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Er &lt;/ins&gt;hat 2 Argumente, einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039; und einmal &#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#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;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;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; repräsentiert den Namen der globalen Variable. Dieser muss einmalig sein, denn ansonsten überschreibt ihr eine eventuell bestehende globale Variable. Allgemeine Namen wie &amp;quot;Nummer&amp;quot; oder &amp;quot;Anzahl&amp;quot; oder &amp;quot;Ziel&amp;quot; sind dabei äußerst ungünstig, daher hat sich folgendes Namensschema weit verbreitet: &amp;quot;ScripterKürzel.Modulname.FunktionDerGlobalenVariable&amp;quot;. Ich selbst könnte zum Beispiel eine globale Variable namens &amp;#039;&amp;#039;&amp;#039;&amp;quot;s304.militaerischer.angriff.Schiffszahl&amp;quot;&amp;#039;&amp;#039;&amp;#039;. Scripter Kürzel wäre hier also &amp;quot;s304&amp;quot;, &amp;quot;militaerischer.angriff&amp;quot; wäre der Name meines Modules und &amp;quot;Schiffszahl&amp;quot; wäre dann die Funktion der Globalen Variable.&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;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; repräsentiert den Namen der globalen Variable. Dieser muss einmalig sein, denn ansonsten überschreibt ihr eine eventuell bestehende globale Variable. Allgemeine Namen wie &amp;quot;Nummer&amp;quot; oder &amp;quot;Anzahl&amp;quot; oder &amp;quot;Ziel&amp;quot; sind dabei äußerst ungünstig, daher hat sich folgendes Namensschema weit verbreitet: &amp;quot;ScripterKürzel.Modulname.FunktionDerGlobalenVariable&amp;quot;. Ich selbst könnte zum Beispiel eine globale Variable namens &amp;#039;&amp;#039;&amp;#039;&amp;quot;s304.militaerischer.angriff.Schiffszahl&amp;quot;&amp;#039;&amp;#039;&amp;#039;. Scripter Kürzel wäre hier also &amp;quot;s304&amp;quot;, &amp;quot;militaerischer.angriff&amp;quot; wäre der Name meines Modules und &amp;quot;Schiffszahl&amp;quot; wäre dann die Funktion der Globalen Variable.&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;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;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039; ist hier der Wert, auf den wir die globale Variable setzen wollen. Bei meiner Beispielvariable könnte das zum &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;beispiel &lt;/del&gt;eine andere Variable namens &quot;$errechnete.schiffszahl&quot;.&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;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039; ist hier der Wert, auf den wir die globale Variable setzen wollen. Bei meiner Beispielvariable könnte das zum &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Beispiel &lt;/ins&gt;eine andere Variable namens &quot;$errechnete.schiffszahl&quot; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sein&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;Bei meiner Beispielvariable sähe dieser Befehl nun also folgendermaßen aus:&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;Bei meiner Beispielvariable sähe dieser Befehl nun also folgendermaßen aus:&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-l18&quot;&gt;Zeile 18:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 18:&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;Man kann die globalen Variablen natürlich auch abrufen. So sieht der dazu nötige Befehl aus:&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;Man kann die globalen Variablen natürlich auch abrufen. So sieht der dazu nötige Befehl aus:&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt; get global variable: name=&amp;lt;Var/String&amp;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;{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt; get global variable: name=&amp;lt;Var/String&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;gt;&amp;lt;/nowiki&lt;/ins&gt;&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;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;Dieser hat wieder 2 Argumente. Einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; und einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&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;Dieser hat wieder 2 Argumente. Einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; und einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;.&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-l45&quot;&gt;Zeile 45:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 45:&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;Beispiel:&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;Beispiel:&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;$Zielschiff -&amp;gt; set local variable: name=&amp;#039;s304.militaerischer.angriff.Schiffszahl&amp;#039; value=$schiffsanzahl&amp;lt;/nowiki&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;{{ScriptCode|&amp;lt;nowiki&amp;gt;$Zielschiff -&amp;gt; set local variable: name=&amp;#039;s304.militaerischer.angriff.Schiffszahl&amp;#039; value=$schiffsanzahl&amp;lt;/nowiki&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;&amp;lt;br&amp;gt; Dieser Code dient dazu, auf dem unter &quot;$Zielschiff&quot; angegebenen Objekt die lokale Variable namens &quot;s304.militearischer.angriff.Schiffszahl&quot; auf den unter &quot;$schiffsanzahl&quot; gespeicherten Wert zu setzen.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>4th Fleet Commander</name></author>
	</entry>
	<entry>
		<id>https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;diff=43424&amp;oldid=prev</id>
		<title>4th Fleet Commander: erstellt</title>
		<link rel="alternate" type="text/html" href="https://x-lexikon.bosl.info/index.php?title=Globale_und_lokale_Variablen&amp;diff=43424&amp;oldid=prev"/>
		<updated>2011-02-05T14:03:28Z</updated>

		<summary type="html">&lt;p&gt;erstellt&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{TutorialBar2|[[Grundlegende Befehle]]|[[X3:Terran Conflict Scripting-Tutorial]]|[[Selbstausführende Scripts ]]}}&lt;br /&gt;
&lt;br /&gt;
Im vorherigen Abschnitt dieses Tutorials haben wir etwas über Variablen gelernt. Doch die in Scripts benutzten Variablen sind nur auf dieses eine script beschränkt. Es kann jedoch sein, dass auch mehrere Scripts auf ein und dieselbe Variable zugreifen müssen, oder aber, dass eine bestimmte Variable auch nach der Beendigung eines bestimmten Scripts noch verfügbar ist.&lt;br /&gt;
===Globale Variablen===&lt;br /&gt;
Dies wird durch globale Variablen erreicht. Sie sind von jedem script abrufbar.&lt;br /&gt;
&lt;br /&gt;
{{ScriptCode|&amp;lt;nowiki&amp;gt;set global variable: name=&amp;lt;Var/String&amp;gt; value=&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
Obiger Befehl dient dazu, eine globale Variable auf einen bestimmten Wert zu setzen. Sie hat 2 Argumente, einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; und einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; repräsentiert den Namen der globalen Variable. Dieser muss einmalig sein, denn ansonsten überschreibt ihr eine eventuell bestehende globale Variable. Allgemeine Namen wie &amp;quot;Nummer&amp;quot; oder &amp;quot;Anzahl&amp;quot; oder &amp;quot;Ziel&amp;quot; sind dabei äußerst ungünstig, daher hat sich folgendes Namensschema weit verbreitet: &amp;quot;ScripterKürzel.Modulname.FunktionDerGlobalenVariable&amp;quot;. Ich selbst könnte zum Beispiel eine globale Variable namens &amp;#039;&amp;#039;&amp;#039;&amp;quot;s304.militaerischer.angriff.Schiffszahl&amp;quot;&amp;#039;&amp;#039;&amp;#039;. Scripter Kürzel wäre hier also &amp;quot;s304&amp;quot;, &amp;quot;militaerischer.angriff&amp;quot; wäre der Name meines Modules und &amp;quot;Schiffszahl&amp;quot; wäre dann die Funktion der Globalen Variable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; ist hier der Wert, auf den wir die globale Variable setzen wollen. Bei meiner Beispielvariable könnte das zum beispiel eine andere Variable namens &amp;quot;$errechnete.schiffszahl&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Bei meiner Beispielvariable sähe dieser Befehl nun also folgendermaßen aus:&lt;br /&gt;
{{ScriptCode|&amp;lt;nowiki&amp;gt;set global variable: name=&amp;#039;s304.militaerischer.angriff.Schiffszahl&amp;#039; value=$errechnete.schiffszahl&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Man kann die globalen Variablen natürlich auch abrufen. So sieht der dazu nötige Befehl aus:&lt;br /&gt;
{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt; get global variable: name=&amp;lt;Var/String&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Dieser hat wieder 2 Argumente. Einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; und einmal &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; dient wieder dazu, den Namen der globalen Variable abzurufen.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039; ist der sogenannte &amp;quot;Returnvalue&amp;quot;, zu Deutsch &amp;quot;Rückgabewert&amp;quot;. Das ganze funktioniert so, dass zunächst der eigentliche Befehl abgearbeitet wird, hier ist das halt das Auslesen der globalen Variable. Anschließend wird das Ergebnis des Befehls, also hier der ausgelesene Wert der GVar, im Returnvalue gespeichert. &amp;lt;br&amp;gt;&lt;br /&gt;
Als Beispiel wollen wir hier mal die Variable &amp;quot;Schiffe&amp;quot; nehmen und die oben genutzte globale Variable:&lt;br /&gt;
{{ScriptCode|&amp;lt;nowiki&amp;gt;$Schiffe = get global variable: name=&amp;#039;s304.militaerischer.angriff.Schiffszahl&amp;#039;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
Nun wird der Wert der globalen Variable also in der Variable &amp;quot;$Schiffe&amp;quot; gespeichert.&lt;br /&gt;
&lt;br /&gt;
===Lokale Variablen===&lt;br /&gt;
Manchmal möchte man aber auch nur Variablen haben, die auf einem bestimmten Objekt gespeichert sind, und die nur so lange verfügbar sind, wie das Objekt existiert.&lt;br /&gt;
&amp;lt;br&amp;gt;Eine mögliche Verwendung wäre zum Beispiel, dass man die Anzahl der geladenen Raketen aller Objekte erfasst. Würde man dafür globale Variablen erstellen, so würden die ewig weiterexistieren, obwohl es die zugehörigen Objekte gar nicht mehr gibt. &lt;br /&gt;
Deswegen speichert man diese Variablen lokal auf dem jeweiligen Objekt.&lt;br /&gt;
&lt;br /&gt;
Folgende Befehle sind für die lokalen Variablen zuständig:&lt;br /&gt;
&lt;br /&gt;
{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RefObj&amp;gt; set local variable: name=&amp;lt;Var/String&amp;gt; value=&amp;lt;Value&amp;gt;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
und&lt;br /&gt;
{{ScriptCode|&amp;lt;nowiki&amp;gt;&amp;lt;RetVar/IF&amp;gt;&amp;lt;RefObj&amp;gt; get local variable: name=&amp;lt;Var/String&amp;gt;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
Man sieht sofort, dass die Befehle sehr ähnlich zu denen der globalen Variablen sind. Im grunde sind sie sogar gleich, jedoch gibt es hier ein Argument mehr, und zwar &amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;&amp;lt;RefObj&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
Dieses Argument dient lediglich dazu, dass Bezugsobjekt festzulegen, auf dem die lokale Variable gespeichert ist oder gespeichert werden soll.&lt;br /&gt;
&lt;br /&gt;
Beispiel:&lt;br /&gt;
{{ScriptCode|&amp;lt;nowiki&amp;gt;$Zielschiff -&amp;gt; set local variable: name=&amp;#039;s304.militaerischer.angriff.Schiffszahl&amp;#039; value=$schiffsanzahl&amp;lt;/nowiki&amp;gt;}}&lt;/div&gt;</summary>
		<author><name>4th Fleet Commander</name></author>
	</entry>
</feed>