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

#1 2012-08-11 04:59:08

Kenichi10B
Scratcher
Registered: 2010-12-23
Posts: 48

Extra Block

I realised, when making one of my projects, that it's nearly impossible to make a script that would allow you to find the highest/lowest value in a list. I'd like it if the Scratch Team could make that in the next version of Scratch. I was trying to make my tower defense game have target priorities by using lists for distances,etc. but I couldn't figure out how to do that without making Scratch go extremely slow. I'd like it if Scratch 2.0 had that block.

Offline

 

#2 2012-08-11 05:01:01

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

Re: Extra Block

You're asking the floor and ceiling block? It was suggested before if I remembered correctly.  wink

I support.


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

Offline

 

#3 2012-08-11 05:07:18

soniku3
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Extra Block

jontmy00 wrote:

You're asking the floor and ceiling block? It was suggested before if I remembered correctly.  wink

I support.

I S-U-P-P-O-R-T-!


internet's all about cats today.

Offline

 

#4 2012-08-11 05:53:29

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

Re: Extra Block

Well, this workaround:

set [counter v] to [1]
set [done? v] to [0]
repeat until <(done?) = [1]>
 set [done v] to [1]
 repeat ((length of [list v]) - (1))
  if <(item (counter) of [list v]) < (item ((counter) + (1)) of [list v])>
   set [temp v] to (item (counter) of [list v])
   replace item (counter) of [list v] with (item ((counter) + (1)) of [list v])
   replace item ((counter) + (1)) of [list v] with (temp)
   set [done v] to [0]
  end
  change [counter v] by (1)
 end
end
It works quite well, and is nearly instant in the Flash player.


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

Offline

 

#5 2012-08-11 06:00:24

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

Re: Extra Block

BirdByte wrote:

Well, this workaround:

set [counter v] to [1]
set [done? v] to [0]
repeat until <(done?) = [1]>
 set [done v] to [1]
 repeat ((length of [list v]) - (1))
  if <(item (counter) of [list v]) > (item ((counter) + (1)) of [list v])>
   set [temp v] to (item (counter) of [list v])
   replace item (counter) of [list v] with (item ((counter) + (1)) of [list v])
   replace item ((counter) + (1)) of [list v] with (temp)
   set [done v] to [0]
  end
  change [counter v] by (1)
 end
end
It works quite well, and is nearly instant in the Flash player.

But will still be laggy if you have a ton of scripts.  tongue


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

Offline

 

#6 2012-08-11 09:18:36

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Extra Block

^^^
no it won't, thats kinda a myth. The players run just as quick with 200 scripts as it does with one.


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#7 2012-08-11 12:22:16

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Extra Block

jontmy00 wrote:

You're asking the floor and ceiling block? It was suggested before if I remembered correctly.  wink

I support.

Floor/ceiling blocks would be completely different to what's being suggested, though I would like those too.

I support.


Why

Offline

 

#8 2012-08-11 12:26:29

Seil
Scratcher
Registered: 2011-09-02
Posts: 100+

Re: Extra Block

If you're asking for a block that reports the highest/lowest value in a list, then I support.

The only problem is, lists are not limited to only numeric values.


http://legacy-cdn.smosh.com/smosh-pit/022011/spongebob-gif-lol.gif

Offline

 

Board footer