User Tag List

Results 1 to 5 of 5

Thread: Object Instance Selection Question

  1. #1
    No Products Registered

    Join Date
    Oct 2007
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Object Instance Selection Question

    Firstly I have a two very simple question. (Note that I’m using “instance” to refer to duplicates of a single defined object. e.g. “Active Object A”)
    1: Does anyone know of a list of all the methods by which one can select a specific object instance, or specific group of object instances? (Including instance selection methods that use third party extensions such as the “Select Object”.)
    2: Does anyone have any recommendation as to the best method for object instance selection, or extensions for object instance selection?

    Finally the main problem and subsequent question I have is the following:
    Assume you have two instances of the same object, and you have given that object type imbedded behavior events.
    I believe MMF2 runs the game code in the following order Frame events, Global events, Object instance 1 behavior events, Object instance 2 behavior events.
    Now assume, Object instance 1 has an alterable value A of 100, and Object instance 2 has an alterable value A of 200.
    In the behavior code of this object type, I wish to have the following code:
    EVENT: Select the object instance whose behavior code is currently being executed. Always.
    ACTION: List Object: AddLine( Selected object’s alterable value A)

    Ideally, I should see the “List Object” fill up with lines alternating 100 and 200. (e.g. 100, 200, 100, 200, etc, each on its own line)
    The problem I’m having is that in the event, I can’t find a means of “Select the object instance whose behavior code is currently being executed”.
    Dose anyone know how to do this? I would think feature would be similar to the “this” keyword in C++, assuming it exists. I know that object instances have a fixed value that acts like an ID, but I’m not sure if that would even be of use. (That, and I would hope there is a simpler way.)

    Thanks

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module

    Join Date
    Jun 2006
    Posts
    1,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object Instance Selection Question

    Last part - at the beginning of the behaviour code, you could set a flag for the duplicate. When the behaviour code ends, clear it.

    Then in your main event section, you can select duplicate by flag value.

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object Instance Selection Question

    So, does "Always Add Line(Alt Val A "Object")" not work?

  4. #4
    No Products Registered

    Join Date
    Oct 2007
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object Instance Selection Question

    I appreciate the suggestion Sarah. Unfortunately, setting a flag for a specific instance of the object while inside the behavior code is exactly the kind of thing I can’t get to work. Essentially, my problem is that I am trying to figure out how to refer to the object instance whose behavior code is currently being executed. That said, I may just be misunderstanding what you mean.

    In answer to your question Dynasoft, no it doesn’t work. The most recently constructed object is selected by default if none is specifically selected in the event. Thus I get a line containing the 200 from instance 2 when either object instance (1 or 2) runs through its behavior code.
    To be safe, I have double-checked in several ways to verify that the two instances really do each have a different AltValA value, and they do. Thus, I know I haven’t accidentally put the same AltValA value in both objects.

    Again, thanks for the advice thus far. Hopefully there is a way to surmount this problem without resorting to object ID lookup. Although I am open to anything at the moment.

  5. #5
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Object Instance Selection Question

    If you only get the one line added, then it's pretty obvious that the behaviour is only running once.

    Does looping through all instances of the object (spread 0 in Z, start loop numobjects times, Alt Z = loop index) make it work correctly?

    The way I understood behaviours is that they were really no different to normal events, just stored in an inconvenient-to-find location.

Similar Threads

  1. How to make an object fall on another instance of the object and stop?
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 20th June 2013, 09:42 PM
  2. Object Instance Comparisons
    By Dines in forum Extension Development
    Replies: 5
    Last Post: 25th December 2007, 06:01 AM
  3. Objec t Selection / Spread Value Question
    By Golds in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 22nd August 2007, 04:09 AM
  4. Problem with more than one instance of an object
    By Gamerdude in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 27th July 2007, 06:44 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
  •