Code not triggering, need help

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • So I'm working on this path finding system, and don't worry the problem isn't that complicated. All I'm trying do at the moment is compare values in a list (which is numerically ordered through the use of preceding zeros before the list data). Here's a little photo that I drew up that will explain some of the values in my engine.

    Please login to see this link.

    On the left is the starting node. It's starting position is at (1,4). I wrote out the surrounding square coordinates. On the right is the list that's ordered by the "F values" for each square. Each line of the list represents data from a square. The first number is the F value, the next two numbers is that squares coordinates, and the final number is the corresponding index number for some other array (last part doesn't matter). Basically I'm testing for the lowest F value (which should be somewhere at the top of the list) however the square has to be adjacent to the previous square. I've stored the previous square's coordinates in two alterable values called "Parent X Val and "Parent Y Val".

    So at the start of this fast loop on the first loop it will set the lowest number to an alterable value (Check F Val=40 as in the photo above). Then each loop it will compare the next line in the list. If the F values are the same it will compare the square's coordinates with the Parent X and Parent Y vals. I use the absolute value of the difference between the two values and compare it to either 0 or 1.

    Here's a look at my code:
    Please login to see this link.

    As you can see I added an "end application" action in this line, however it does not trigger. I made sure that the Parent X and Y values are correct and that the data is correct in the list. For some reason it's not triggering. Could anybody help me? I know this is kind of a long post and a bit complicated to explain, but it's really not that confusing... Thanks.

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

  • It would be better if you uploaded an example, it is rather confusing this way. And also the best way for you to debug such things that need to be ordered in a certain manner is to use another list object, that would list out the order of your events as they happen, so you can check where it stops or goes wrong.

    And check if the list object in your code has unticked 1 based index, that might be the reason why its not triggering.

    My signature is the awesomest!

  • To add to SkyHunter's comments, the best way to test whether a condition(s) has been met play a sound in that event line! Make it the last action, if it fires the conditions where met and the actions performed. If it doesn't then you know which area of code to study...

    Game Launcher Creator V3 - Please login to see this link.
    Bespoke Software Development - Please login to see this link.
    Learn Clickteam Fusion 2.5 - Please login to see this link.

    Danny // Clickteam

  • I'm not sure if sounds would work so well since the code is fast loops... wouldn't they all sound at the same time basically? I actually have a second list on the screen as debug, but it's not helping all that much. Everything in my example starts at base index 0 including the lists and arrays. Fast loops start with a zero base index as well. Here's an example file if you want to look at it. Look at the "Compare F Values" group.

    Please login to see this link.

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

  • Sounds work very well for any kind of simple testing of whetever event has trigered, even in fastloops when the sound is short and not too aggressive.

    Your most likely problem is the string parser, i had this problem myself recently, the string parser cannot change its source string twice in a single event properly. And not to mention your strings are ussually empty even before that, check: Please login to see this link.

    Also, you should learn to use lists to debug properly, your second list object just repeated the events of the first one...

    My signature is the awesomest!

    Edited 2 times, last by Skyhunter (January 27, 2013 at 4:08 AM).

  • Ah I figured it out. After setting some strings to listGetAt$( "String Parser", 2) and listGetAt$( "String Parser", 3) I found out that it wasn't parsing the string correctly. I needed to add "(" as a delimeter so that the numbers were parsed correctly. Now the code triggers fine. I had the second list repeat the events because in the first list some of the lines were removed from it. I wanted to gather the total data without any loss to see if the engine was constructing it correctly. Thanks for the hint that the parser cant change the source string in one event properly, it'll help in the long run.

    Thank you everybody for helping me.

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!