'If' arguments involving the player in Inform 7 causing contradictions - inform7

I'm trying to make a game in Inform 7 and have encountered a major problem, the answer to which apparently can't be found with a google search.
I'm using an 'if' argument to change certain situations based on what room the player is in. Instead of seeing what I have written as an 'if' argument, it has assumed 'If the player' to be an entity of itself.
This is the error message:
You wrote 'If the player is in Reception' , but also 'If the player is in
the Corner Table' : that seems to be saying that the same object (If
the player) must be in two different places (Reception and Corner
Table). This looks like a contradiction.
This is my code in both places:
If the player is in the Corner Table;
Understand the command "leave" or "exit" as something new.
Understand "leave" or "exit" as northwest.
If the player is in Reception;
Understand "key" as the Janitor's Key.
So, uh... can anybody help me?

There are several issues with the code you posted:
You can't have an if phrase out of context. You must write a rule for when the if phrase is considered.
Conversely, you can't use understand phrases in context. More specifically, if ...: understand "..." as ... isn't possible. Understand phrases must always be standalone.
The if phrases should end in a colon, not a semicolon.
"northwest" by itself is not an action; "going northwest" is.
You apparently want this instead:
Instead of exiting when the location is the Corner Table:
try going northwest.
This redirects the exiting action (which includes the commands "leave" and "exit") to the going northwest action in that particular room.
For the second if phrase, firstly if you have an object called "Janitor's Key" the game already understands "key" as referring to this object unless you've specifically made the object privately-named. Secondly, why have the game recognize "key" only in one location? Built-in scoping already makes sure that you can't refer to things that are not in the same room as the player.
So if the object is privately-named, and there's a reason why the key should be referred as such only in one location, the code for that is:
Understand "key" as the Janitor's Key when the location is the Reception.
But, as said, this is necessary only in very specific situations and most likely it's best to let the standard library handle it and leave it out altogether.

Related

Global visibility of another person in Inform7?

In a segment of a project I am working on for college, it is asked that one is able to steer another person using a kind of a walkie-talkie. However this requires some kind of global access to the person one should be able to control like that. One could probably do one of the following:
Swap the player each time he asks the other character to do something, carry out the action and return
Using the walkie talkie to change the views of the character (which does not look like an intuitive way of playing to me)
Somehow make the other character visible in every room (which would be the one I would prefer the most)
Unfortunately I was unable to find anything like that in the documentation (visibility is only lighting in one room, reachability only opening/taking something out of something). Another way I thought of was saving the origin room of both, place them in one secret room, c1 then asks c2 to try doing something, both are placed to their positions, and the action asked for is carried out by c2.
However writing this as a before rules does not work, because it is already cancelled by the default check rule. On the other hand I cannot write:
Check asking c2to try doing something
because that is to general.
Any ideas, approaches or solutions are welcome!
The concept you're looking for is "scope" (Writing with Inform ch. 18.29.) The following places "c2" in scope and therefore makes it accessible everywhere:
After deciding the scope of the player:
place c2 in scope.
You can also make it conditional:
After deciding the scope of the player when the player is carrying the walkie talkie:
place c2 in scope.
The rest is fine tuning. The following prevents commands that aren't logical when c2 isn't physically in the same space (like "look at c2"):
Before doing something to c2 when c2 is not in the location and not answering c2 that:
say "C2 isn't here right now. You can tell it what to do through the walkie talkie by commanding for example C2, JUMP." instead.
This one prevents the "You can't reach into..." error when the issued command is invalid:
Before answering c2 that:
say "C2 doesn't understand that command." instead.

Amazon Alexa - One intent enable utterances

In Amazon Alexa is there a way to have one intent initialize a set of utterances?
I ask because I need to identify models of cars in addition to times and places. Adding slots for cars/places seems ridiculous as there would probably be 8000+ possibilities.
ex:
valetService.prototype.launch = fucntion(intent, session, response){
if(intent.slots['vehicleType'] === 'car'){
response.ask('Which vehicle?', *activate utterance*);
}
};
If this isnt possible, could I create a series of functions that handle each piece of information necessary and then change the target function for a single-word-intent each time?
You don't need to do what your question is aimed at. What you're trying to avoid --not defining a Custom Slot Type-- is actually the answer to your problem.
You can use a Custom Slot Type for what you want. I agree that it would be ridiculous to list all the possible options, but that's the catch: you don't have to!
All you have to do is to define a Custom Slot Type, perhaps add a few values, because I'm not sure you can get away without and you're done. Alexa WILL SEND the value for the slot to your skill, even if it is not in the list. In Amazon words:
Note that a custom slot type is not the equivalent of an enumeration. Values outside the list may still be returned if recognized by the spoken language understanding system. Although input to a custom slot type is weighted towards the values in the list, it is not constrained to just the items on the list. Your code still needs to include validation and error checking when using slot values. See the “Handling Possible Input Errors” section of Handling Requests Sent by Alexa.
You can find all about it here.

