The Daily Click ::. Forums ::. Klik Coding Help ::. Limitted Fastloops?
 

Post Reply  Post Oekaki 
 

Posted By Message

cake



Registered
  13/12/2002
Points
  1173
13th February, 2007 at 23:52:20 -

Working in MMF2, and having a problem with some code centred around fastloops. I'm wondering, is there a limited number of nested fastloops you can have? Like:

On Loop1
-Start Loop2

On Loop2
-Start Loop3

On Loop3
-Start Loop4

...etc...

Does anyone know if there is any maximum to this? And if so, what is the behaviour if one exceeds it?

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
14th February, 2007 at 02:27:07 -

I don't assume that there would be a limit, I have never encountered any problems. Why not just start a test for yourself? Also, what is your exact problem, we may be able to suggest an easier method of doing it.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

cake



Registered
  13/12/2002
Points
  1173
14th February, 2007 at 03:09:56 -

Ah its cool, I found the cause of the problem. It's something to do with the Overlay Object. I'll do my best to explain what I'm trying to do with the code.

I have a list of filenames (fileList). The code iterates through this list, reading each filename and passing it to the Binary Object to load that file.

Inside these files are a couple of list files for the List Object, and a sequence of long-image file pairs, ie:

[long "x"][x number of bytes which make up the image file][next long "y"]...etc...

The code extracts the lists from this binary, and loads them into their respective List objects. So all thats left in the binary is the sequence on long/image pairs.

The code knows how many images there are in the file, as it is described in one of the lists it extracted. The code begins iterating through these images, and for each image performs the following:

- Extracts image to disk
- Creates a new Overlay Object
- Loads image on disk into Overlay Object

The goal is to have an overlay for each image that was in the binary, containing a respective image. However, what happens is only 1 image in 1 overlay will ever load. No other overlays will ever load images. Additionally, that Overlay object which DID load an image, will not be able to load a new image over the top. It's like the Overlay extension just locks or something...

Hope that made sense..

 
n/a

Tiles

Possibly Insane

Registered
  06/12/2002
Points
  2339

GOTM 3TH PLACE WINNER - JANUARY 2010
14th February, 2007 at 07:07:24 -

There are a few footangles in the current overlay redux. One for example is that you cannot load the same picture twice behind each other. You have to load a dummy file with another name first.

For your problems here it's hard to say what exactly makes trouble without having a look at the source. Possible that something overrides each other ...

 
Free graphics,Free Games
http://www.reinerstilesets.de

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
14th February, 2007 at 07:12:02 -

I imagine the only limit on nested fastloops (or even a single big loop, since they're executed practically the same way) would be the point where it takes more time to complete the series than MMF's refresh rate, which would probably just result in slowdown. Presumably the exact point would be different depending on your machine.

Not that I've tested it.

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
14th February, 2007 at 09:55:52 -

I have a question about fastloops, as I never do them.

To equate it to something I understand in VB (a FOR.. NEXT loop), is there a "NEXT X" part of the loop in MMF? Or is it the "on loop" command that does it?

I should really learn fastloops, blah.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
14th February, 2007 at 10:44:18 -

with a fastloop, you tell it to do something x amount of times, then when each incident occurs, you tell it to do an action.

E.G

Some event:
- Start loop "loop" 10 times

On loop "loop":
- Some action

it will do that action 10 times, in a short space of time

 
My signature is never too big!!!

cake



Registered
  13/12/2002
Points
  1173
14th February, 2007 at 10:54:08 -

After reading back over what I wrote, here's a better definition of the error:

An Overlay object will not load an image from file unless there exists no other instances of the Overlay object which have already loaded an image.

Very frustrating! So in a simple example, if you have 1 overlay object and load an image into it, then try to load another image into it [with the same file name], it won't work. You have to destroy the overlay and create a new one [or as you suggest, Tiles, load in a dummy file between them].

Del Duio, I'm sure theres at least a half dozen articles written on DC and elsewhere that explain fastloops, but I will try to equate it to VB code [as best I remember it]:

Events:

1. Start of Frame
- Start Loop "monkey" for 5 loops

2. On Loop "monkey"
- add 1 to counter

VB [or thereabouts]:

Call monkey(5)

Sub monkey(integer loops)
-for i = 0 to loops //[or maybe its loops-1...too tired to think it out right now]
--counter = counter + 1
-next i
End Sub

Hope that clears things up for you. A fast loop call is like jumping out of the event into the fastloop event and looping for however many times you told it to, then jumping back into the event which started the loop to the action immediately after the "start loop" action.

Image Edited by the Author.

Image Edited by the Author.

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
14th February, 2007 at 12:44:11 -

Try this:

- Start of frame: start loop "a" 1 time.
- on loop "a": start loop "b" 10 times.
- on loop "b": start loop "a" 10 times.

Happy crashing!

 
Old member (~2004-2007).

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
14th February, 2007 at 15:33:21 -

Del Duio: The equivalent of "NEXT X" occurs when there are no more "On loop x" events in the order of the event list. You can prematurely advance it by using "Set loop index", too.

 
http://www.davidn.co.nr - Games, music, living in America
   

Post Reply



 



Advertisement

Worth A Click