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

#1 2012-04-12 22:00:22

Karra
Scratcher
Registered: 2009-01-14
Posts: 100+

Consolidating Scripts

While coding a little scroller, a question popped into my mind.

If I consolidate all the necessary movement scripts for the player sprite into one forever loop, would it:

1) Respond quicker than having several scripts running simultaneously?
2) Cause less lag than having several scripts running simultaneously?


http://i305.photobucket.com/albums/nn229/myrkalyk/kar.png

Offline

 

#2 2012-04-12 22:03:15

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: Consolidating Scripts

Well, that depends. If they are in forever loops, then it would.


Get ready for domination of:  tongue

Offline

 

#3 2012-04-12 22:07:34

Karra
Scratcher
Registered: 2009-01-14
Posts: 100+

Re: Consolidating Scripts

coolhogs wrote:

Well, that depends. If they are in forever loops, then it would.

That's a yes to both questions?


http://i305.photobucket.com/albums/nn229/myrkalyk/kar.png

Offline

 

#4 2012-04-13 09:08:15

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Consolidating Scripts

It will reduce lag.  Whether that will make them respond quicker isn't certain, as it depends on what is in your loops.  Remember, if they're all in the same loop, each instruction has to wait for the ones before it to activate before it can run.  If you have a long script (e.g. with a "wait (0.1) secs" or a loop), all the other scripts will have to wait longer to be actiavted.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#5 2012-04-13 10:36:33

Karra
Scratcher
Registered: 2009-01-14
Posts: 100+

Re: Consolidating Scripts

MoreGamesNow wrote:

It will reduce lag.  Whether that will make them respond quicker isn't certain, as it depends on what is in your loops.  Remember, if they're all in the same loop, each instruction has to wait for the ones before it to activate before it can run.  If you have a long script (e.g. with a "wait (0.1) secs" or a loop), all the other scripts will have to wait longer to be actiavted.

Thank you; that's the answer I needed. :3


http://i305.photobucket.com/albums/nn229/myrkalyk/kar.png

Offline

 

Board footer