This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » FAQ
  •  » Why Don't My Projects Work Correctly Online?

#1 2009-04-06 15:14:44

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

Why Don't My Projects Work Correctly Online?

read more on the Scratch Wiki...

When a Scratch project is running online, it is actually running in an application called the Java Player which interprets the Scratch project and makes it run.  The Java Player is a totally different application from the Scratch program (where you make the projects).  So, while it does a pretty good job of running Scratch projects, it has it's own set of "quirks".  Sometimes you have to make some small changes to your projects to make them run on the web. 

I'm going to start a thread here to show some of the most common problems you may run into when you try and run your project on the web.  Feel free to add on your own experiences!

Timing and Initialization
======================
Often, the reason that projects act differently on the web has to do with the timing of things.  You may have several scripts all starting on a given Broadcast event (for instance) that really need to act in a certain order.  They work fine in Scratch but, because some events happen a little faster or slower online, they don't work right online.  You can usually cure these kind of problems by adding short Wait blocks ahead of the events that should happen later.

Also, make sure that when the Green Flag is clicked, the project is initializing properly.  That means that all the variables are set to the right starting values, all the sprites are put in the right starting place and so on.  Any Forever loops that are checking for a certain variable value should have a short Wait ahead of them to make sure that the variable has time to get set to the right starting value before the Forever loop starts checking it.

Large Sprites
============
Sprites can get much larger than the Stage in the Scratch Program.  But, in the Java Player, sprites can not be larger than the screen.  The only work-around I know of here is to break your very large sprites into smaller values.

Color Effect
===========
The Set Color effect works differently online...the color numbers are different.  You shouldn't use Set Color with the expectation that it is going to end up with the same colors you get in the Scratch Program.  *** Update - this problem was reportedly fixed in version 34 of the player ***

Lists
====
if you try accessing a list item that doesn't exist, the project fails online, but doesn't offline - which can be a pretty common problem in a number of projects.  Thanks to AddZero and Coolstuff for that tip!

Division by Zero
===============
Also, although this isn't directly related because it's sort of inverse to this topic, errors you get when trying to do things that are impossible such as dividing by zero doesn't stop the script online.  Again, thanks to AddZero and Coolstuff.

Last edited by JSO (2011-01-03 18:05:42)


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

Offline

 

#2 2009-04-06 16:08:22

tmaaan
Scratcher
Registered: 2009-01-30
Posts: 62

Re: Why Don't My Projects Work Correctly Online?

wow. how did you figure all that out?


check out my projects!!!!!    big_smile   my newest project: http://scratch.mit.edu/projects/tmaaan/496827 driversim, and best project: http://scratch.mit.edu/projects/tmaaan/483612 truck driver 2!!! I have a find it ready but wont be able to upload it till school is out  sad

Offline

 

#3 2009-04-06 18:29:01

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

Re: Why Don't My Projects Work Correctly Online?

tmaaan wrote:

wow. how did you figure all that out?

Some I learned from other people, some by trial and error  smile 

I really like my projects to work online just as well as they do when they are downloaded so I've spent a lot of time learning what I can to make my projects work in both places.  If anybody else has any helpful hints, feel free to post them here.


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

Offline

 

#4 2009-04-06 19:02:12

golfer3
Scratcher
Registered: 2008-11-02
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

Paddle2See wrote:

When a Scratch project is running online, it is actually running in an application called the Java Player which interprets the Scratch project and makes it run.  The Java Player is a totally different application from the Scratch program (where you make the projects).  So, while it does a pretty good job of running Scratch projects, it has it's own set of "quirks".  Sometimes you have to make some small changes to your projects to make them run on the web. 

I'm going to start a thread here to show some of the most common problems you may run into when you try and run your project on the web.  Feel free to add on your own experiences!

Timing and Initialization
======================
Often, the reason that projects act differently on the web has to do with the timing of things.  You may have several scripts all starting on a given Broadcast event (for instance) that really need to act in a certain order.  They work fine in Scratch but, because some events happen a little faster or slower online, they don't work right online.  You can usually cure these kind of problems by adding short Wait blocks ahead of the events that should happen later.

Also, make sure that when the Green Flag is clicked, the project is initializing properly.  That means that all the variables are set to the right starting values, all the sprites are put in the right starting place and so on.  Any Forever loops that are checking for a certain variable value should have a short Wait ahead of them to make sure that the variable has time to get set to the right starting value before the Forever loop starts checking it.

Large Sprites
============
Sprites can get much larger than the Stage in the Scratch Program.  But, in the Java Player, sprites can not be larger than the screen.  The only work-around I know of here is to break your very large sprites into smaller values.

