dobjFor Problem

Dear all,

to keep it short:

+branches1000: Fixture
    name='branches'
    vocabWords='branches'
    location=Room1000
    dobjFor(Examine){
        action() {"There's several branches above you that are within reach. That comprises a chippy one, a short one, a sturdy one, and a zigzag one. Climbing down seems a little more complicated, 
            but your're not that high up, so you could simply jump without risking to break your neck.";}
    }
    dobjFor(Climb){
        action() {"Which one?";}
    }
;

“examine branches” will print the correct text, but “climb branches” will result in “That is not something you can climb.”. Would you be so kind as to tell me why that is so?

Thanks and kind regards, Grues

1 Like

You need to set isClimbable = true to prevent it from being rejected during verify without ever reaching your action.

2 Likes

Ha! Thanks! Didn’t find that one in the documentation or in the examples I have.

It looks like you might be using adv3, but if you’re using adv3lite there’s a great reference in the Library Manual for actions,

https://faroutscience.com/adv3lite_docs/manual/actionref.htm

If you click through there’s a table,

The table below lists each of the actions defined in the adv3Lite library, and summarizes the effects of each action and the conditions under which it is allowed to proceed. The purpose is to give game authors a quick reference to the main properties they may need to customize to allow an action to go ahead or explain why it can’t.

Sounds like that fixed it for you, but if you were using adv3 I think the solution would be to override the verify() method as follows:

+branches1000: Fixture
// &etc
    dobjFor(Climb) {
    // A blank method will override the check and allow it by default
        verify()  { }  
        action() {"Which one?";}
    }
;

If you are using adv3, you also probably don’t want or need to override the Examine action(), you can just set the desc() property instead. Also, get comfy with templates, they will really speed up your coding!

2 Likes

From the description, the branches (plural) seems the ideal candidate for a [Cc]ollectiveGroup (adv3 uses CamelCase, a3Lite uses camelCase, hence the regex)

Best regards from Italy,
dott. Piergiorgio.