Using the photofeature2D subsymbol - call instructions later


#1

I have the photofeature2d.zpp as a subsymbol that is activated when the trigger is no longer seen in my zap. So when they go off the trigger the subsymbol shows up and they can scale and adjust the image that comes up. Works great. Problem is I want the instructions for that photofeature2D subsymbol not to activate until the subsymbol is called with the trigger not seen event. Right now the instructions are the first thing to pull up when zapped. I see where they are, I see the script where they are being activated, I just don’t know how to change the call for them so they happen when the subsymbol activates on the trigger not seen event.

Any direction you could provide would be cool. Thanks so much.

Destery


#3

Are the instructions inside the subsymbol?


#4

Yes. The script is actually in a subsymbol of the subsymbol. The first subsymbol is the phofeature2d and the second is instructions.


#5

I’m having this exact same issue now. Straight out of the box the photofeature3ds instruction triggers on show. I’d like to trigger the instruction of the photofeature3d not directly on show, but after pressing a button. Therefore I’ve got to get to the script inside a subsymbol (instruction) that’s inside a subsymbol (photofeature3d).

I know I can get to a script that’s in a subsymbol by using:

// Get to instructions subsymbol
const instructions = symbol.symbolDefinitions.photofeature3D().symbolDefinitions.instructions();
// Change value of exported myVariable to "value"
instructions.nodes.script.myVariable = "value"

But…I can’t seem to trigger the instructions the way I want it.

@destery: did you find a solution? Perhaps @Seb knows a way?


#6

Sorry I’m on my phone so I cant post any code.

What I did was // out the code to first run the help. Then just above it is the code that is called from what you // out. You have to add export to the function so you can call it outside the subsymbol. From there just call the code to start the help.

Steve


#7

Thanks @stevesanerd.

I found out that in the photofeature3D there is a script called ‘buttonCode’. At the bottom of the script there are these lines:

//comment out this section if you do not want the instructions to show at the beginning
symbol.nodes.root.one("show", firstSeen);
function firstSeen() {
    help_selected();
}

I’ve done exactly what the comment states; I’ve commented uit every single line after the comment.
Then I exported the help_selected() function that’s right above that piece of code:

symbol.nodes.help.on("custom:selected", help_selected);
export function help_selected() {
    symbol.hide();
    instructions.display();
    instructions.one("custom:hiding", function() {
        symbol.show();
    });
};

…and called it from my script in the root of the project using:

symbol.symbolDefinitions.photofeature3D().nodes.buttonCode.help_selected();

That works. But… whenever the instruction gets called, the object in the photofeature3D group isn’t placed inside the instruction. The grey overlay, the hand and the close button of the instruction-animation are shown, but the object itself isn’t. Leaving a blank space with an animating hand.

I already see the object underneath the instruction-overlay (but it’s not animating). When I close the instruction the photofeature3D itselfs works great.
It seem I need to manually hide the photofeature3D-object and copy this to the instruction. Which normally is done by buttonCode-script in this line:

////////////////////////////////////////////////////////////////////////////////
// instructions are given the object to use as its example object
var instructions = symbol.symbolDefinitions.instructions();
instructions.attachmentPoints.objectGroup.push(symbol.nodes.objectGroup);

Anyone can help?


#8

I’ve added the same image to the instruction objectGroup, so the code doesn’t have to copy the Photofeature3D group to the objectGroup.

This solves the big problem for now.

I’m emitting the help-button to the custom:selected state, which triggers the help. It is like pressing the help-button.
symbol.symbolDefinitions.photofeature3D().nodes.help.emit("custom:selected");

Still this works strange as seen below; the instruction is above the photofeature3D’s UI buttons. Somehow the Photofeature3D’s buttons (and object) aren’t hidden.

Strange enough when I close the instruction and press the help-button, these buttons and the object are hidden(!)


#9

Hi @dvdkamp,

Seems like you managed to solve the bulk of this issue yourself, well done and thanks for the help @stevesanerd.

You were correct in commenting out that segment of code at the bottom of the script which shows the instructions on first seen.

There is a button in the bottom right of the photo feature subsymbol that replays (or plays) the instructions each time it is touched. Having a look at this code will allow you to re-create the instructions to be played when you would like.

Please let us know if you are still playing around with this and we will try to find a solution.

George