The Daily Click ::. Forums ::. Klik Coding Help ::. Fastloop again... argh
 

Post Reply  Post Oekaki 
 

Posted By Message

Chrisbo



Registered
  02/01/2002
Points
  794
10th January, 2007 at 00:45:55 -

OK. So here's the deal. My level loader seems to work....without using fastloops. But then it loads slow as hell. (The equivalent of saying "every 00'00'00": do X")

If I remove the fastloop events, it works. But when I add them in, it's as if the fastloop skips the events altogether. Am I just using the fastloops wrong? I guess I will reveal my code (!) so hopefully someone can help me out:

Fastloop object code:

Start of Frame:
List File: Load List File "levels\"+Str$(Global Value B)+".txt"
List File: Save List File WindowsDirectory$( "File" )+"\temp.lvl"
Trigger Loop #1 Once
Set Counter 1 to Global Value B

Loop Trigger #1
List File: Reset
List File: Load List File WindowsDirectory$( "File" )+"\temp.lvl"
Set position (Loading Object) to 112,0 (loading object is just an active object)
Start Loop #2 220 times

Loop Trigger #2
+ Loading Object is Overlapping Tile
Set direction (Tile) to Val(List Line Text$( "Object Coordinates", Loop Step( "Fast Loop object", 3)+1))
Set position (Loading object) to (Loading Object + 48,0)

Loop Trigger #2
+ X Position (Loading Object) Is >= 640
Set X Position (Loading Object) to 112

Loop #2 Position >=220
Stop Loop #2

I converted it over the best I could to the built in fastloop stuff but it won't work. It doesn't seem to recognize the "On Loop 2" condition or something. Anyone have any ideas? Anybody here trustworthy that I can send my source to?

 
hay

CodeCannon

of DringleTopia

Registered
  13/04/2006
Points
  208
10th January, 2007 at 06:54:35 -

I think that if you have multiple events for a loop, the first event will loop 220 times all at once, then after that the next event will loop 220 times, and so on.. ie. instead of going 1 - 2 - 3 - 1 - 2 - 3, it goes 1 - 1 - 1 - 2 - 2 - 2 - 3 - 3 - 3...

In the first Loop #2 event, try starting a new loop ie. "Loop #2 - Check" (1 time) and change the last 2 events to use "Loop #2 - Check".

Image Edited by the Author.

 
_
CodeCannon
http://www.dringletopia.da.ru/

Hernan



Registered
  04/03/2003
Points
  707

VIP Member
10th January, 2007 at 09:36:34 -

What Codecannon says is not true.

Looking at your code, it seems to have a huge error: Loop Step( "Fast Loop object", 3)+1)
And Loop Trigger 3 is zero. Change it to 2.

Also it's not needed to create
Loop #2 Position >=220
Stop Loop #2

Loops end by itself. This line wouldnt work anyway, because you didn't add "On Loop Trigger #2"

 
This space is for rent

CodeCannon

of DringleTopia

Registered
  13/04/2006
Points
  208
10th January, 2007 at 10:42:24 -

Sorry, my mistake.
Thanks Hernan, I did a test and you're right - it does go 1 - 2 - 3.

Image Edited by the Author.

 
_
CodeCannon
http://www.dringletopia.da.ru/

Chrisbo



Registered
  02/01/2002
Points
  794
10th January, 2007 at 18:06:03 -

Hernan, sorry the 3 was a mistake, I meant to type 2.

But here's the thing, I can't create an event like that anyway with the built in fastloops. It either says mixed strings and numbers or syntax error. So what I did it removed the whole loopstep part, and added an extra event to set the list object to the next line instead of all in one. But it doesn't work :| (with fastloops)

Image Edited by the Author.

 
hay

Chrisbo



Registered
  02/01/2002
Points
  794
10th January, 2007 at 18:33:20 -

OK! I figured it out. It took a little creative coding, for some reason it didn't like that I was starting the loop and then activating the loading group. So instead I activated the group, then put a "run event once" condition in there that starts the loop, it works now. WOO! I was going to pull my hair out after a bit....

Image Edited by the Author.

 
hay
   

Post Reply



 



Advertisement

Worth A Click