Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Referencing a script object in another script object

shawnFMU
Level 3
Level 3

Can I reference another script object in a script object? All script objects would be under the same Variables hierarchy.

I have a dropdown field.

In the 'exit' event, the first reference:

DropExit.Exit1(this);

In the DropExit script object:

function Exit1(current)

{

if(Drop.rawValue =="1")

{Color1.presence = "visible";} else {Color1.presence = "invisible";}

if(Drop.rawValue =="2")

{Color2.presence = "visible";} else {Color2.presence = "invisible";}

}

No problems!

But, I would like to do something like this:

function Exit1(current)

{

If(Drop.rawValue == "1")

Selection.S1(this);

If(Drop.rawValue == "2")

Selection.S2(this);

}

then I would have another script object,

Selection script object:

function S1(current)

{

{Color1.presence = "visible";} else {Color1.presence = "invisible";}

{

function S2(current)

{

{Color2.presence = "visible";} else {Color2.presence = "invisible";}

}

in my little mind, this seems like it would work... is it possible?

Thank you in advance!

1 Accepted Solution
MinusZero
Correct answer by
Level 7
Level 7

I would think if you have multiple script objects you might need to be more specific with it's reference.

For Example:

1525502_pastedImage_1.png

If i was working in my script object vars but wanted to access my function in moreVars, it would be referenced like this:

moreVars.profileCount();

I dont know if thats what you were after.

View solution in original post

3 Replies
MinusZero
Correct answer by
Level 7
Level 7

I would think if you have multiple script objects you might need to be more specific with it's reference.

For Example:

1525502_pastedImage_1.png

If i was working in my script object vars but wanted to access my function in moreVars, it would be referenced like this:

moreVars.profileCount();

I dont know if thats what you were after.

View solution in original post

shawnFMU
Level 3
Level 3

Brilliant! This is exactly what I need!

Thank you!