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

#1 2008-10-19 14:42:25

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Behaviour chanign online/offline, preventing game from working online.

My new version of minesweeper uses a list to keep track of mine locations.

http://scratch.mit.edu/projects/Mayhem/295207

Its a 10x10 play area, and to see what number needs to be displayed the scripts add up the 8 squares surrounding the one you click on.

In order for there be something to add up if you click on the edge, the list is 144 items long, creating a "virtual" 12x12 square - the 10x10 play area plus a strip of empty squares along each side of that play area.

To set up the grid:
First, 20 "1"s are added to the list, representing mines.  Then, 80 "0"s are put in randomly, creating the safe squares.

To turn this from a 10x10 grid into the required 12x12 virtual grid, extra empty squares are added - these could be "0"s but for debugging purposes I have made them "X"s:

The script inserts 12 at the start of the list, creating the bottom row of the virtual grid.
Then, in order it inserts an "X" at:
13 and 24 (the left and right edge of the 2nd row, respectively)
25 and 36
37 and 48 etc etc

Then, to put the top row on, it inserts 12 "x"s at the end of the list.

It words perfectly online, and debugging tests show that the "X"s are being put into the right place in the list.

However,on the website, when the contents of the list are translated into the contents of the grid, all the squares are all misplaced one row to the right, and I can't work out why.

Help!

(To see what I mean, download then compare the website version, where it will (on failure) print a double row of "X"s on the left of the grid with a game run offline)


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#2 2008-10-22 01:42:27

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Behaviour chanign online/offline, preventing game from working online.

Thesame is also true in my Chess project - works fine offline, but something interferes with the creation or reading of lists on the web.

Or it may be something to do with the definition of x/y reading points, but I would not have thought so  hmm

http://scratch.mit.edu/projects/Mayhem/298314


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#3 2008-10-22 05:47:15

Digimath
Scratcher
Registered: 2007-07-07
Posts: 100+

Re: Behaviour chanign online/offline, preventing game from working online.

Could the problem be related to this error? http://scratch.mit.edu/forums/viewtopic.php?id=9661


I've updated my text adventure game.
Colossal Cave 150http://scratch.mit.edu/static/projects/Digimath/3003787_sm.png

Offline

 

#4 2008-10-22 14:30:59

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Behaviour chanign online/offline, preventing game from working online.

Could be!  I'll try fixing the chess game... fixing minesweeper might be harder :S


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#5 2008-11-22 17:45:30

MrWhiskers
Scratcher
Registered: 2007-05-25
Posts: 11

Re: Behaviour chanign online/offline, preventing game from working online.

http://scratch.mit.edu/forhttp://scratch.mit.edu/forums/viewtopic.php?id=10831#req_messageums/http://scratch.mit.edu/forums/viewtopic.php?id=10831#rhttp://scratch.mit.edu/forums/viewtopic.php?id=10831#req_messageeq_messaghttp://scratch.mit.edu/forums/viewtopic.php?id=10831#req_messageeviewtopic.phhttp://scratch.mit.edu/forums/viewtopic.php?id=10831#req_messagep?id=10831#req_message
mad

Offline

 

Board footer