User Tag List

Results 1 to 9 of 9

Thread: Are global objects supposed to retain values if a frame is restarted?

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    piscesdreams's Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    928
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Are global objects supposed to retain values if a frame is restarted?

    I understand that a global object will carry values over into other frames; but it seems if a frame is restarted through the event editor "Restart Frame" action the values reset. Is this supposed to be the case? Just wondered if it is a bug or not.

  2. #2
    Clicker Install Creator Pro
    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)
    defisym's Avatar
    Join Date
    Jun 2017
    Location
    Asia
    Posts
    105
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    It seems that:
    Jump to frame: save.
    Restart current frame: don't save, restore last saved values.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    513
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)
    There is a bug with restarting a frame and resetting global objects - see the build 292.14 thread.

    As far as I can determine:

    It depends on how you're creating the objects. If you create an object with code in that frame it will reset and be created with default values i.e. it creates a brand new instance of that object.

    If you create it by ticking the block - create at start - it doesn't reset. (The bug here is that is also doesn't reset even if it was destroyed.)

    With the games I write there's no difference between jump to frame or restart the frame except that restart frame also restarts the music - and jump to frame continues the music.

  4. #4
    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
    www.sprykegame.com
    Posts
    2,272
    Mentioned
    90 Post(s)
    Tagged
    0 Thread(s)
    Well, from a bit of playing around, this is what I found. All objects are created at edittime (create at start):


    frame 1: altVal starts at 0
    frame 1: set altVal to 33
    frame 1: next frame
    frame 2: restart frame
    altVal stays 33


    frame 1: altVal starts at 0
    frame 1: next frame
    frame 2: set altVal to 33
    frame 2: restart frame
    altVal becomes 0


    frame 1: altVal starts at 0
    frame 1: next frame
    frame 2: set altVal to 33
    frame 2: jump to frame 2 (ie. the frame we're already in)
    altVal stays 33

    And interestingly:

    frame 1: altVal starts at 0
    frame 1: next frame
    frame 2: set altVal to 33
    frame 2: jump to frame 2 (ie. the frame we're already in)
    frame 2: restart frame
    altVal stays 33



    So it seems like the key is what the value was when the frame first started. (EDIT: as just stated by Yves below)

    -If the altVal was 0, then got changed to 33 that frame, it'll reset to 0.
    -If the altVal was already 33 when that frame got started, it'll reset to 33
    -jumping to frame doesn't reset altVals
    -jumping to frame does cement the current altVals as the base values for that frame (the ones to which they'll be reset on a restart frame)

  5. #5
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,187
    Mentioned
    141 Post(s)
    Tagged
    2 Thread(s)
    Yes, Jump To Frame saves the values of the current objects when the frame ends, Restart frame doesn't save the values so when the frame restarts it resets the values to their state they got when the frame was originally started. Apparently this was intended (not ultra coherent with global values that don't get reset but well...).

    >> The bug here is that is also doesn't reset even if it was destroyed

    Just a comment about this, the bug is that when a global object is destroyed in the last game loop just before you do a jump to / next / previous frame, its values are saved although it should be ignored.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    513
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Yves View Post

    >> The bug here is that is also doesn't reset even if it was destroyed

    Just a comment about this, the bug is that when a global object is destroyed in the last game loop just before you do a jump to / next / previous frame, its values are saved although it should be ignored.
    In my actual game, where I picked up this bug, my objects are destroyed 3 seconds before the frame ends - and a lot more happens in that 3 seconds - although it's mainly a "you win" animation, saving stuff to the ini file etc. The example I gave you, I might have put the code in an end frame event - but definitely not in my game.

  7. #7
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    piscesdreams's Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    928
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Interesting data everyone, I appreciate all the responses. This is good data to know in the future. I just wanted to be sure I wasn't goofing something up.

  8. #8
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,187
    Mentioned
    141 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Janette5 View Post
    In my actual game, where I picked up this bug, my objects are destroyed 3 seconds before the frame ends - and a lot more happens in that 3 seconds - although it's mainly a "you win" animation, saving stuff to the ini file etc. The example I gave you, I might have put the code in an end frame event - but definitely not in my game.
    Hmm, I don't see at all how objects that are deleted before the last game loop could be saved when the frame ends, because they don't physically exist anymore, this is not possible at all. It must be another problem.

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    513
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Yves View Post
    Hmm, I don't see at all how objects that are deleted before the last game loop could be saved when the frame ends, because they don't physically exist anymore, this is not possible at all. It must be another problem.
    Right, so the issue with the objects being deleted at the end of frame - that was reported by accident not by design.

    What happened was that when I restarted the frame without having completed it, then the auto-created objects were kept and not destroyed and their values were also kept - making my game fail. Resetting the values at the start of the frame solved that. When the game completed and is then restarted - then I don't have a problem because then the objects are destroyed 3 seconds before the frame ends.

    (But while "Restart" restarts the music it isn't viable to use it - I can't have my music restart every time - there's no option but to use jump to frame.)

Similar Threads

  1. Lives won't subtract when frame is restarted
    By Warmachine in forum Fusion 2.5
    Replies: 7
    Last Post: 16th September 2014, 03:04 PM
  2. Physics fail when frame is restarted.
    By MonDieu72 in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 26th December 2013, 01:44 PM
  3. Batch rename global values in frame editor
    By keokeo in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 16th March 2012, 03:47 AM
  4. Retrieving global values from save frame pos.?
    By Viewtiful in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 19th August 2009, 09:02 PM
  5. save global values without saving the whole frame?
    By Skeets in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 7th December 2008, 05:48 AM

Posting Permissions

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