This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » Suggestions
  •  » Remove or Replace Characters in Variables and lists.

#1 2012-01-20 14:14:12

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Remove or Replace Characters in Variables and lists.

I think Scratch should have a Remove block and Replace block for variables and lists.
It would  work like this.

Replace block:
[When flag clicked]
[Set (Whatever) to (1222333111222)]
[Replace (1)s of variable (Whatever) with (5)s]

(Now the Variable would look like this: 5222333555222).
------------------------------------------------------------------------------
Remove block:
[When flag clicked]
[Set (Whatever) to (192399994999999999999599996)]
[Remove (9)s of variable (Whatever)]

(Now the Variable would look like this: 123456).
-----------------------------------------------------------------------------
These blocks would be EXTREMELY helpful to me.
And I would love it even more if you could remove/replace, Spaces.


Supporters:

CheeseMunchy
GOD_MOD3
destroydaworld111

Last edited by CheeseMunchy (2012-01-21 12:46:17)


6418,

Offline

 

#2 2012-01-20 16:46:24

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

Re: Remove or Replace Characters in Variables and lists.

Well, that would be nice, but  hard to code.


I made a MC texture pack! Get it at planetminecraft!
http://i.imgur.com/0EG0u.png

Offline

 

#3 2012-01-20 16:50:31

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Re: Remove or Replace Characters in Variables and lists.

G0D_M0D3 wrote:

Well, that would be nice, but  hard to code.

What do you mean?


6418,

Offline

 

#4 2012-01-20 17:24:11

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

Re: Remove or Replace Characters in Variables and lists.

CheeseMunchy wrote:

G0D_M0D3 wrote:

Well, that would be nice, but  hard to code.

What do you mean?

Well, every block in scratch is coded in Squeak.

For example, the move (num) steps block's codde looks like this:

Code:

forward: t1 
    | t2 t3 t4 t5 t6 |
    t2 _ rotationDegrees degreesToRadians.
    t3 _ t2 cos @ t2 sin * t1.
    t4 _ self position + t3.
    t5 _ t4 x.
    t6 _ t4 y.
    t5 isNaN ifTrue: [t5 _ 0].
    t5 isInf ifTrue: [t5 _ t5 sign * 10000].
    t6 isNaN ifTrue: [t6 _ 0].
    t6 isInf ifTrue: [t6 _ t6 sign * 10000].
    self position: t5 @ t6.
    self keepOnScreen

So something even less simple would require more code.


I made a MC texture pack! Get it at planetminecraft!
http://i.imgur.com/0EG0u.png

Offline

 

#5 2012-01-20 18:14:32

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Re: Remove or Replace Characters in Variables and lists.

G0D_M0D3 wrote:

CheeseMunchy wrote:

G0D_M0D3 wrote:

Well, that would be nice, but  hard to code.

What do you mean?

Well, every block in scratch is coded in Squeak.

For example, the move (num) steps block's codde looks like this:

Code:

forward: t1 
    | t2 t3 t4 t5 t6 |
    t2 _ rotationDegrees degreesToRadians.
    t3 _ t2 cos @ t2 sin * t1.
    t4 _ self position + t3.
    t5 _ t4 x.
    t6 _ t4 y.
    t5 isNaN ifTrue: [t5 _ 0].
    t5 isInf ifTrue: [t5 _ t5 sign * 10000].
    t6 isNaN ifTrue: [t6 _ 0].
    t6 isInf ifTrue: [t6 _ t6 sign * 10000].
    self position: t5 @ t6.
    self keepOnScreen

So something even less simple would require more code.

Oh, I thought you were talking about something else.


6418,

Offline

 

#6 2012-01-21 10:14:52

puppetadventurer
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: Remove or Replace Characters in Variables and lists.

My ROT13 project's script would be so much shorter if I had that  tongue


3

Offline

 

#7 2012-01-21 12:03:48

Mineo
New Scratcher
Registered: 2011-11-17
Posts: 31

Re: Remove or Replace Characters in Variables and lists.

puppetadventurer wrote:

My ROT13 project's script would be so much shorter if I had that  tongue

So you support?  tongue

Offline

 

#8 2012-01-21 12:40:48

destroydaworld111
New Scratcher
Registered: 2011-10-04
Posts: 29

Re: Remove or Replace Characters in Variables and lists.

I support this idea.

Offline

 

#9 2012-01-22 10:17:35

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Remove or Replace Characters in Variables and lists.

It should be a single reporter block: (replace [] with [] in []). To remove, leave the WITH field blank.  wink
And Scratch 2.0 is going to be in Flash, and I think they have a function that does exactly this.  big_smile

Last edited by scimonster (2012-01-22 10:18:23)

Offline

 

#10 2012-01-22 20:23:07

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Re: Remove or Replace Characters in Variables and lists.

scimonster wrote:

It should be a single reporter block: (replace [] with [] in []). To remove, leave the WITH field blank.  wink
And Scratch 2.0 is going to be in Flash, and I think they have a function that does exactly this.  big_smile

GREAT!  big_smile
I'm working on a project where this feature is Vital.


6418,

Offline

 

#11 2012-01-22 22:25:42

K-Jam
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: Remove or Replace Characters in Variables and lists.

G0D_M0D3 wrote:

Well, that would be nice, but  hard to code.

Yeah. But maybe they'll have it scratch 2.0


http://images.inmagine.com/img/imagezoo/iz162/Iz162012.jpg COMPASS!!!

Offline

 

#12 2012-01-24 11:11:09

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Re: Remove or Replace Characters in Variables and lists.

Bump.


6418,

Offline

 

#13 2012-01-27 22:55:21

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Re: Remove or Replace Characters in Variables and lists.

Bump.
Y u fall down topic? D:


6418,

Offline

 
  • Index
  •  » Suggestions
  •  » Remove or Replace Characters in Variables and lists.

Board footer