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

#1 2010-10-07 21:06:30

Shadowed1
Scratcher
Registered: 2010-01-19
Posts: 100+

Having a script's 'priority'

So if you had scripts that cancel each-other out, such as this:
[blocks]
<when green flag clicked>
<forever>
<hide>
<when green flag clicked>
<forever>
<show>

If you could set the priority of the script (1 being the highest and infinity being the lowest) so that if these scripts were cancelling each-other out, do this script and not the other one, so that the program knows what to do.
P.S If they're supposed to be wrestling, such as with the scrolling demo, then you could set the priority to be the same, or not change it in the first place.
smile

Last edited by Shadowed1 (2010-10-07 21:07:16)


*Insert some witty, funny or sarcastic comment here*

Offline

 

#2 2010-10-07 21:30:46

soupoftomato
Scratcher
Registered: 2009-07-18
Posts: 1000+

Re: Having a script's 'priority'

You just take one out.  neutral


I'm glad to think that the community will always be kind and helpful, the language will always be a fun and easy way to be introduced into programming, the motto will always be: Imagine, Program, Share - Nomolos

Offline

 

#3 2010-10-07 21:48:15

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Having a script's 'priority'

soupoftomato wrote:

You just take one out.  neutral

It's more like for every 1 step for one, it's 2 steps for another.

I like it!


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#4 2010-10-07 21:55:03

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Having a script's 'priority'

ScratchReallyROCKS wrote:

soupoftomato wrote:

You just take one out.  neutral

It's more like for every 1 step for one, it's 2 steps for another.

I like it!

Even better, why not just have the option to make c blocks atomic?  big_smile


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#5 2010-10-07 22:26:30

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Having a script's 'priority'

Harakou wrote:

ScratchReallyROCKS wrote:

soupoftomato wrote:

You just take one out.  neutral

It's more like for every 1 step for one, it's 2 steps for another.

I like it!

Even better, why not just have the option to make c blocks atomic?  big_smile

yeah, but that only allows for two priority levels.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#6 2010-10-07 22:36:36

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Having a script's 'priority'

ScratchReallyROCKS wrote:

Harakou wrote:

ScratchReallyROCKS wrote:


It's more like for every 1 step for one, it's 2 steps for another.

I like it!

Even better, why not just have the option to make c blocks atomic?  big_smile

yeah, but that only allows for two priority levels.

True. Maybe there could be various priority levels, with atomic as the highest priority?


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#7 2010-10-08 06:59:12

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Having a script's 'priority'

Harakou wrote:

ScratchReallyROCKS wrote:

Harakou wrote:


Even better, why not just have the option to make c blocks atomic?  big_smile

yeah, but that only allows for two priority levels.

True. Maybe there could be various priority levels, with atomic as the highest priority?

That was the point of this.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#8 2010-10-08 11:17:28

gettysburg11
Scratcher
Registered: 2008-06-14
Posts: 1000+

Re: Having a script's 'priority'

This sounds pretty good to me!  smile


http://i256.photobucket.com/albums/hh184/mnacmilan/LOGO_ACMILAN-Splash.gif

Offline

 

#9 2010-10-08 15:05:58

steppenwulf
Scratcher
Registered: 2009-07-23
Posts: 1000+

Re: Having a script's 'priority'

Setting infinity as the lowest and 1 as the highest would be a little confusing wouldn't it?

If I were to implement this in Scratch, I would make it so zero or one was the lowest, and then have the priority increase from there (ei. 2 then 3 then 4 etc...).

Last edited by steppenwulf (2010-10-08 15:06:10)


I'm graduating HS this April and going to college in the Fall.

Offline

 

#10 2010-10-08 16:13:08

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Having a script's 'priority'

Interesting idea!

I don't think it's entirely necessary (or even possible, really) because Scratch is a simple sequential programming language. It isn't thinking to itself, "Oh, dear - I'm telling myself to hide and show and the same time! What do I do?" It's thinking to itself, "Hide show hide show hide show." It doesn't really think of it as cancelling the scripts out.

Offline

 

#11 2010-10-08 23:45:03

Shadowed1
Scratcher
Registered: 2010-01-19
Posts: 100+

Re: Having a script's 'priority'

No I mean other scripts, not the hide-show one I did.
I see what you mean though. It would be pretty unlikely for two scripts to be in that situation.


*Insert some witty, funny or sarcastic comment here*

Offline

 

#12 2010-10-09 06:32:27

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Having a script's 'priority'

Shadowed1 wrote:

It would be pretty unlikely for two scripts to be in that situation.

