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

#1 2010-02-21 12:14:03

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Item before?

I was just thinking. Is there an eqivelent for making an <before item <thing>> and an <after item<thing>> on a list?


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#2 2010-02-21 12:21:49

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Item before?

Make a variable called "current".

Item before and after (you'll need to run through the whole list):

Item (current-1) of list
Item (current+1) of list


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#3 2010-02-21 12:30:29

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: Item before?

juststickman wrote:

Make a variable called "current".

Item before and after (you'll need to run through the whole list):

Item (current-1) of list
Item (current+1) of list

What if the thing in the list is at a random location?


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#4 2010-02-21 12:38:38

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Item before?

That's why you need a:
Set current to 0
Repeat (length of (list))
<[change current by (1)]?
<Do soemthing>


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#5 2010-02-21 13:02:20

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: Item before?

Still doesn't seem to work. Oh well never mind.


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

Board footer