<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://digida.mgpu.ru/index.php?action=history&amp;feed=atom&amp;title=Interface_Detection</id>
	<title>Interface Detection - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://digida.mgpu.ru/index.php?action=history&amp;feed=atom&amp;title=Interface_Detection"/>
	<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Interface_Detection&amp;action=history"/>
	<updated>2026-05-20T17:44:55Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://digida.mgpu.ru/index.php?title=Interface_Detection&amp;diff=1830&amp;oldid=prev</id>
		<title>Patarakin: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Interface_Detection&amp;diff=1830&amp;oldid=prev"/>
		<updated>2022-07-21T08:33:17Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&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;ru&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 11:33, 21 июля 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key digida:diff:1.41:old-1829:rev-1830 --&gt;
&lt;/table&gt;</summary>
		<author><name>Patarakin</name></author>
	</entry>
	<entry>
		<id>http://digida.mgpu.ru/index.php?title=Interface_Detection&amp;diff=1829&amp;oldid=prev</id>
		<title>scratch&gt;Jvvg в 21:32, 6 июня 2022</title>
		<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Interface_Detection&amp;diff=1829&amp;oldid=prev"/>
		<updated>2022-06-06T21:32:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{obsolete feature}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Interface detection&amp;#039;&amp;#039;&amp;#039; is a process in which a [[project]] determines what player it is running in. For example, a script can detect whether a project is running on the [[Online Editor]] or the [[Offline Editor]]. These take advantage of slight differences between the compared player.&lt;br /&gt;
&lt;br /&gt;
== 1.4-Java Player ==&lt;br /&gt;
Using these methods, it can be determined whether the player is [[Scratch 1.4]] or the [[Java Player]].&lt;br /&gt;
&lt;br /&gt;
[[projects:2717421|Here]] is an example of online and offline detection.&lt;br /&gt;
&lt;br /&gt;
=== Using [[Undefined Blocks|Obsolete Blocks]] ===&lt;br /&gt;
The following [[script]] requires obsolete blocks to properly check if the viewer was running projects in the offline or online editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when gf clicked&lt;br /&gt;
set [Online/Offline v] to [Online]&lt;br /&gt;
obsolete!&lt;br /&gt;
set [Online/Offline v] to [Offline]&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How it Works ====&lt;br /&gt;
First the script sets the variable Online/Offline to Online. In the [[Java Player]], it will stop at an obsolete block. Therefore, it sets it to Offline if it is being played in the [[Experimental Viewer]] or offline because it will ignore the obsolete block and the script will continue to turn the variable online/offline to offline.&lt;br /&gt;
&lt;br /&gt;
=== Using Script Errors ===&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when gf clicked&lt;br /&gt;
set [Online/Offline v] to [Offline]&lt;br /&gt;
wait ([sqrt v] of (-1)) secs&lt;br /&gt;
set [Online/Offline v] to [Online]&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other [[Script Errors|script errors]], such as dividing by zero, can also be used.&lt;br /&gt;
&lt;br /&gt;
==== How it Works ====&lt;br /&gt;
First the script sets the variable, Online/Offline, to Offline. In the [[Scratch Program]] (offline) it will not continue the script when it reaches the script error but online it will continue to run the script.&lt;br /&gt;
&lt;br /&gt;
== 1.4-Java-Flash ==&lt;br /&gt;
This script is similar to the previous ones, but it additionally checks whether the project is playing in the modern [[Flash Player]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;when gf clicked&lt;br /&gt;
set [Playing... v] to [Offline]&lt;br /&gt;
broadcast ([sqrt v] of (-1))&lt;br /&gt;
set [Playing... v] to [Java]&lt;br /&gt;
obsolete!&lt;br /&gt;
set [Playing... v] to [Flash]&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== How it Works ===&lt;br /&gt;
First, the script sets the [[variable]] &amp;quot;Playing...&amp;quot; to &amp;quot;Offline&amp;quot;. Offline the script stops immediately. However, in the Java Player, the script ignores the error and carries on the script, therefore setting the variable to &amp;quot;Java&amp;quot;. The Experimental Viewer and [[Flash Player]] will continue with the script no matter how many errors so it will then set the variable to &amp;quot;Flash&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Similarly, a script could be made that checks &amp;quot;Java&amp;quot;, &amp;quot;offline&amp;quot;, or &amp;quot;Flash&amp;quot;. It works by first setting the variable to Java. If it is on Java, then it will stop there because of the obsolete block. Then if it is offline it will make it through the obsolete block but stop at the script error. Then if it is on Flash it will run through all of it setting it to Flash.&lt;br /&gt;
&lt;br /&gt;
== Example Uses ==&lt;br /&gt;
There are many reasons a [[Scratcher|user]] may want to detect if a project is online or offline. For example, you may want to automatically suggest the user to download the project (or use the Flash player) in case the project requires [[Turbo Mode]]. It is also useful to prompt a user to download and remix a project, or to disable certain features online which may not work properly. However, you can make a user download the project to play it by disconnecting a vital script.&lt;br /&gt;
&lt;br /&gt;
* Only showing a sprite online&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when gf clicked&lt;br /&gt;
hide&lt;br /&gt;
if &amp;lt;((0) / (0)) = (0)&amp;gt; then&lt;br /&gt;
end&lt;br /&gt;
show&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
* Changing the appearance of a sprite for online/offline&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when gf clicked&lt;br /&gt;
switch costume to [costume v]&lt;br /&gt;
if &amp;lt;((0) / (0)) = (0)&amp;gt; then&lt;br /&gt;
end&lt;br /&gt;
switch costume to [costume2 v]&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
* Disallowing a feature online&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when gf clicked&lt;br /&gt;
if &amp;lt;(Online?) = [True]&amp;gt; then&lt;br /&gt;
  stop script :: control&lt;br /&gt;
end&lt;br /&gt;
say [Welcome to the bonus level!]&lt;br /&gt;
repeat (50)&lt;br /&gt;
  turn cw (5) degrees&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
* Reporting where the user is playing the project&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when this sprite clicked&lt;br /&gt;
if &amp;lt;(Online?) = [True]&amp;gt; then&lt;br /&gt;
  say [You are on the internet!]&lt;br /&gt;
else&lt;br /&gt;
  say [You are not on the internet!]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting Tutorials]]&lt;/div&gt;</summary>
		<author><name>scratch&gt;Jvvg</name></author>
	</entry>
</feed>