Quick Question: Getting the last action of the player

Hey guys,

I’m definitely new to the whole Inform 7 scene. But I’m picking it up quickly thanks to rapid google searching.
Unfortunately, this one is a bit of a difficult to search for question.

I need to know the last action of the player to check within an if statement.
I have, essentially, an every turn rule that’s seeded with various if statements.
And the end of each of these if statements is a “try looking;”.

The problem with this, is that I want it to be a very specific case to force the player to “try looking;”.
Which would be when the last player’s action was either “USE” or “TAKE”, and only when they succeed.

So something to this effect:

if the player’s last action was use and successful:
try looking;

And yes, I already created USE as an action.

Any thoughts?
TL;DR - need to return last action of player

Thanks guys!

You could use

if the current action is using something or the current action is taking something:

However I suspect your code is not very Inform-y. Large rules with lots of if statements are rarely the best way to do something in Inform. In this case the most natural way to try looking after you’ve used or taken something is

After using or taking something: try looking.

Brilliance! Sheer brilliance!
Thanks, this worked exactly as I as hoping.

Yeah, you’re probably correct. I’m a game designer/programmer first - so old habits die hard.
In fact, I just had to step-up to the Z8 virtual machine right after including your suggested if statement.
Which is probably strong signification of that.

Unfortunately, the sleeker “After” method won’t work as these "try looking"s have to be done after a room description has been changed.
Which is housed inside of an every turn while in RoomX rule, hahaha.

I’m crazy, I tell you!
Thanks again.

You could also have a global flag. Set the flag during whichever action is appropriate; then have an every-turn rule which checks the flag, does a “look” if appropriate, and clears it.