Pages: 1
Topic closed
Most of us advanced scratchers know, that once you start making big scripts with long and I mean LONG forever loops, there is lots of lag for the computer to update the screen with the new blocks or numbers or words you entered. Well I just wanted to share my tips to saving time, so you don't have to spend as much time on waiting for the computer to refresh the screen just because you typed in some number or phrase.
1. Don't code while having the game still playing. When you finish coding, you'll test it, then click the stop sign, then fix the mistake, or continue your coding. This will make it a bit slower, so its just not reccomended. There are some places where you have to do this, just so you don't have to waste time reclicking the green flag and waiting for the intro and menu animations to finish. But you should rarely have to do that.
2. Type or script it first, then put it into the loop. For those who don't know, when you get long scripts, and you try to enter a number into a textbox, you will type it in, and then you will have to wait anywhere from 2-6 seconds for it to refresh the screen. I reccomend getting the block with the textbox, put it onto the main script area, type it in, and then insert it into the large script. Same goes for groups of blocks, if you have maybe a set of code maybe 4 blocks, inside an if statement, then do that first, then insert it into the script. Doing this will help a lot, the only problem is that you can't use this in every situation. That leads us to our next tip...
3. Substitute large amounts of the same text box, for a variable. Ok I'll say thats a bit difficult to word out, so let me explain it. When you have something, for example x velocity for some character, instead of writing 'change x velocity by (1.5)' all the time in different places, say 'change x velocity by (playerspeed)', in which player speed is a variable which equals 1.5. Whats also great about this is that when you want to increase the speed because the game is getting a bit slow, where you have at the beggining of the script where you reset the variables, you can just change it there, and then it changes it in all of the other place. Credit to archmage, as I learned the technique from his SSBB games :).
The-Whiz wrote:
Save often. Once I made a huge one-sprite one-script game, and tried to add more blocks, and it froze on me. After about half an hour,it was still frozen. I lost all the progress since my last save.
The-Whiz has a great point. Although for this, because I've never experienced this, I'll say that it depends on your computer, and it depends on what project your making. Although I will say that I reccomend saving because of the Dissapearing Text Glitch. For those of you who haven't heard of it -- This is a glitch where after you type lots and lots of text on the screen, perhaps even if a lot of them are just spaces, they all suddenly dissapear. It says the text is still there, but its hidden. And because this can happen unexpectedly, its reccomend you safe often, whether or not your in risk of this or not.
In conclusion, just like coolstuff says, you should just generally not make big scripts. I half agree with that honestly though. With massive forever loops, it can help, but as I've mentioned before it depends on the situation. If your not sure if it'll work, just test it out. Its possible that it will speed your game up, just it will cause some glitches due to timing and such. In that case, you should look carefully and figure out the problems and fix them.
If you have any ideas, just mention. Hope this helps!
Last edited by Lucario621 (2009-10-14 15:45:07)
Offline
Save often. Once I made a huge one-sprite one-script game, and tried to add more blocks, and it froze on me. After about half an hour,it was still frozen. i lost all the progress since my last save.
Offline
Great tips! I'd also like to suggest avoiding longer scripts altogether, it's a lot easier to program. When you start noticing extreme lag (a few seconds) it might be time for a new script using the broadcast function! Once, I had an ultralong script which my computer couldn't really handle and it took at least 10 seconds to load.
Offline
Lucario621 wrote:
Choose Lucario621 for TBG mod. I have experience (registered Oct. 3 2007), I'm dedicated (went to Scratch Day and Scratch Meetup both at MIT), I'm active, I have good grammer, and I can solve problems without hurting any feelings = )
LOL ironically bad in spelling grammAR
Offline
samurai768 wrote:
Lucario621 wrote:
Choose Lucario621 for TBG mod. I have experience (registered Oct. 3 2007), I'm dedicated (went to Scratch Day and Scratch Meetup both at MIT), I'm active, I have good grammer, and I can solve problems without hurting any feelings = )
LOL ironically bad in spelling grammAR
OH MY GOODNESSSSSSSSSS!!!!!!!!!!!!!!!!!!!
Already 2 people have noticed grammar mistakes in my post. Now YOUUU!?????????
lol i really didn't expect this >.<
Offline
The-Whiz wrote:
Save often. Once I made a huge one-sprite one-script game, and tried to add more blocks, and it froze on me. After about half an hour,it was still frozen. i lost all the progress since my last save.
My computer shut down on me while I was working hard on a recolored sprite and I had to recolor it! So good point The-Whiz
Last edited by scratch_yoshi (2009-11-28 08:48:12)
Offline
Shorten your scripts. Try to turn those very long scripts into short scripts. It will speed up Scratch and if the project is going to be uploaded, it will also work faster.
Offline
Thanks for bumping this up! It's great.
Hey, I was going to suggest for this to be added to Scratch Programming Tutorials, but it was already in there.
Offline
Nice topic!
I wish I had something like that a few days ago. Dx
....................................
I have a suggestion:
Be patient. If you drag a block out of a long script, wait - if you get impatient and try dragging it again, things will only get worse. The same applies to construction issues and such.
That's happened to be several times... it's so irritating.
Fortunately, I've learned.
Offline
None of this can help me. My latest games crash because of sheer graphical strain and complexity on all sprites. :'(
Offline
RHY3756547 wrote:
None of this can help me. My latest games crash because of sheer graphical strain and complexity on all sprites. :'(
RHY is too awesome for scratch D:
Offline
Lucario621 wrote:
RHY3756547 wrote:
None of this can help me. My latest games crash because of sheer graphical strain and complexity on all sprites. :'(
RHY is too awesome for scratch D:
How true.
Offline
Chrischb wrote:
You didn't add my tip...
![]()
I didn't add anybody's tip...
Offline
i wanna make a menu 4 my game but duna how HELP ME!!!!!
Offline
tianabannana, it's best to post a new topic rather than to bump an old unrelated one.
As for your question: Is it a button menu?
Offline
Chrischb wrote:
tianabannana, it's best to post a new topic rather than to bump an old unrelated one.
![]()
As for your question: Is it a button menu?
It's not that old......
Offline
littletonkslover wrote:
Chrischb wrote:
tianabannana, it's best to post a new topic rather than to bump an old unrelated one.
![]()
As for your question: Is it a button menu?It's not that old......
It's not that old now, but it was when the last post was made at the end of February.
If anything, people should add whatever tips they may have left (if there are tips left) and the mods should shut this baby down. It would serve a better purpose that way. -wink-
Offline
One thing I find useful is to try and split up any long blocks of code using the broadcast fonctions. It really helps, especially if you want the script to run quickly.
You can either use one main command script, calling to different snippets of scripts, or you can use different chunks of scripts, each starting when another has finished, and calling for the next when it's finished.
Example (we'll pretend that the few blocks for each action are actually more and more complicated):
[blocks]
<when green flag clicked>
<turn cw( 90 )degrees>
<turn cw( -90 )degrees>
<say[ I don't see anything up there]>
<turn cw( -90 )degrees>
<turn cw( 90 )degrees>
<say[ I don't see anything down there]>
<point in direction( right)>
<move( 10 )steps>
<point in direction( left)>
<move( 10 )steps>
<say[ I don't see anything over there]>
<point in direction(left)>
<move( 10 )steps>
<point in direction( right)>
<move( 10 )steps>
<say[ I don't see anything over there]>
[/blocks]
could be changed into this:
[blocks]
<when green flag clicked>
<broadcast[ look up ]and wait c>
<broadcast[ look down ]and wait c>
<broadcast[ look right ]and wait c>
<broadcast[ look left ]and wait c>
<when I receive[ look up]>
<turn cw( 90 )degrees>
<turn cw( -90 )degrees>
<say[ I don't see anything up there]>
[/blocks]
etc...
or:
[blocks]
<when green flag clicked>
<turn cw( 90 )degrees>
<turn cw( -90 )degrees>
<say[ I don't see anything up there]>
<broadcast[ look down ]>
<when I receive[ look down ]>
<say[ I don't see anything up there]>
<turn cw( -90 )degrees>
<turn cw( 90 )degrees>
<broadcast[ look right ]>
[/blocks]
etc...
Offline
Llamalover wrote:
One thing I find useful is to try and split up any long blocks of code using the broadcast fonctions. It really helps, especially if you want the script to run quickly.
You can either use one main command script, calling to different snippets of scripts, or you can use different chunks of scripts, each starting when another has finished, and calling for the next when it's finished.
Example (we'll pretend that the few blocks for each action are actually more and more complicated):
[blocks]
<when green flag clicked>
<turn cw( 90 )degrees>
<turn cw( -90 )degrees>
<say[ I don't see anything up there]>
<turn cw( -90 )degrees>
<turn cw( 90 )degrees>
<say[ I don't see anything down there]>
<point in direction( right)>
<move( 10 )steps>
<point in direction( left)>
<move( 10 )steps>
<say[ I don't see anything over there]>
<point in direction(left)>
<move( 10 )steps>
<point in direction( right)>
<move( 10 )steps>
<say[ I don't see anything over there]>
[/blocks]
could be changed into this:
[blocks]
<when green flag clicked>
<broadcast[ look up ]and wait c>
<broadcast[ look down ]and wait c>
<broadcast[ look right ]and wait c>
<broadcast[ look left ]and wait c>
<when I receive[ look up]>
<turn cw( 90 )degrees>
<turn cw( -90 )degrees>
<say[ I don't see anything up there]>
[/blocks]
etc...
or:
[blocks]
<when green flag clicked>
<turn cw( 90 )degrees>
<turn cw( -90 )degrees>
<say[ I don't see anything up there]>
<broadcast[ look down ]>
<when I receive[ look down ]>
<say[ I don't see anything up there]>
<turn cw( -90 )degrees>
<turn cw( 90 )degrees>
<broadcast[ look right ]>
[/blocks]
etc...
There is one huge problem with that though.
BROADCASTS LAG LIKE [removed]!!!!!!!!!!!!!!!!!!!!!
Last edited by juststickman (2010-04-06 08:25:02)
Offline
Topic closed
Pages: 1