Is there a reason why only certain methods are "plannable"?


#1

I thought I posted this question awhile ago, but now I’m thinking I never got around to it:

When you have a programmable unit that uses plans, it seems that only certain methods (say, move, etc) can be used in that plan. Is there a reason why custom methods aren’t allowed? As it stands now, if you want a plan you’re required to use the “say” and “hear” exchange rather than just having a method call that does what you want.


#2

All methods that work with plan() have to be coded just so to be able to continue the previous action when called again unless they are done, and it’s a very buggy and tricky process that I try to avoid whenever possible by making levels use chooseAction() instead.

I wrote up some more about the complications here: https://github.com/codecombat/codecombat/wiki/World#aether-and-instrumenting-the-player-code


#3

I’ve experienced performance issues with chooseAction that I don’t get with plan. There’s also the issue that you mention with needing to wait for the previous action to finish before taking a new action. Plan has that built in, while chooseAction doesn’t.

I understand that this is probably a difficult thing to accomplish, but I would really like a good way to be able to make a method call and be able to specify “wait until this is actually done before going on to the next line”. I tried adding in my own while(test for completion){this.wait()} loops, but that gets treated as an infinite loop when the level loads, so I don’t think that’s really doing the trick.