This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-08-02 05:55:15

benjamin2
Scratcher
Registered: 2008-10-18
Posts: 1000+

How to detect online sensing

This topic has already been reported as a suggestion to be moved, so please do not report it anymore.

This guide will explain how to detect whether a project is being played in the Java Player, Scratch 2.0/Flash Player, or Scratch 1.#. I suggested it as a FAQ topic, so I'm putting it here, so if it could be considered to be moved to FAQ that would be good.

To detect which player is being used, you can use the following script:

when green flag clicked
set [player v]to [Scratch 1.#]
wait ((0) / (0)) secs//Instead you can use sqrt(-1)
set [player v]to [Online Java]
obsolete!//See below for a place to get one of these
set [player v]to [Scratch 2.0/Flash Player]
Explanation

All of the players act differently when they see mathematical impossibilities or obsolete blocks:

Scratch 1.# will stop a script at a mathematical impossibility but not at an obsolete block.
The Java Player will not stop a script at a mathematical impossibility but it will at an obsolete block.
The Flash Player continues running a script even if mathematical impossibilities or obsolete blocks are present.

At first, the variable is set to Scratch 1.#. If this is the end result, Scratch 1.0/1.1/1.2/1.2.1/1.3/1.3.1/1.4 release candidate/1.4 is being used. In Scratch 1.#, the script stops at the third block because nothing can be divided by zero. However, in the Java Player, it continues, but stops at the obsolete block, so Online Java is the end result. But in the Flash Player or Scratch 2.0, the script reaches the end, so Flash Player/Scratch 2.0 is the result.

You can see more information on this Scratch Wiki article.

GETTING THE OBSOLETE BLOCK

Go to this project and download it. Look at the script for the one sprite and there is an obsolete block. You can then export the sprite and import it into your projects to get the obsolete block.

Last edited by benjamin2 (2012-08-02 06:10:30)


http://i.imgur.com/gp6tZ.gif

Offline

 

#2 2012-08-02 06:08:54

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: How to detect online sensing

lol

Edit: Oops, useless post. I hope this gets moved. I doubt you know this, but even after a day, there's no reply on a single topic of the FAQ forum.  tongue

Edit 2: Apart from the archived forums, both the CTTPW forum and the FAQ forum are the most inactive forums. Correct me of I'm wrong.

Last edited by jontmy00 (2012-08-02 06:12:02)


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#3 2012-08-02 06:13:06

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: How to detect online sensing

Deleted them. I edited the above post twice. And this is still a great guide.  smile


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#4 2012-08-02 06:19:57

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: How to detect online sensing

Thanks benjamin, for writing this guide AND for linking to my friend's project.  smile


http://i50.tinypic.com/312u714.jpg

Offline

 

#5 2012-08-02 06:20:32

benjamin2
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: How to detect online sensing

jontmy00 wrote:

Edit 2: Apart from the archived forums, both the CTTPW forum and the FAQ forum are the most inactive forums. Correct me of I'm wrong.

They are inactive, but so are some of the foreign language forums.

@BirdByte, you're welcome.  smile


http://i.imgur.com/gp6tZ.gif

Offline

 

#6 2012-08-02 06:38:03

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: How to detect online sensing

Very clever!  But using obsolete features really isn't good coding practice - in any language.   On the next language release, the feature may not be available or may not work the same.  Using an obsolete feature is a risky move that may or may not continue to work as the language develops.

However, for those who chose to use it, it's a nice trick.  It might be something that would fit well on the Scratch Wiki  smile


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#7 2012-08-02 06:53:35

benjamin2
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: How to detect online sensing

Paddle2See wrote:

Very clever!  But using obsolete features really isn't good coding practice - in any language.   On the next language release, the feature may not be available or may not work the same.  Using an obsolete feature is a risky move that may or may not continue to work as the language develops.

However, for those who chose to use it, it's a nice trick.  It might be something that would fit well on the Scratch Wiki  smile

There is a link to the Scratch Wiki article at the bottom of the main post.


http://i.imgur.com/gp6tZ.gif

Offline

 

Board footer