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.
Last edited by Shadowed1 (2010-10-07 21:07:16)
Offline
You just take one out.
Offline
soupoftomato wrote:
You just take one out.
![]()
It's more like for every 1 step for one, it's 2 steps for another.
I like it!
Offline
ScratchReallyROCKS wrote:
soupoftomato wrote:
You just take one out.
![]()
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?
Offline
Harakou wrote:
ScratchReallyROCKS wrote:
soupoftomato wrote:
You just take one out.
![]()
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?
![]()
yeah, but that only allows for two priority levels.
Offline
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?
![]()
yeah, but that only allows for two priority levels.
True. Maybe there could be various priority levels, with atomic as the highest priority?
Offline
Harakou wrote:
ScratchReallyROCKS wrote:
Harakou wrote:
Even better, why not just have the option to make c blocks atomic?![]()
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.
Offline
This sounds pretty good to me!

Offline
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)
Offline
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
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.
Offline
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.
![]()
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
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.
![]()
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.
Offline
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.
![]()
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
This is what happens (Different online than offline): http://scratch.mit.edu/projects/ethanco/1344297
Offline
I have thought about this before! I like it!
Offline