I want to compare Active Objects1 altvalue A with = Object2 AltValN indexnumber, not the actual value stored in that position.
Is it possible?
Don't have an account yet? Then register once and completely free of charge and use our wide range of topics, features and great options. As a registered member on our site, you can use all functions to actively participate in community life. Write posts, open topics, upload your pictures, put your videos online, talk to other members and help us to constantly improve our project and grow together! So, what are you waiting for? Become a part of us today!
Login or registerTo get support for a technical issue such as installing the software, to query a purchase that you've made/would like to make, or anything other than using our software, please visit our Customer Service Desk:
Open a TicketI want to compare Active Objects1 altvalue A with = Object2 AltValN indexnumber, not the actual value stored in that position.
Is it possible?
Hummm do you want to make something like a pointer to an alterable value of another object?
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.
[MENTION=5679]contra[/MENTION]
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
Please login to see this attachment.
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.
Please login to see this attachment.
[MENTION=12441]butterfingers[/MENTION] 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?
[MENTION=5114]Yves[/MENTION] Any chance that this could be added ? I can see many potential uses for this.
[MENTION=5679]contra[/MENTION]
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.
[MENTION=12441]butterfingers[/MENTION]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.
[MENTION=5679]contra[/MENTION]
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
[MENTION=12441]butterfingers[/MENTION]
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
Right, yeah ok I get you... kinda
SO you have like a 10x10 grid or something, with 100 Road Tiles total.
You calculate the paths for all the Dudes.
(here's the bit where I'm confused)..
Lets say Dude1 (i.e. the Dude with ID=1) has a path that goes through Road tiles 1,2 and 3.
so in Roads 1,2 and 3 you'd set AlterableValue(1) to the path costs?
What I can't understand is why you ever need to work backwards from a value to an index?
Surely when handling Dude1, you just look in AlterableValue(1) of all the roads?
And yeah, I just like the challenge of these things, and this is an interestingly complex challenge.
I _really_ like the idea of using the tiles as an array btw. I've done A* with multiple enemies (and updating the paths after each enemy moves so they never overlap, and it's a total pain to get efficient. Fortunately my project was turn based, which made things a little easier).
Yes your example would basicly be correct.
It sounds simple and maybe I'm tunnelvisioning, but how do you propose the code for dude1 to check in road altval(1) ? A specific dude would always need to check a specific altval of road and now we're back to the issue. This is where I need the condition of dude ID(1) = road AltValN(index) as this would scope all objects in 1 event regardless if I have 1 or 100 dudes. The only other ways I can think of is to make separate events for each possible value or use an fastloop index (ie some form of counter).
Can you use the array object for this instead?
Well I guess I could do the same thing with just one additonal array and use it's Z index to compare ID instead. Looking at it now I can't remember why I deemed it necessary to use one array per path, I have to check.
If you are recalculating the paths every event loop, you could just reuse the same array over and over as you check each object's movement path. If not though then you'll have to store that info somewhere, which I guess is the problem..? But that could all be in the z dimension of an array too
Don’t have an account yet? Register yourself now and be a part of our community!
Almightyzentaco (Fusion 2.5 Tutorials)
Captain Quail (Firefly Tutorials)