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

#1 2012-04-13 13:24:30

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Does making more scripts have an affect on the project?

I've always wondered if when you create more scripts, whether that affects your project in any way (e.g. makes it lag, more memory etc.). Often I end up creating more complex scripts instead of simpler ones because I'm worried that too many scripts would have some affect. For example, I would write this:

when gf clicked
set [game] to [0]
switch to costume [1]
forever
if <(timer) = [10]>
set [game] to [1]
end
if <[game] = [1]>
switch to costume [2]
say [game over]
end
end
thanks  smile

Instead of this:

when gf clicked
switch to costume [1]
forever
if <(timer) = [10]>
broadcast [game over]
end
end
when I receive [game over]
switch to costume [2]
say [game over]


http://i46.tinypic.com/ao03lk.png

Offline

 

#2 2012-04-13 13:29:53

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

Re: Does making more scripts have an affect on the project?

Yes it can. It also helps if you take out unnessecary scripts. This is a great way to make 1s1s projects (1 sprite, 1 script)


Get ready for domination of:  tongue

Offline

 

#3 2012-04-13 18:26:17

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: Does making more scripts have an affect on the project?

In my experience, combining scripts will cause less lag overall, but slower response times.

Last edited by trinary (2012-04-13 18:26:37)


http://trinary.tk/images/signature_.php

Offline

 

#4 2012-04-13 18:36:17

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

Re: Does making more scripts have an affect on the project?

trinary wrote:

In my experience, combining scripts will cause less lag overall, but slower response times.

I think the reason it decreases response times is because longer scripts obviously take longer to execute, so it'll take longer to reach the boolean. (That is what you mean, right?  tongue )


Why

Offline

 

#5 2012-04-13 18:39:56

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

Re: Does making more scripts have an affect on the project?

trinary wrote:

In my experience, combining scripts will cause less lag overall, but slower response times.

By response times, I believe trinary means the time it takes each individual script (if they were seperate) to act, given a condition.

For instance:

when gf clicked
forever
if<condition1>
script 1
end
if<condition2>
script 2
end
This script will have less lag overall, but script 1 and script 2 will be slower to react when their respective conditions are true, especially if one of them was already activated (because the script has to execute the accepted script before checking the conditional of the other one.

Edit: RedRocker outposted me x(.  But yes, he is right.

Last edited by MoreGamesNow (2012-04-13 18:40:54)


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

Offline

 

#6 2012-04-13 18:42:54

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: Does making more scripts have an affect on the project?

RedRocker227 wrote:

trinary wrote:

In my experience, combining scripts will cause less lag overall, but slower response times.

I think the reason it decreases response times is because longer scripts obviously take longer to execute, so it'll take longer to reach the boolean. (That is what you mean, right?  tongue )

That is what I mean.  smile


http://trinary.tk/images/signature_.php

Offline

 

Board footer