Color Effect
===========
The Set Color effect works differently online...the color numbers are different.  You shouldn't use Set Color with the expectation that it is going to end up with the same colors you get in the Scratch Program.

Thats pretty helpful if you need some help like that. I like it!  smile

Offline

 

#5 2009-04-07 08:30:15

kgordon
Scratcher
Registered: 2009-02-26
Posts: 100+

Re: Why Don't My Projects Work Correctly Online?

Here are two things I have discovered about what happens to projects when uploaded: the online java player does not change a variable by a certain number if the variable already equals a non-number. Also it utterly doesn't recognize the arcsign and puts it's version of the error symbol in your variable if you try to use it. Hope that helps.

Offline

 

#6 2009-04-07 11:59:55

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

Re: Why Don't My Projects Work Correctly Online?

kgordon wrote:

Here are two things I have discovered about what happens to projects when uploaded: the online java player does not change a variable by a certain number if the variable already equals a non-number. Also it utterly doesn't recognize the arcsign and puts it's version of the error symbol in your variable if you try to use it. Hope that helps.

Yes, it does!  I knew about the problem with variables but I hadn't heard about the problem with Arcsine.  Thanks!


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

Offline

 

#7 2009-04-07 15:33:57

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

Here's a confusing one:

If you are using the "Touching [color]" blocks, be very careful NOT to compress your images.  Compressing images sometimes slightly changes the colors used.  Your project will look like it should work, but it won't.

To see an example of this error, load the demo project Games > 1. Pacman

Once you finish the first screen (which works fine) it will switch to the second screen which has been compressed.  It doesn't work as designed.

This is somewhat tricky to avoid because when you are sharing a project the "Compress images and sounds" is checked by default.  You must remember to uncheck that box for your project to work.

Last edited by BoltBait (2009-04-07 15:34:59)


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#8 2009-04-07 15:50:25

bosox397
Scratcher
Registered: 2008-02-17
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

I think I heard the set volume to and the hide/show variable doesn't work online.


Dear Scratch Users,
I'm done with scratch, or at least making projects. I have made one last big game, thats both fun and teaches a lesson about water. It'd mean a lot if you gave me feedback.                              http://scratch.mit.edu/projects/bosox397/569201

Offline

 

#9 2009-04-07 16:10:55

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

Here is an example that I made up:

http://scratch.mit.edu/projects/BoltBait/480964

The online player has trouble with the [Insert into list at position] function.

So, you can use this bug to detect if you are running online (on the web site player) or offline (in the development environment).

Last edited by BoltBait (2009-04-09 15:19:09)


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#10 2009-04-10 20:22:25

kgordon
Scratcher
Registered: 2009-02-26
Posts: 100+

Re: Why Don't My Projects Work Correctly Online?

Yeah the volume doesn't work but I didn't know about the hide variable/show variable (thanks to bosox397 for correcting me). Also timing can be a bit off sometimes and sometimes big projects slow down online. If I think of anything else I will add it.

Last edited by kgordon (2009-04-11 07:54:39)

Offline

 

#11 2009-04-10 22:12:58

bosox397
Scratcher
Registered: 2008-02-17
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

No not those hide show blocks. The hide variable/show variable blocks. also loudness doesn't work onliine


Dear Scratch Users,
I'm done with scratch, or at least making projects. I have made one last big game, thats both fun and teaches a lesson about water. It'd mean a lot if you gave me feedback.                              http://scratch.mit.edu/projects/bosox397/569201

Offline

 

#12 2009-04-11 15:50:32

Penguinsrock
Scratcher
Registered: 2008-11-08
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

bosox397 wrote:

I think I heard the set volume to and the hide/show variable doesn't work online.

I hate when that happens, I say please download to get better quality in project notes and they ignore that. Then they say  something like this: "the sound is all jumbled up" or "what are you saying"


POKEMON & Internets CLICK?
http://internetometer.com/imagesmall/10824.png

Offline

 

#13 2009-04-11 16:49:27

golfer3
Scratcher
Registered: 2008-11-02
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

bosox397 wrote:

No not those hide show blocks. The hide variable/show variable blocks. also loudness doesn't work onliine

true.

Offline

 

#14 2009-04-12 16:09:51

bosox397
Scratcher
Registered: 2008-02-17
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

it really annoys me because then u have to make sprites to cover the variables and they have to be exactly lined up, espicially with words


Dear Scratch Users,
I'm done with scratch, or at least making projects. I have made one last big game, thats both fun and teaches a lesson about water. It'd mean a lot if you gave me feedback.                              http://scratch.mit.edu/projects/bosox397/569201

Offline

 

