Private Variables

For questions about using Classic.

Post » Wed Dec 17, 2008 7:05 pm

Just wondering if its possible but are you able to have family variables??
e.g. I have an object that when I want a variable changed it changes the same with the whole family

Family Variables not local or private
B
2
G
4
Posts: 50
Reputation: 1,150

Post » Wed Dec 17, 2008 7:21 pm

If you want the entire family's variable to change you will have to create an event that does that. You can change an entire family's variables at once by performing the "Set value" action on the family instead of each object within it.

To set up variables for whole families at one time in the Layout editor you can use the Manage Families button at the top located under Project.

And of course, you could always have your family set it's variables to those of a specific object within that family by using events. So if "objA" is in the Blue family, you could do this:

[code:gm3gjx9q]+Always
-> Blue: Set 'myVar1' to objA.Value('myVar1')
-> Blue: Set 'myVar2' to objA.Value('myVar2')

etc.[/code:gm3gjx9q]
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Dec 17, 2008 7:43 pm

yeah thats where my problem is.
Its because i want every member of the family to be able to change the variable so letting one member in charge is not what i want
B
2
G
4
Posts: 50
Reputation: 1,150

Post » Wed Dec 17, 2008 8:22 pm

Perhaps you could be more specific. What exactly are you trying to do?
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Dec 17, 2008 8:35 pm

Do you mean you want all members of the family to have their variables changed at the same time? In that case do this:

+For Each (Family Name):
-Set Family('value') to 10

I hope that's what you're looking for. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Wed Dec 17, 2008 9:41 pm

i mean a bit like this

3 objects in a family
They all share 1 variable
The variable number is zero
object 1 adds two and object 2 adds three
making the variable 3 for all the objects
B
2
G
4
Posts: 50
Reputation: 1,150

Post » Wed Dec 17, 2008 10:16 pm

I don't think you can do it like that. You'll have to have an intermediary variable somewhere that you can add the family values to. Like a global, or a non-family object. Then you can move that number back into the family variable.

At least, I can't make it work. I've tried for the past 20 minutes or so with no luck.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Dec 17, 2008 10:58 pm

ok thanx anyway i hope they make the next few builds have family varkiables like that though
B
2
G
4
Posts: 50
Reputation: 1,150


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests