User Tag List

Results 1 to 5 of 5

Thread: Can Object Scope Fail?

  1. #1
    Clicker Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Mar 2016
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Can Object Scope Fail?

    Hello!

    I understand object scope as a concept, and I thought that I understood how to make use of it, but I've run into a roadblock that I cannot for the Life of me figure out why it is occurring. Are there situations where the object scope has been known to bug out? Based on my understanding, what is occurring... shouldn't be, because of the way I set it up. I'll explain the issue that I am having. I'm a little embarrassed to explain this, because I'm notorious for overcomplicating things.

    I have a Qualifier group of "Friends" which designates NPC characters. When the player presses the action button, a fast loop runs to determine which dialogue (if any) to play.

    + [On loop]
    - Player is overlapping Group "Friends"
    - Stage of "Friends" is 0
    - NPCType of "Friends" is 2
    - Player is not moving
    >> [Actions]

    The actions taken affect the "Friends" group, however, to my understanding it should only be affecting any "Friend" which the player is overlapping and which match the values provided as sub-conditions, no? Because unfortunately, that is not what is occurring. I'm working on developing the base framework for the game, so I have only two NPCs right now. When I speak to the one with the NPCType of 2, it increments values of the other NPC (who is NPCType 1). Not only is the player not overlapping this other NPC, his NPCType variable is not 2, so I thought that he should be excluded from actions taken upon when I ask them.

    I've been racking my brain trying to figure out why this might be happening... until I devise a better system (which could no doubt be done), I am stumped. Does anyone know of any situations or occasions in the past where an object is being affected outside of the scope window? Any insights may help... Let me know if I could provide any more details. Thanks much for your time!

  2. #2
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    It would help greatly if you would allow us to rack our brains with you. Would you upload your mfa, or portions giving you problems, so we can trouble shoot what is happening to you? By the way. In programming anything can fail. He he.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  3. #3
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Theres certainly lots of ways object scoping can fail. But none of the conditions you listed should be problematic. Because of the first condition, it should indeed only affect friends your player is overlapping, any further conditions should only filter through those.

    The problem might be elsewhere. What actions are occurring on the event? MMF2 is limited in that it doesn't preserve the object scope list on the stack frame. If you have an action that triggers another event during resolution of the actions, like a fast loop or function or xlua callback, then return to the execution of actions, the object scope list won't be preserved. So if your code is something like

    >> Set temp_string to text("npc")
    >> Do fastloop "blit npc" for len(npc_text) loops
    >> add 1 to counter of npc

    then if your "blit npc" loop scoped npcs too, it would change which objects are scoped when it returns for the "add 1 to counter" line.
    This may or may not be your problem, but its a likely candidate.

    If thats the case, then the best fix is to simply not put any scope-necessary code below function calls on actions, spread out conditions to two lines or otherwise flag objects to rescope them if needed.


    also there are other actions that can influence object scoping during resolution of events, like creating a new object (which scopes that object instance) or an extension interacting with the object scope list.

  4. #4
    Clicker Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)

    Join Date
    Mar 2016
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Marv! Big fan of your site, man. I intend to browse through your examples to further my knowledge of Fusion and its mechanisms. Thank you for the wonderful resource! I would be willing to post it as a last resort (I truly am embarrassed of my work), but I think I figured out the solution.

    Thank you, Pixelthief, for your suggestion here. Oddly enough, it was this that was causing the issue. I say oddly, because the FastLoops that are called do not directly interact with the "Friends" group at all. Yet when I placed the value changes above the FastLoop calls, it started to function correctly. I had rearranged the order of the sub-conditions already, but it hadn't solved the problem. So for the future reference of anyone reading this, I succeeded with the solution of accessing/modifying the data before calling the FastLoops. Changing the order of actions solved the issue.
    Okay, wait--after writing most of this post I discovered that there is one line in a few nested loops (not even the ones that are initially run!) that accessed a "Friend" variable, but does nothing to it. It must be that one tiny action that was changing the scope of it all. This is an important lesson to me, because it is indicative that referencing a value in an action without manipulating it will still change the scope.

    So let this serve as an example to those who are learning, mostly me! Fusion remembers everything... Heh. Passing a reference to a qualifier even in deep nested FastLoops will still change the overarcing scope of the initial call line, so any actions taken after the Loop calls will be using the new scope.

    Thank you both for your contributions! I am always extremely grateful that this community is so supportive and helpful! It makes learning this piece of software enjoyable and pleasing, something that cannot be said for all communities.

    Edit: Can I edit the title of this thread to prefix it with [Solved]?

  5. #5
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Sunonymous. Thank you for the kind words and support.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

Similar Threads

  1. AI Wall Detection and Object Scope
    By icicle in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 8th August 2014, 10:56 AM
  2. Object scope/instance help understanding
    By Scynscyn in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 15th June 2014, 03:18 PM
  3. Surface object or shaders in Flash (scope cross hairs)
    By KLiK-iT in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 2nd September 2012, 07:32 AM
  4. [Bug] Object overlap check fail
    By Nifflas in forum File Archive
    Replies: 6
    Last Post: 19th January 2009, 04:34 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
  •