Accessing action properties

i’m trying to set and access properties on actions like so:

  dangerous = true

so that when i direct NPCs to do something, i can check for dangerous actions, like so:

// inside npc code
acceptCommand(issuingActor) {
    if(gAction.dangerous) "I'd rather not.";

only that gAction is an EventAction, from which i can’t seem to access my own action definition.
is there a way to do this, or am i maybe going about it the wrong way?


Hey Collin, a couple of things:

Probably should try to do this in

npc.obeyCommand(issuingActor, action)

rather than in acceptCommand. (acceptCommand controls a lot of library behavior.)

Then, you can’t use the literal property ‘dangerous’, because that is a macro already used in verify routines.

So that I was able to get this to work:

obeyCommand(issuingActor,action) {
 if(action.propDefined(&dangrous) && action.dangrous)
   return fC('Too dangerous. '); //my shortcut macro for failCheck...
 else return true; }

Could your objective be achieved just by using

obeyCommand(issuingActor,action) {
   if(gActionIn(Fight,BungeeJump,Skydive)) return "Too dangerous..."


hey john,

obeyCommand(issuingActor,action) {
   if(gActionIn(Fight,BungeeJump,Skydive)) return "Too dangerous..."

that would work, yeah, but that’s going to be tedious, because i have a lot of custom actions, and want to track a few different action types (i.e. not just dangerous ones).

so, i just deleted quite some content from this comment, because i just figured out myself that i had to put

return curState.obeyCommand(issuingActor, action);

in that method, instead of inherited(issuingActor, action) :slight_smile:

so once again, thanks for your help! great solution!

No problem! Interesting concept you have going…

yeah, my game’s very heavy on human interaction, and i have a few concepts on my wish list that the standard library doesn’t account for (in an easy, or obvious way at least), like adverbs for actions (though i’ve hacked something together that seems to work).

1 Like

Are you working towards any competitions? Posting on IFDB?

i’ve only been thinking about that since reading your question about submitting long games to IFComp, earlier. but since i’ve been working on this game for only a few weeks now, and i’m mostly still learning the framework instead of furthering the plot, i probably don’t have to really give it more thought for a while yet. how about you? was that thread of yours helpful?

Yeah, I hope to submit to the IFComp… the thread helped clear that up for me. In non-related posts I had been getting a sense that long games were either unwelcome or would not get rated well in IFComp, so that thread was helpful in dispelling some of that.
If you read it all you’ll know, for me, it’s mainly a matter of whether I finish my game on time. But I do plan to enter it in one comp or another…