beforeAction hook not running?

Well I’m back with more stupid questions. Thanks to post-concussion syndrome my brain is really foggy today, but I really wanted to work on my game.

I’ve got a beforeAction method on the mask the player character is wearing (a Wearable Thing), so that if the player tries to enter an outdoor room they’ll automatically put the mask on first if it’s not already on. This never seems to fire for some reason, and I’m at a bit of a loss.

Here’s the method:

beforeTravel(traveler, connector)
{
    if (traveler == gPlayerChar && (connector.ofKind(OutdoorRoom) || (connector.ofKind(TravelConnector) && connector.destination.ofKind(OutdoorRoom))))
    {
        tryImplicitActorAction(gPlayerChar, Wear, [playerMask]);
    }
}

I think the issue here is that the area I’m testing on actually has a passageway connecting the indoor room with the outdoor room, and that’s messing this up somehow. But the logic I have should work, right? Passages are just TravelConnectors, iirc.

As a secondary question as well: in adv3Lite, is there a way to manually trigger scenes, so I can move the scene stuff out of action-reacting methods and into an actual scene and just have that method trigger the scene?

Thank you!

2 Likes

I accidentally deleted this lmao

Update: I think it’s not firing because I misunderstood how TravelConnectors work, that’s all.

1 Like

So… you’ve got the mask working now? Or no?

Do you mean (sceneObj).start()?

1 Like

Sorry this question is so disorganized aaaaaaa

No that update came before I updated the question, it still isn’t working.

I’ll try that! I checked the Library Manual entry on scenes but forgot to check the reference.

If you comment out the implicit action for a print statement, does the print statement show up? Sometimes implicit actions don’t show up correctly for me, even when the surrounding logic is fine.

If this is specifically for going from indoors to outdoors, you could have an OutdoorRoom override the traveller-entering method (I forget the actual name and I’m on mobile), which passes the origin room as an argument, and then check if the origin wasn’t outdoors as well.

But that’s just a suggestion if the checking logic you have isn’t working for some reason. I read it over twice and can’t quite figure out why it wouldn’t work…

1 Like

Also: Is beforeTravel called from the room you’re leaving, or the room you’re entering? I forget…

It looks like it’s the implicit action that wasn’t firing, because a print statement there works. That’s interesting. I’m not super clear how to trigger what are essentially conditional precondition actions, I thought that’s what implicit actions were for — if not, how do I actually do it?

1 Like

The room you’re leaving I think.

1 Like

I’m going to try this as well, even though it seems like the location of the hook method isn’t the issue, because this seems like it would be cleaner than trying to program for every kind of connection to an outside room.

1 Like

I think the implicit action arguments you’re using might be wrong? It might just assume you’re using the gActor. Try removing your gPlayerChar argument entirely, so Wear becomes the first argument.

1 Like

I think the problem may be [playerMask]. It shouldn’t be in a list

1 Like

The function signature has [objs] in brackets to indicate that you can add a variable number of args at that point

2 Likes

OHHHHHH! I see.

2 Likes

@inventor200 follow up question: is there a way to cancel a travel action from travelerEntering? I got everything else working super smoothly now!

1 Like

It might be possible with an exit or abort statement. If that doesn’t work then I’ll get to get back to my computer to look at the docs.

1 Like

Woohoo!! :grin:

1 Like

Sorry I keep asking all these stupid questions. I know this sounds like an excuse, but if I was feeling better I’d have the patience to work it all out on my own; but since I have a limited amount of time every day I can work, and even that is clouded with pain and mental exhaustion and confusion, it’s hard to do that.