xProc - Pausing a pipeline and continue it when certain event occurs

I'm fairly new to xProc and xPath, but I've been asked to solve the following problem:
Step 2 receives data via the secondary port from step 1. Step 2 contains a p:for-each, which saves a document into a folder for each element that passes the for-each.
(Part A)
These documents (let's say I receive 6 documents from for-each) lay in the same directory and get filtered by p:directory-list and are eventually stored in one single document, containing the whole path of every document the for-each created. (Part B)
So far, so good.
The problem is that Part A seems to be too slow. Part B already tries to read the data Step A
stores while the directory is still empty. Meaning, I'm having a performance / synchronization problem.
And now comes the question:
Is it possible to let the pipeline wait and to let it continue as soon as a certain event occurs?
That's what I'm imagining:
Step B waits as long as necessary until the directory, which Step A stores the data in, is no longer empty. I read something about
dbxml:breakpoint, but unfortunately I couldn't find more information than the name and
a short description of what it seems to do:
Set a breakpoint, optionally based upon a condition, that will cause pipeline operation to pause at the breakpoint, possibly requiring user intervention to continue and/or issuing a message.
It would be awesome if you know more about it and could give an example of how it's used. It would also help if you know a workaround or another way to solve this problem.
UPDATE:
After searching google for half an eternity, I found SMIL which's timesheets seem to do the trick. Has anyone experience with throwing XML / xProc and SMIL together?
Back towards the end of 2009 I proposed the concept of 'Orchestrating XProc with SMIL' http://broadcast.oreilly.com/2009/09/xproc-and-smil-orchestrating-p.html in a blog post on the O'Reilly Network.
However, I'm not sure that this (XProc + Time) is the solution to your problem. It's not entirely clear, to me, from you description what's happening. Are you implying that you're trying to write something to disk and then read it in a subsequent step? You need to keep stuff in the pipeline in order to ensure you can connect outputs to subsequent inputs.

REST resources with a triple as a parameter

When needing to create a URL that takes a finite set of parameters, where all of said parameters are semantically the same "level", what is the current consensus around the use of delimiters within URLs? Here's an example:
/myresource/thing1,thing2,thing3
/myresource/thing2,thing1
/myresource/thing1;thing2;thing3
/myresource/thing1;thing3
That is to say, the parameter here could be a single, a pair or a triple. They can be specified in any order because they are not a logical tree, and thing2 is not a subordinate resource of thing1, so doing something like this seems "wrong":
/myresources/thing1/thing2/thing3
This bothers me because it implies a tree-like relationship between the elements of the triple, and that is not the case (despite many HTTP frameworks seemingly pushing this, wrongly in my view). In addition, using a query string doesn't feel right as this is not a search operation, it is a known triple in a very finite space - there's nothing to query or search, so to speak.
I suppose the other option would be to make it a POST request and supply a body that details the parts of the triple being supplied. This doesn't give me warm fuzzies though, for some reason.
How have others handled this? Delimiters seem clean to me, and communicate the intended semantics of the resource, but i know there are folks would would take a different view, and I was looking to understand the experiences of others who've had similar use cases.
Since any value can be missing and values can appear in any order, How would you know which value is for which parameter (if that matters).
I would have used query string for GET, or in the payload for POST.
Use query parameters
/path/to/the/resource?key1=value1&key2=value2&key3=value3
or matrix parameters
/path/to/the/resource;key1=value1;key2=value2;key3=value3
Without a proper example, I'm not sure exactly about your needs.
However, a little known fact is that any HTTP parameter can have multiple values. It is the way to go when you have a set of objects (see GoogleMaps static API for an example).
/path/to/the/resource?things=thing1&things=thing2&things=thing3
Then you can use the same API for single, pairs, triples (and more).

Count number of digital signatures?

I have a form that allows for multiple signatures. I would like for the form to count the number of signatures and display text if under 3 signatures (as a warning).
How can this be done? I assume the solution would be some sort of VB code.
I found this post but seems to only be a boolean regarding a signature. I've also tried adding a rule on say a Button, but "Conditions" seem very limited. I could pick the signature control, but things like "is not present" or "is blank" doesn't seem to appropriately pick up if there are any signatures or not. I can't find any conditions that correctly detect signatures.
Note this is being filled out on the web. Details on my form setup:
InfoPath 2010 pushed to a Sharepoint site
Section created w/ Digital Signatures enabled for it
"All the signatures are independent" option is used
I did try sum() on the signature control, but it returned NaN
Per this MSDN article, I tried some VBcode but I haven't been able to get the syntax working. I've tried things like <signature_control_name>.Count
In your data source you should have two signatures groups, one nested within the other. All signatures are stored as nodes within the inner most group as Signature nodes.
If you are using script/managed code, you should be able to grab the inner node and then do a count on the number of Signature nodes within it.
I am not sure of a way to do that using just IP rules since there is no actual node there until a signature is applied (IP won't validate the rule and let you save it).

Resources