[r111] Func doesn't continue after recursive call

0 favourites
  • 6 posts
From the Asset Store
Medeival & Viking War Horns Sounds / 22 Unique Calls / 2:40 minutes of audio
  • I was showing off my maze capx and then bam... broken.

    I was able to recreate the bug in a simple capx.

    Basically, if you still have stuff to do after a recursive call, well... it's ignored.

    Here's the simple capx.

    functionStopsOnRecursion.capx

    If you run the capx, nothing gets displayed.

    But if you put the

    Text: Append first&newline[/code:34f5l3k5]before the functionn call (event 3), it works as expected.Yann2012-12-09 02:10:13
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Small clarification: The code is actually called, but the local variables are not maintained. Looks like this bug may have come back:

    Local non-static variables in recursive functions did not hold unique values at each level of recursion (they acted like global variables throughout the function call). Now their values work independently in each call.

    Yann, change your text to: "["&first&"]"&newline

    The code is being called, but it was only showing newlines. Now you'll see text is being output.

  • blackhornet

    Alright, thanks for the clarification. I must admit that I encountered this bug in a more complex situation (a maze generator) and it behaved as if the function stopped, but it could as well be due to wrong variable values (:

  • Thanks, should be fixed in the next build... but recursive functions are proving tricky to get right!

  • Ashley

    I can only imagine the complexity of that. Thanks for your effort (:

    I think functions can greatly increase the readability of a capx (and then teamwork), that's why I'm focusing on it these days and stress-test them.

    Thanks to them, I am now able to more easily separate chunks of event and avoid undesirable interactions (which makes modifying/extending/refactoring some events that much easier)

  • Oh new version is already up!

    Alright I tested the capx I provided and my good old maze capx, all is working super fine thanks (:

    (that won't stop me from continuing to torture these functions though mwahahahah!)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)