User Tag List

Results 1 to 5 of 5

Thread: Creating Multiple Instances During Runtime for Efficiency and Organisation

  1. #1
    No Products Registered

    Join Date
    May 2013
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating Multiple Instances During Runtime for Efficiency and Organisation

    I've been using Fusion for a while now and I feel I'm fairly well adapted to it, but I've always had a nag that I've never gotten round to solving.

    My problem is with creating and editing instances of an object at runtime so as to keep the amount of objects in my workspace to a minimum. For example, I might want 6 labels in my frame, each displaying different strings, and during runtime I might want to change the 3rd label. If I'm creating and positioning the labels during runtime, I have trouble pointing only to the 3rd label and editing that one only.

    If anyone can point me in the right direction for how to go about this, it would be greatly appreciated

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,156
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Basically, you need to "mark" them in some way, so that each of your instances has some "ID" that makes it unique.

    If you create objects in runtime, you can give them an ID directly upon creation:

    i.e.

    on loop "create_label"
    >>> create "label"
    >>> set "label" ID to loopindex("create_label")


    If you have your labels already created in frame editor,
    another simple solution could be:

    run this event once
    >>> spread value 0 in "ID" of label


    Both of these will assign each of them a unique "ID" from 0 to 5 (since there are 6 of them)

    then each time you want to reference a specific instance,
    you simply add a "filter" in the condition,
    say you want to address label 3:

    (your triggering action)
    +"ID" of "label" = 3

  3. #3
    No Products Registered

    Join Date
    May 2013
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah yes, I think I've done this before in a previous project but lost all comprehension of it at some point.

    Just to clarify, the ID would be an alterable value and so this cannot be done with String objects, right? If not, I can probably find a suitable replacement in the form of Rich Edit or whatever.

    Thanks for the swift reply, that was just the pointer that I needed

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,156
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Yes - sorry,
    I was talking about tagging "ID" an alterable value of the "label" object

    Your labels are string objects?
    You can still use them, i.e. you can store their "fixed value" as ID in a reference table,
    you could use global values for this, or an object's alterable values or a list object

    i.e. using an object's alterable values to store IDs (let's call it "my labels")

    run this event once
    >>> start foreach loop on each one of "string"

    on each one of "string"
    >>> set value foreachloopindex("string") of "my labels" to fixed value of "string"

    this will populate your first 6 alt. values of "my labels" object with fixed values of your strings

    then to pick a specific label:

    (your triggering event)
    + pick object with fixed value = (AltValN xx of "My labels")
    >>> do stuff

    where "xx" is your label number from 0 to 5

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,156
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    ehm, also consider you might have far simpler options, depending on your game / personal preferences

    i.e. if your strings are static, you could pick them by position

    (on triggering event)
    + pick all objects in a zone
    and set a zone around the string
    (this is a condition inside the "new objects" element)

    or you could make "pointers" over each label,
    like object 1 placed over string 1 and so on

    and then:

    (on triggering event)
    + object 3 overlapping string
    >>> do stuff

    will pick the string overlapped by the specific object

Similar Threads

  1. Multiple Instances Help
    By macca02 in forum Fusion 2.5
    Replies: 2
    Last Post: 23rd February 2014, 11:05 PM
  2. Creating 4 Instances at 1 Instace
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 6th April 2013, 12:17 PM
  3. Multiple instances
    By Windybeard in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 23rd January 2012, 01:20 PM
  4. multiple instances spawning at multiple places
    By CPW in forum Multimedia Fusion 2 - Technical Support
    Replies: 17
    Last Post: 22nd February 2009, 12:38 AM
  5. Multiple instances of app.
    By Bruto in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 16th April 2008, 04:03 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
  •