|Anonymous | Login | Signup for a new account||2019-05-26 00:02 PDT|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001787||Core Inform||Phrases and functional programming||public||2015-11-23 09:27||2019-03-26 19:25|
|Target Version||Fixed in Version|
|Summary||0001787: Condition testing a stored action evaluates incorrectly?|
|Description||I'm having trouble figuring out how to describe this issue precisely; it may be easiest just to look at the provided demonstration source -- the condition in question is set off by commented asterisks.|
I naively be expected that this type of condition would evaluate to true given that a similar construction can be used as part of a rule preamble, and that in such cases it would evaluate to true regardless of the direction in question. However, in this context the compiler seems to expect that a direction will be provided, and in the absence of one specified is perhaps treating the direction as nothing when evaluating the condition.
A workaround in this particular instance can be had (uncomment "[oppposite of way]" after the problem condition to see the expected behavior for the last test-me command), but this feels a bit like a bug.
|Minimal Source Text To Reproduce|
"Scouting" Place is a room. Bob is a man in Place. Other Place is east of Place. A rock is in Other Place. A persuasion rule: persuasion succeeds. The initiating action is a stored action that varies. First Before doing something: now the initiating action is the current action. First Before asking someone to try doing something: now the initiating action is the current action. Every turn: say "<initiating action = [initiating action] / actor = [actor part of initiating action], action = [action name part of initiating action], noun = [noun part of initiating action]>[line break]"; if the location of Bob is not the location: let way be the best route from the location of Bob to the location, using doors; if way is not nothing and the initiating action is the action of going way: silently try Bob going way; if the player can see Bob: say "Bob follows along behind you."; otherwise if way is not nothing and [****] the initiating action is the action of asking Bob to try going [****] [opposite of way] and the noun part of the initiating action is a direction: let scouted place be the location of Bob; silently try Bob going way; let incidental item be a random thing in scouted place; if the player can see Bob: say "Bob returns shortly. 'I saw [an incidental item],' he notes."; otherwise: try Bob going way. test me with "e / w / gonear rock / w / bob, go east"
|Additional Information||As a side note, I struggled for a while trying to come up with an equivalent for "something" or "somewhere" that would cover a direction, so that the condition could be phrased, e.g. "asking Bob to try going someway". Even though this would be a feature request, would it be worthwhile to add it?|
|Tags||No tags attached.|
|Effect||(serious/mild) Game compiles but misbehaves|
edited on: 2015-11-23 12:59
I'm not sure what problem you're describing. The sample code works correctly, but you want to phrase it differently? Or does it not work correctly?
edited on: 2015-11-25 01:19
Sorry, zarf -- I often seem to have trouble describing the issue concisely.
To be specific: In this case, the condition offset by asterisks, namely the condition "the initiating action is the action of asking Bob to try going" seems like it should evaluate as true if the initiating action (a stored action) is "asking Bob to try going west" or "asking Bob to try going north" or "asking Bob to try going <any direction>".
It does NOT evaluate in this manner; it evaluates to false in those cases.
The sample code does not seem like it is working correctly for the last command ("bob, go e") which should trigger the "Bob returns shortly..." response instead of the "Bob arrives from the east." response provided by the Standard Rules.
The correct response *is* triggered if the commented "[opposite of way]" is uncommented, showing that if the condition's action description contains a noun then it evaluates as expected.
It doesn't seem like the condition *should* have to include a noun given that a similar condition in a rule preamble does not require one, and given that not specifying a noun in a rule preamble causes the rule to apply regardless of the noun. It looks like this type of condition in a rule preamble treats a lack of noun as a wildcard for the noun, while in the example it (apparently) is treating a lack of noun as meaning that the noun must be nothing.
That's what feels like a bug, especially given that there doesn't seem to be any way to force a wildcard treatment via a non-specific noun like "someone" or "something".
Does that make any more sense?
I *think* this is a misunderstanding of the way "X is Y" is evaluated when X and Y are stored actions. It's not a pattern-match. In your "if" statement, the first stored action is "asking Bob to try going east" and the second is "asking Bob to try going nothing". These are not equal.
If you change the line to
otherwise if way is not nothing and the initiating action is asking Bob to try going a direction:
...then it's treated as a pattern-match and the code behaves the way you want.
Yes. Darn it, yes. I see the difference now: when I say "action of" and don't provide a noun, it is set to nothing because that's the (legitimately) presumed authorial intent since I constructed a specific action. And I can't use "a direction" within "action of" because that's not a specific direction, as pointed out in WWI 12.20.
My apologies for not taking this to the forum first, and thanks for the help. This can be closed under "reporter failed to understand what he was doing".
Reviewing this, I think that what I was looking for when I submitted the original report was the ability to create a condition with wildcards for objects, similar to that which can be used when creating rule preambles. It's the same idea put forward in the suggestion at: https://inform7.uservoice.com/forums/57320-general/suggestions/32782867-allow-stored-described-actions-and-or-stored-de [^]
6M62 now has a problem message that explains why this syntax is disallowed, but it's not clear why this is undesirable from a design perspective, and the problem message ("... 'asking Bob to try going a direction' is too vague to describe a specific action.") seems somewhat misleading because the sought-after functionality can be created in 6M62 by being a bit more verbose, e.g.: "otherwise if way is not nothing and the actor part of the initiating action is Bob and the action name part of the initiating action is the going action:"
|2015-11-23 09:27||otistdog||New Issue|
|2015-11-23 12:58||zarf||Note Added: 0004191|
|2015-11-23 12:59||zarf||Note Edited: 0004191||View Revisions|
|2015-11-23 12:59||zarf||Note Added: 0004192|
|2015-11-23 12:59||zarf||Assigned To||=> zarf|
|2015-11-23 12:59||zarf||Status||new => feedback|
|2015-11-25 01:16||otistdog||Note Added: 0004193|
|2015-11-25 01:16||otistdog||Status||feedback => assigned|
|2015-11-25 01:19||otistdog||Note Edited: 0004193||View Revisions|
|2015-11-25 11:40||zarf||Assigned To||zarf =>|
|2015-11-25 11:41||zarf||Status||assigned => new|
|2015-11-25 11:50||zarf||Note Added: 0004196|
|2015-11-25 12:34||otistdog||Note Added: 0004197|
|2019-03-26 19:25||otistdog||Note Added: 0004836|
|Copyright © 2000 - 2010 MantisBT Group|