User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16

Thread: Array confusion, can i overwrite?

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)

    Join Date
    Oct 2021
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Array confusion, can i overwrite?

    I've been running into this theme lately where I think I have bugs in my code, but turns out it's just fusion weirdness.

    So here's the thing: can I overwrite arrays? Seems like a stupid question but I have the weirdest bug.

    I use a world array to generate a random map. Then I use a BFS algorithm to make sure the player spawns in a location where they can leave from.
    The terrain that the player can traverse is simply left as 0 in the world array.
    I know for a fact that my BFS arrays and everything that goes along with it works, since I use it for other applications as well - and I have checked it several times with my debugger tools.
    I'm trying to check for pockets (with the value 0) in the array that are not accessible to the player, so as to overwrite them as walls, so that there are no rooms that you can't access.
    The thing is that the condition is dead simple: If the list coordinates match the array coordinates, write value to array.
    For some reason my array does not overwrite, even though every other array (I use 4 other arrays for the BFS) does. Nevertheless, they write with the exact same code just fine.
    I even tried to delete the world generator object at runtime, so that it can't overwrite the world array again, once I've generated the world - no luck.

    The condition is this simple:
    * On loop "iterate path"
    + ValueAtXY( "Array - Cellular Automaton", Val(L( "Master - Pathfind" )), Val(R( "Master - Pathfind" )) ) = 0
    Array - Cellular Automaton : Write Value -1 to (Val(L( "Master - Pathfind" )), Val(R( "Master - Pathfind" )))

    L(Master Pathfind) and R(Master Pathfind) are simply string parsing code, that is stored as a string. So all it does is pick a coordinate from a list (x,y), L being x, and R being y.

    I know I'm grasping at straws here, but the thing is I am 100% sure that this should work, so I'm wondering if this is another weird fusion quirk of some kind I don't know about.

    All I have done previously to the array is run a Cellular Automaton algorithm that doesn't even run anymore. Once more, even deleting all the code at runtime that writes anything into it makes no difference.
    I mean I could just make another array, but what the hell is going on?


    **EDIT**
    This same condition can end the application btw (used as bugtest, so I know it triggers), but it can't write a simple value to an array? And I repeat, nothing else touches the array.

    **EDIT 2**
    So much for using a second array. Doesn't work either. What is wrong with this program? Devs, please address this.

  2. #2
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    sprykethegame.com
    Posts
    3,210
    Mentioned
    133 Post(s)
    Tagged
    0 Thread(s)
    No idea. But here are some questions to consider:

    -How do you know it doesn't write the array? Is it just that your game isn't working as it should, or have you manually checked to see what the values in the array are, using the debugger?
    -Do you need to check/uncheck Base 1 index in the array properties?
    -add an output to debugger action that outputs "L = "+Str$(Val(L( "Master - Pathfind" )))+ ", R = "+Str$(Val(R( "Master - Pathfind" ))). Do the outputted values seem correct? Or are they off by 1? Or are they always 0,0?
    -What if you explicitly hardcode the action to Array - Cellular Automaton : Write Value 999 to 10, 10. Does the value at 10,10 become 999, or does it still not write?
    -Have you somehow accidentally duplicated an array?
    -Has something changed in the list recently? Does it have superflous spaces or punctuation after the numbers?

  3. #3
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)

    Join Date
    Oct 2021
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Volnaiskra View Post
    No idea. But here are some questions to consider:

    -How do you know it doesn't write the array? Is it just that your game isn't working as it should, or have you manually checked to see what the values in the array are, using the debugger?
    -Do you need to check/uncheck Base 1 index in the array properties?
    -add an output to debugger action that outputs "L = "+Str$(Val(L( "Master - Pathfind" )))+ ", R = "+Str$(Val(R( "Master - Pathfind" ))). Do the outputted values seem correct? Or are they off by 1? Or are they always 0,0?
    -What if you explicitly hardcode the action to Array - Cellular Automaton : Write Value 999 to 10, 10. Does the value at 10,10 become 999, or does it still not write?
    -Have you somehow accidentally duplicated an array?
    -Has something changed in the list recently? Does it have superflous spaces or punctuation after the numbers?
    I know because I checked the debugger, and my own debugging tools as well.
    It's not and index problem, nor a problem with the code, I use the same code previously to this one, to check for the same conditions for another reason. It's as if I can't do it twice.
    If I hardcode a change it does work.
    I have not duplicated an array.
    No it does not have superfluous spaces or any type of fault with the list retrieving parser.

    Even ChatGPT said there seems to be nothing wrong with the code, and that I should contact Clickteam.

    Thanks for the response!

  4. #4
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)

    Join Date
    Jun 2006
    Location
    Killeen, TEXAS
    Posts
    1,237
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    an array can be changed to whatever value you put in there. there's nothing wrong with it. provide an example of how you think it doesnt work.

  5. #5
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    sprykethegame.com
    Posts
    3,210
    Mentioned
    133 Post(s)
    Tagged
    0 Thread(s)
    Well, if hardcoding the value works, then there's nothing wrong with the array or with connecting to it. The problem then most likely lies with the variables you're using in your code, or in what order you're manipulating and reading them.

    Try using the 'output to debugger' action as I suggested. My guess is that it will tell you that the values are 0,0. If this is the case, then your condition will test for the value at x=0, y=0, which is probably 0 because you've probably never used it. It'll change it to -1, but that's useless to you because you're not interested in x=0, y=0. So the event will trigger, but it'll appear to you like nothing's happening. That seems consistent with what's been happening.

    The other benefit of outputting to debugger is that you'll see how many times the loop is running. If my above guess is correct, then the loop will only run once, because it will test 0,0, see that it's set to 0, then set it to -1, then it'll repeatedly test the same spot (0,0) but this will now be set to -1 so it will no longer execute the actions.

    If indeed the values in your code are 0,0 then it's just a case of working backwards, investigating every step along the way, until you find the reason why they're not being set the way you expect them to be.

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)

    Join Date
    Oct 2021
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Volnaiskra View Post
    Well, if hardcoding the value works, then there's nothing wrong with the array or with connecting to it. The problem then most likely lies with the variables you're using in your code, or in what order you're manipulating and reading them.

    Try using the 'output to debugger' action as I suggested. My guess is that it will tell you that the values are 0,0. If this is the case, then your condition will test for the value at x=0, y=0, which is probably 0 because you've probably never used it. It'll change it to -1, but that's useless to you because you're not interested in x=0, y=0. So the event will trigger, but it'll appear to you like nothing's happening. That seems consistent with what's been happening.

    The other benefit of outputting to debugger is that you'll see how many times the loop is running. If my above guess is correct, then the loop will only run once, because it will test 0,0, see that it's set to 0, then set it to -1, then it'll repeatedly test the same spot (0,0) but this will now be set to -1 so it will no longer execute the actions.

    If indeed the values in your code are 0,0 then it's just a case of working backwards, investigating every step along the way, until you find the reason why they're not being set the way you expect them to be.
    Thank you again for the response! Unfortunately I have already done all the things you mentioned, hence the post.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleUniversal Windows Platform Export ModuleSWF Export Module

    Join Date
    Jun 2014
    Posts
    129
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    As mentioned, to test that there is absolutely no bugs with the array object, you should put a dummy/debug event in that writes to a hard coded array location that is known to be already populated. That's seems like the best way to find out for sure.

    Unless the array object itself is bugged due to a bad install or something (perhaps from a recent update?), or you're writing using a bitwise OR with original value, a write to an array location should always overwrite the data that was there in the first place. I'm certainly not experiencing this issue with my own projects that write to arrays.

  8. #8
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)

    Join Date
    Oct 2021
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by YesNoYes View Post
    As mentioned, to test that there is absolutely no bugs with the array object, you should put a dummy/debug event in that writes to a hard coded array location that is known to be already populated. That's seems like the best way to find out for sure.

    Unless the array object itself is bugged due to a bad install or something (perhaps from a recent update?), or you're writing using a bitwise OR with original value, a write to an array location should always overwrite the data that was there in the first place. I'm certainly not experiencing this issue with my own projects that write to arrays.
    Thank you! I have done all the dummy tests, otherwise I would not be asking here. Yes it is quite infuriating. I disabled the entire (altered) path finding algorithm code, and duplicated the code in the first group without any changes; I also checked that no values are left in a state that makes the initial state wrong for the second time. Still does not work.

    ** EDIT **
    Before you ask, yes I do also reset the arrays and the list.

    **EDIT**
    My only theory is that there is something messed up about closing groups and then activating another one that uses the same names in fast loops.
    I did try to test this a little bit by changing the loop names though with no luck.
    I'm left thinking that there is something with the entire complexity of the game (even though I have made a load order) that doesn't work with Fusion.
    I specifically chose Fusion because of the ease of programming complex interrelated game mechanics since I'm creating an emergent game; think Nintendo made Dwarf Fortress, not conceptually but mechanically.
    However, maybe this screenshot is a sign from god, that this program simply breaks at high levels of iterations or complexity:

    sign from god.png


    **EDIT**

    Ok, so I have now tested that I appear to be correct about this issue. So even though I close a group it's code seems to run for a while after closing. I will be back once I solved this issue.

  9. #9
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    sprykethegame.com
    Posts
    3,210
    Mentioned
    133 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MistaSub View Post
    I'm left thinking that there is something with the entire complexity of the game (even though I have made a load order) that doesn't work with Fusion.
    You're getting ahead of yourself. It's way more likely that it's a simple error somewhere, caused by a small, specific thing - possibly a Fusion bug, but more likely a MistaSub bug. You just need to search methodically until you find it.

    Thank you again for the response! Unfortunately I have already done all the things you mentioned, hence the post.
    So just to be clear, you did the output to debugger code I suggested and you put it in the same exact event that is supposed to write to the array? And the resulting text showed that real, desirable numbers were being outputted, but these were not being written to the array?

    Create a copy of your MFA, strip out all the code and objects that don't relate to this problem until you've simplified it to a tiny MFA with just a couple of events that shows the problem. As you strip it down, run and check periodically, because there's a good chance that the mere process of isolating the bug like this will guide you to find the bug yourself (that's what happens at least half the time, in my experience). If the bug is still there, then attach it here and we'll take a look.


    EDIT: just saw your edit:

    **EDIT**

    Ok, so I have now tested that I appear to be correct about this issue. So even though I close a group it's code seems to run for a while after closing. I will be back once I solved this issue.
    See? Nothing to do with the array. Like I said, you need to investigate every step of a process to see where the breaking point is - it's usually somewhere where you weren't expecting it.

    Code definitely doesn't "run for a while" after you close a group. Where are you closing the group - inside a fastloop or outside of it, in a regular event?

  10. #10
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)

    Join Date
    Oct 2021
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Volnaiskra View Post
    You're getting ahead of yourself. It's way more likely that it's a simple error somewhere, caused by a small, specific thing - possibly a Fusion bug, but more likely a MistaSub bug. You just need to search methodically until you find it.
    I have been for the past 2 days doing nothing but. Thank you for the rubber duck! I appear to have found the issue, and it is sort of a Mista Sub bug, but also a Fusion quirk like I expected.
    So turns out that deleting an object does not make it's values return null, instead they return as 0; which is mindbogglingly stupid to be honest.

    Which means that this code....:
    + ValueAtXY( "Array - Cellular Automaton", CellXPos( "Pathfind - Origin Maker" ), CellYPos( "Pathfind - Origin Maker" ) ) = 0

    ....could still be true when the Origin Maker Object no longer exists.

    So both of us were right. Could someone please make a sticky on the forum about all the weird Fusion things that one wouldn't expect from a programming tool?
    It's really confusing for someone who is not that familiar with the tool, when it so often does something counterintuitive. Just like the follow the frame thing being basically useless, the other day.
    Btw, the follow the frame workaround with an object at 0,0 doesn't work either for menu items, since they sort of "float around" if you use camera easing.
    I mean I guess I could reverse counter ease it, but c'mon... what is this follow the frame thing for if it does nothing.

    Anyway, thank you again! It meant a lot to me, I was going completely insane knowing for sure I don't have any flaw in my logic, and doing this for 16 hours a day; two days in a row.
    I will return once I have fixed this mess, with a question about background deletion.

    **EDIT**
    I mean I guess if you HAVE to have an object in the same layer as a scrolling layer, and don't need to change it's position ever, you could use follow the frame.
    But wouldn't it be better if you could reposition it? At the very least this should be on the next update list along with the null value thing, especially considering these changes couldn't break someone's existing game.

    **EDIT**
    Well I guess if someone relied on deleted objects returning 0 it could break it. But how likely is that? At the very least it could be an option, to return null values instead of 0.

    **EDIT**
    Btw, if someone somehow runs into this post while searching for the null value thing or if you just didn't know it like I did, just fix it with checking for number of objects at the start.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Overwrite pre-existing data in INI?
    By MasochisticGamer in forum Fusion 2.5
    Replies: 1
    Last Post: 13th July 2018, 10:54 PM
  2. Replies: 1
    Last Post: 26th June 2015, 10:28 PM
  3. Request to overwrite protected files
    By Frank in forum Install Creator and Patch Maker
    Replies: 3
    Last Post: 4th November 2008, 09:00 AM
  4. Copy & overwrite file in Vista
    By Bipolar_Games in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 26th September 2008, 08:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •