set numeric <health; #player:health#>
inc <health; 5> ' adds 5 to 'health'.
property <player; health=%health%>It would be nice to not have to use a temp. numeric but this method only means 3 steps/lines. Freak wrote:If you're going to be teaching, you should probably avoid Quest. It's not designed like other languages (it's not designed around a context-free grammar); it has numerous inconsistencies; there's not a lot of sample code.
S1aY3R wrote:That doesn't necessarily work, though. We have yet to see a game that properly uses the full potential of Quest, and frankly, I'm unsure if we will. I seriously hope we do, as there is definitely a future in the system, but we don't seem to be attracting any IF fanatics, or real coders. It seems to only be the dabblers that make it to Quest.
Freak wrote:I doubt anybody will ever use the full potential of any system, but even the highly-rated Quest games I've played rarely rise above the technical level that Inform / TADS programmers tend to take for granted.
property <player; health={#player:health# + 5}>
health={#player:health# + 5}
Alex wrote:To answer the original question, you can do it in one line. Here's a modified version of Elexxorine's code:
property <player; health={#player:health# + 5}>
This makes use of the ability in Quest 4.0 to evaluate an expression anywhere, by surrounding it in curly brackets.
player.health = player.health + 5;Incidentally, I'm sure Quest's apparent lack of a "context free grammar" has been explained to me before, but I'm not sure I've fully grasped what this actually means in terms of missing features (or confusing behaviour). Specific feature requests are always welcome though!
henrytj wrote:Thank you for the excellent answer.
IT would be nice to define a limited (and named) set of states. Such as the comic book condition that I mentioned, perhaps in another thread. (MintCondition, FineCondition, GoodCondition, PoorCondition, etc.) Then be able to set and compare the Condition state of a comic book objects to these named contition. In some cases it makes sense to allow the condition states to be "ordered." So decrementing the Condition state would deteriorate the comic book, etc.