Actually, it happens quite often, especially with newer Scratchers.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#13 2010-10-09 21:33:18

Shadowed1
Scratcher
Registered: 2010-01-19
Posts: 100+

Re: Having a script's 'priority'

OK, let's just say that SCRIPT1 is 'opposing' SCRIPT2 like the 'hide-show' thing. So the whole Scratch project would go OUT OF CONTROL!!!!!!!! But you could have two new blocks that goes like this:
if script1 is 'opposing' script 2, set script2's priority to 2 and set script1's priority to 1.
Those could be the blocks that you could introduce.
wink


*Insert some witty, funny or sarcastic comment here*

Offline

 

#14 2010-10-09 21:37:33

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Having a script's 'priority'

Shadowed1 wrote:

OK, let's just say that SCRIPT1 is 'opposing' SCRIPT2 like the 'hide-show' thing. So the whole Scratch project would go OUT OF CONTROL!!!!!!!! But you could have two new blocks that goes like this:
if script1 is 'opposing' script 2, set script2's priority to 2 and set script1's priority to 1.
Those could be the blocks that you could introduce.
wink

Interesting...

But it just doesn't make sense. It doesn't think of the "Hide" and "Show" blocks as opposites, and they aren't actually executing at exactly the same time. It would just be difficult to program something that detects that two scripts are opposing eachother because it's thinking "Hide show hide show hide show..." - it's just thinking the two commands, one after the other.

Offline

 

#15 2010-10-09 21:43:19

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Having a script's 'priority'

coolstuff wrote:

Shadowed1 wrote:

OK, let's just say that SCRIPT1 is 'opposing' SCRIPT2 like the 'hide-show' thing. So the whole Scratch project would go OUT OF CONTROL!!!!!!!! But you could have two new blocks that goes like this:
if script1 is 'opposing' script 2, set script2's priority to 2 and set script1's priority to 1.
Those could be the blocks that you could introduce.
wink

Interesting...

But it just doesn't make sense. It doesn't think of the "Hide" and "Show" blocks as opposites, and they aren't actually executing at exactly the same time. It would just be difficult to program something that detects that two scripts are opposing eachother because it's thinking "Hide show hide show hide show..." - it's just thinking the two commands, one after the other.

Right. A computer doesn't interpret code the way we do, which is why glitches occur. The computer doesn't know the intent of the code, it just knows what the code says to do, and follows it exactly.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#16 2010-10-09 21:57:24

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Having a script's 'priority'

Harakou wrote:

coolstuff wrote:

Shadowed1 wrote:

OK, let's just say that SCRIPT1 is 'opposing' SCRIPT2 like the 'hide-show' thing. So the whole Scratch project would go OUT OF CONTROL!!!!!!!! But you could have two new blocks that goes like this:
if script1 is 'opposing' script 2, set script2's priority to 2 and set script1's priority to 1.
Those could be the blocks that you could introduce.
wink

Interesting...

But it just doesn't make sense. It doesn't think of the "Hide" and "Show" blocks as opposites, and they aren't actually executing at exactly the same time. It would just be difficult to program something that detects that two scripts are opposing eachother because it's thinking "Hide show hide show hide show..." - it's just thinking the two commands, one after the other.

Right. A computer doesn't interpret code the way we do, which is why glitches occur. The computer doesn't know the intent of the code, it just knows what the code says to do, and follows it exactly.

Precisely! It's kind of hard to explain how computers think, but they never question what's going on. They just sequentially do task after task. The thing is that it's all done with circuitry so it's pretty much instantaneous, so it may seem like two things are happening at once.

Offline

 

#17 2010-10-09 23:29:51

ethanco
Scratcher
Registered: 2009-09-28
Posts: 12

Re: Having a script's 'priority'

This is what happens (Different online than offline): http://scratch.mit.edu/projects/ethanco/1344297

Offline

 

#18 2010-10-18 05:37:55

Shadowed1
Scratcher
Registered: 2010-01-19
Posts: 100+

Re: Having a script's 'priority'

Yeah...
you would never be able to make it think that way...
it wouldn't question whatever you put in, it would just do them.


*Insert some witty, funny or sarcastic comment here*

Offline

 

#19 2010-10-18 06:29:04

2l84zwamani
Scratcher
Registered: 2010-09-27
Posts: 100+

Re: Having a script's 'priority'

I have thought about this before! I like it!


I will be a Ms. Pickle Dr. Deadpebble Great Person <forever>
http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3 GROB THE SLIME WILL TAKE OVER THE WORLD!

Offline

 

Board footer