#15 2009-04-12 19:28:19

golfer3
Scratcher
Registered: 2008-11-02
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

bosox397 wrote:

it really annoys me because then u have to make sprites to cover the variables and they have to be exactly lined up, espicially with words

yeah... your right...

Offline

 

#16 2009-04-18 00:20:53

ManaUser
Scratcher
Registered: 2009-03-11
Posts: 100+

Re: Why Don't My Projects Work Correctly Online?

I found a couple more.

Besides Color, some of the other graphic effects (e.g. Pixelate and Mosaic) don't look quite the same.

Rotated sprites may be positioned differently by one pixel. Normally you wouldn't notice, but in a Tetris type game for instance, it could be important.


http://i.imgur.com/SPYSM.gif http://i.imgur.com/t9k1Z.gif http://i.imgur.com/OwYVa.gif http://i.imgur.com/0qlZq.gif

Offline

 

#17 2009-04-18 12:12:05

bosox397
Scratcher
Registered: 2008-02-17
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

True.


Dear Scratch Users,
I'm done with scratch, or at least making projects. I have made one last big game, thats both fun and teaches a lesson about water. It'd mean a lot if you gave me feedback.                              http://scratch.mit.edu/projects/bosox397/569201

Offline

 

#18 2009-04-18 13:16:39

DsGameMaker
Scratcher
Registered: 2009-04-14
Posts: 89

Re: Why Don't My Projects Work Correctly Online?

If only we were in a world in which scratch projects react the same way online and offline!

Offline

 

#19 2009-04-25 14:13:45

kgordon
Scratcher
Registered: 2009-02-26
Posts: 100+

Re: Why Don't My Projects Work Correctly Online?

I think the hide variable/show variable blocks work online now, one of my projects with those blocks actually does it now, it wasn't really a problem anyway as it was just a graphic (flashing variable) and it only appeared at the end of the game, which only I ever got to as it was a platformer called cliff climber and they can be fairly hard to beat. The graphic was the score flashing before turning into your rating at the end.

Offline

 

#20 2009-05-13 18:13:38

stopmotion100
Scratcher
Registered: 2009-04-02
Posts: 4

Re: Why Don't My Projects Work Correctly Online?

when i get on some computers and i go to a project it shows a grey screen where the project should be.


Stopmotion100  smile

Offline

 

#21 2009-05-13 18:15:18

DawnLight
Scratcher
Registered: 2009-04-25
Posts: 500+

Re: Why Don't My Projects Work Correctly Online?

stopmotion100 wrote:

when i get on some computers and i go to a project it shows a grey screen where the project should be.

That's most likely when the computer does not have Java.

Offline

 

#22 2009-05-25 04:38:43

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

Re: Why Don't My Projects Work Correctly Online?

Here's one that came up again recently...if you use the Pick Random block to choose a sound for the Play Sound block...it will stop the Java Player dead in it's tracks!

*** Update - This is reportedly fixed in version 34 ***

Last edited by Paddle2See (2009-07-29 05:39:00)


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

Offline

 

#23 2009-05-25 09:07:55

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

Paddle2See wrote:

Here's one that came up again recently...if you use the Pick Random block to choose a sound for the Play Sound block...it will stop the Java Player dead in it's tracks!

Wow, I think my projects had that error.

Offline

 

#24 2009-06-06 01:14:50

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

keroro645 wrote:

Paddle2See wrote:

Here's one that came up again recently...if you use the Pick Random block to choose a sound for the Play Sound block...it will stop the Java Player dead in it's tracks!

Wow, I think my projects had that error.

In a game I was doing earlier, I did that but later got rid of it. Good for me...
_____________________________________________
Even if the internet dies, Scratch shall live on.


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#25 2009-06-06 01:17:30

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Why Don't My Projects Work Correctly Online?

Paddle2See wrote:

Timing and Initialization
======================
Often, the reason that projects act differently on the web has to do with the timing of things.  You may have several scripts all starting on a given Broadcast event (for instance) that really need to act in a certain order.  They work fine in Scratch but, because some events happen a little faster or slower online, they don't work right online.  You can usually cure these kind of problems by adding short Wait blocks ahead of the events that should happen later.

Thanks for the information Paddle2See! I tried to upload a new project (finally, it's been a while), except that it never gets past a certain point! In the main screen, there's the Star Wars Logo going away, but after that it gets stuck. I'll try and twerk the different 'wait [ ] seconds' blocks in the project, and see how it goes.

Last edited by Jonathanpb (2009-06-23 01:51:27)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 
  • Index
  •  » FAQ
  •  » Why Don't My Projects Work Correctly Online?

Board footer