So I have a scratch project here
When it rewrites a block after it generates the terrain (clicking), it scans the X list for matching locations, then checks if that same Y item is correct, if it is not it goes to the next item.
Any way to optimize this?
Offline
Hmmm...I'm not exactly sure how to make the script run faster. However, you could put a sprite up at the beginning telling people to put their flash player in turbo mode, and then they could turn it off when not needed.
Offline
stevetheipad wrote:
Hmmm...I'm not exactly sure how to make the script run faster. However, you could put a sprite up at the beginning telling people to put their flash player in turbo mode, and then they could turn it off when not needed.
Thats what I am doing now, and it works well, but a way to figure out where to change the data without searching is what I need.
Offline
stevetheipad wrote:
Hmmm...I'm not exactly sure how to make the script run faster. However, you could put a sprite up at the beginning telling people to put their flash player in turbo mode, and then they could turn it off when not needed.
Putting it in Turbo generally makes it run too fast.
Offline
RedRocker227 wrote:
stevetheipad wrote:
Hmmm...I'm not exactly sure how to make the script run faster. However, you could put a sprite up at the beginning telling people to put their flash player in turbo mode, and then they could turn it off when not needed.
Putting it in Turbo generally makes it run too fast.
Then make the project run slower, so it's not "too fast" when in turbo mode.
Offline
stevetheipad wrote:
RedRocker227 wrote:
stevetheipad wrote:
Hmmm...I'm not exactly sure how to make the script run faster. However, you could put a sprite up at the beginning telling people to put their flash player in turbo mode, and then they could turn it off when not needed.
Putting it in Turbo generally makes it run too fast.
Then make the project run slower, so it's not "too fast" when in turbo mode.
The only way to do that would be to have loads of "wait" blocks, and that makes it run too slow.
Offline
RedRocker227 wrote:
stevetheipad wrote:
RedRocker227 wrote:
Putting it in Turbo generally makes it run too fast.Then make the project run slower, so it's not "too fast" when in turbo mode.
The only way to do that would be to have loads of "wait" blocks, and that makes it run too slow.
No, that's not correct. It's not about making it wait longer, it's about making it do a lot of work to the point where the speed has to slow down to complete all the tasks.
Offline
stevetheipad wrote:
RedRocker227 wrote:
stevetheipad wrote:
Then make the project run slower, so it's not "too fast" when in turbo mode.The only way to do that would be to have loads of "wait" blocks, and that makes it run too slow.
No, that's not correct. It's not about making it wait longer, it's about making it do a lot of work to the point where the speed has to slow down to complete all the tasks.
To make it slow down to the correct speed using that method, the script would exceed the maximum script length.
Offline
Ok Guys, Turbo works well, but say we have this
LISTS
XPOS
10
15
20
YPOS
-5
-10
-15
NAME
WOOD
GRASS
DIRT
And I want to find the index where X=10 and Y=-10, so I can find the NAME for that location right? One thing to note about the project is the indexes never move, therefor the upperleft hand block is always #1 on all three lists, the only value that changes is the NAME
Offline
In general, I'd think your best bet is use a fixed location in the list for each terrain block position. For example if your world were 10x10, you would always have a list of 100 blocks, even if some are empty. Then if you wanted say the block at 7,3 it would be item 73 on the list. That way you don't in a separate list for positions. It's going to take a little more work to convert from Scratch's XY coordinates, but that's the basic idea.
Offline
ManaUser wrote:
In general, I'd think your best bet is use a fixed location in the list for each terrain block position. For example if your world were 10x10, you would always have a list of 100 blocks, even if some are empty. Then if you wanted say the block at 7,3 it would be item 73 on the list. That way you don't in a separate list for positions. It's going to take a little more work to convert from Scratch's XY coordinates, but that's the basic idea.
Thats what I was thinking......
does anyone have any easy ways to do this or do I have to take the time to do this? Its about 700 positions
Offline
RedRocker227 wrote:
stevetheipad wrote:
RedRocker227 wrote:
The only way to do that would be to have loads of "wait" blocks, and that makes it run too slow.
No, that's not correct. It's not about making it wait longer, it's about making it do a lot of work to the point where the speed has to slow down to complete all the tasks.
To make it slow down to the correct speed using that method, the script would exceed the maximum script length.
No, actually, there are ways to slow down the process without going over-board.
Offline