User Tag List

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

Thread: Can you get altvalN indexnumber ?

  1. #1
    Clicker Multimedia Fusion 2 Developer
    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)

    Join Date
    Aug 2006
    Location
    Uppsala, Sweden
    Posts
    38
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Can you get altvalN indexnumber ?

    I want to compare Active Objects1 altvalue A with = Object2 AltValN indexnumber, not the actual value stored in that position.

    Is it possible?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)

    Join Date
    Sep 2017
    Location
    Milano, Italy
    Posts
    130
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hummm do you want to make something like a pointer to an alterable value of another object?

  3. #3
    Clicker Multimedia Fusion 2 Developer
    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)

    Join Date
    Aug 2006
    Location
    Uppsala, Sweden
    Posts
    38
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Yes I want to use it for scoping. There will be multiple object1 and object2 and basicly object2 will store values (set to the index of "altval a" of object1) for each of object1. I can store this values easy to the specific indexnumber I want but I dont know how to retrieve it.

    *I want each object1 to check the value stored at all object2's corresponding indexnumber.
    It would be really easy and neat if I could just somehow get this value in the expression editor, I was hoping this would be possible.

  4. #4
    Clicker Fusion 2.5 DeveloperiOS Export Module
    butterfingers's Avatar
    Join Date
    Apr 2012
    Location
    London
    Posts
    135
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    @contra
    I'm not entirely sure I understand your question, but here's what I think you trying to do, if I'm way off, let me know and we can work on it
    GetValueByIndex.mfa

  5. #5
    Clicker Fusion 2.5 DeveloperiOS Export Module
    butterfingers's Avatar
    Join Date
    Apr 2012
    Location
    London
    Posts
    135
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    OK, actually I think I misunderstood what you were trying to achieve.

    Anyway, here's a different example that basically finds which AltVal a number is stored in and returns the index of that AltVal.
    In this example, one of the AltVals on the object is set to 33, and pressing G will return the index of the AltVal that is equal to 33.

    Hopefully some brainfood.
    GetIndexByValue.mfa

  6. #6
    Clicker Multimedia Fusion 2 Developer
    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)

    Join Date
    Aug 2006
    Location
    Uppsala, Sweden
    Posts
    38
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    @butterfingers Thanks but sorry I should have been more clear that I was hoping to do it directly in the expression editor without resorting to additonal objects,counters or fastloops.
    My check is already part of an loop and the number of objects and AltValN numbers could potentially be rather high so it seems like an awful waste to trigger an additional fastloop to get the AltValN indexnumber for each instance I want it compared.

    But I take it that getting the AltValN indexvalue directly from the expression editor just isn't possible?

    @Yves Any chance that this could be added ? I can see many potential uses for this.

  7. #7
    Clicker Fusion 2.5 DeveloperiOS Export Module
    butterfingers's Avatar
    Join Date
    Apr 2012
    Location
    London
    Posts
    135
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    @contra
    Just to clarify, the second example _is_ what you want, but you don't want it in it's own fastloop?

    I get what you're trying to achieve, and can see it's use in some more advanced AI stuff for sure.
    I don't think it is possible though, at least not as a simple expression.

    Out of interest though, would you need to check every instance of this object in every update? Or is this more of a lookup table?
    It might not be too heavy if it's just used to occasionally look something up.
    Esp if you stop the loop once you've found the thing you want.

  8. #8
    Clicker Multimedia Fusion 2 Developer
    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)

    Join Date
    Aug 2006
    Location
    Uppsala, Sweden
    Posts
    38
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    @butterfingers Correct. To clarify, the second example is what I'd want (without using an outside loop index).

    I'm glad you confirm that this has potential use because I was so excited when I came up with this (seemingly) elegant solution to my problem, only for it to be shutdown in this next step :/

    It needs to be checked on every update (well, atleast ~90% of runtime). To further explain, my problem isn't getting the in-game result, but rather optimizing. The whole point of my code using this compare-condition was to optimize and have the potential to significantly increase the number of object1s that could be used. But yes you are right. I might still be able to incorporate the "fastloopindex...index" idea without any major performance hit.

  9. #9
    Clicker Fusion 2.5 DeveloperiOS Export Module
    butterfingers's Avatar
    Join Date
    Apr 2012
    Location
    London
    Posts
    135
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    @contra

    Can you expand a bit on your exact use for it?
    For example, you want to look into all the Alt values, find a particular value and return it's index.
    I don't know what you're actually using this for, but would there ever be an instance where you have 2 of the same value?
    Like, index 3 and index 46 could both = 5? or would all the indexes for certain have separate values?
    Secondly, are the values in the indexes always integers?

    I think there may be more than 1 way to skin this particular cat, but without some clearer idea of the end goal, I can't help much

  10. #10
    Clicker Multimedia Fusion 2 Developer
    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)

    Join Date
    Aug 2006
    Location
    Uppsala, Sweden
    Posts
    38
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    @butterfingers
    Right, I'd post an example but stripping out assets I don't want public would take too long, so I don't know how much use this will be but since you ask I will try to explain more.
    Basicly it's all part of a pathfinding routine that is relatively advanced with multiple objects each moving to different targets using A* calculated paths. Yes, the neverending quest for pathfinding in fusion

    Now, the A* routine is already taken care of at this point and has nothing to do with my problem. It's the need to store and retrieve multiple paths and do it efficiently.

    To make it easier to follow and type out, let's call object1 "dude" and object2 "road".
    My idea was to store the path (the cost/weight value) in "road" AltValN and use the index to store it for each of my "dudes". This way the "roads" could contain all necessary paths and in the movement phase the "dudes" would know which paths to follow by comparing the cost value at each "road" index which would correspond with the "dudes" ID number.

    1. "dude" is created and assigned ID
    2. path is calculated and each step cost of "road" is assigned to AltValN at index of "dude" ID
    3. "dudes" move by compairing it's ID number with cost value at "roads" index

    So to answer your questions; Yes, there will be 2 (or more) of the same value as all cost values will increase by 1. E.g. if 10 "dudes" start at the same "road" then that road would have 10 indexed AltValN with the same value (cost). All values will be integers.
    And oh yeah, there's always more then 1 way to skin a cat, especially in code

    My first attempt to solve this issue was to use "breadcrumbs" objects for each path which worked great but if dudes goal is 100 steps away it needed to create 100 breadcrumbs so if you create 10 dudes it quickly adds upp into 1000s of Actives. Another idea I had was to use multiple arrays, one for each dude, but this too have the problem of adding up to too many objects. A third option would be to eliminate the need to store paths at all and just recalculate paths at each step but I just dont think this would ever be fast enough to be viable.

    The advantage of my idea with AltValNindex would be that there is no need for additional objects regardless of the number of dudes. If I had 10 dudes each road tile would have 10 paths. The road objects (which will be there regardless) would essentially double as arrays. I still think that this would be a viable solution even with fastlooping for index, but I will have to do more testing.

    Sorry for wall of text and you have already helped more then enough. It's fun and helpful just to think about these things "out loud".
    Still hoping for AltValN indexvalue being added to the expression editor some day though

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Error when comparing AltValN
    By Zugwang in forum Fusion 2.5
    Replies: 11
    Last Post: 9th February 2016, 10:21 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
  •