ok, just going to throw all my questions in here instead

Too many small questions, don’t want to pollute the forums.

I’m trying to make a wishing command that’ll summon a genie, my code is this:

[code]z_summon is a kind of thing.

instead of dropping the z_summon:
say “You dropped the wishing rock and it broke into a trillion pieces”;
remove the noun from play;
now Zozael is in the location.

The Odd Stone is a z_summon. It is inside The Strange Box.
Understand “stone”, “rock”, “odd” as The Odd Stone.
[/code]

What i’m trying to do is create a set up that does the following.

On the text “I wish” (will have following text that I don’t care about but expect the player to write in). If the player is holding the z_summon, it’s meant to drop the summon, spawn the NPC named Zozael and then start a discussion dialogue.

My problem is that I can’t seem to get the “wish” part to work.

I’ve tried

[code]understand the command “wishing” as something new. understand “I wish [text]” as wishing. wishing is an action applying to anything.

Check wishing:
if Z_summon is carried, try dropping z_summon.

[/code]

But it doesn’t seem to work. It throws up complains about the try drop and about the wishing part. THe only way I can get the command to work is by having no [text] at the end, but if I do that, every time the test data has “I wish” written in it it only works if here’s no text following, else throws the “I only understand you as far as…” error.

Two things, Firstly, if you want wishing to work with an arbitrary text, you’ll need to define it as applying to a topic.

Wishing is an action applying to one topic. Understand "wish [text]" and "I wish [text]" as wishing.

I strongly suggest allowing WISH as well as (or instead of) I WISH, since the standard IF convention is not to use the pronoun.

You probably also want

Understand "wish" and "I wish" as wishing.

(This covers the player not bothering with the arbitrary text, which seems only fair if you’re going to ignore it anyway.)

Also, in your check rule, the instruction “try dropping z_summon” doesn’t make sense, because there’s no such thing as the z_summon; a z_summon is a kind, not a thing. (For all Inform knows, the player might be carrying many z_summons.) You need to try dropping a particular z_summon. The usual way to do this is;

Check wishing when the player carries a z_summon:
     try dropping a random z_summon carried by the player.

Great, that worked thanks.

Does it have to be “random z_summon” though? Can’t I just say, “z_summon carried by the player”?

Here’s a slightly generalized version with multiple wishing stones (z_summons), each with its own genie:

Test Chamber is a room.

A wishing stone is a kind of thing.

A genie is a kind of person.
Zozael is a genie.
Leazoz is a genie.

A wishing stone has a genie.

A proper-named wishing stone called The Odd Stone is in Test Chamber.
Understand "rock" as The Odd Stone.
The genie of The Odd Stone is Zozael.

A shiny marble is a wishing stone in Test Chamber.
The genie of the shiny marble is Leazoz.

Instead of dropping a wishing stone when a genie is in the location:
	say "There's already a genie here."

Instead of dropping a wishing stone:
	say "[We] drop [the noun], and it breaks into a trillion pieces.";
	remove the noun from play;
	now the genie of the noun is in the location.

Wishing is an action applying to one topic.
Understand "I wish [text]" or "wish [text]" as wishing.

Check wishing when the player does not carry a wishing stone (this is the wishing without a wishing stone rule):
	instead say "That's nice, but [we]['re] not carrying a wishing stone." (A)
	
Carry out wishing:
	silently try dropping a random carried wishing stone.

Test me with "wish for pie / take all / wish for pie / l".
Test me2 with "take all / drop stone / l / drop marble / l".
Test me3 with "take all / drop marble / l".

You might want to consider not allowing the player to summon a genie merely by dropping a wishing stone, but only via the wishing action. This would prevent a player from accidentally solving the puzzle without understanding what they’re doing (e.g., “take all / drop all”).

No, because z_summon is a kind of thing, not a specific thing. As far as I7 is concerned, the player could be carrying multiple z_summons, and it wants to know exactly to which one you’re referring. If you don’t care, you have to state this explicitly by asking for “a random” one.

In this case, you should be able to avoid using “random” by making the when-clause set a temporary variable:

Check wishing when the player carries a z_summon (called the portkey): try dropping the portkey.

(Haven’t tested this.) If the player carried more than one z-summon, this would pick the first one that Inform finds when it goes through it lists of things–that’s often the first one defined in the source code–so this shouldn’t be used as a substitute for “a random” when you really do want it to be random. But when you’re sure there’s only going to be one, this is fine.

Also, no need to worry about polluting the forum–opening different topics for each question is fine and makes it easier for other users to find the solutions in case they have similar questions!

Awesome, thanks guys. Appreciate all that.

ok, next question. I want to create a series of “functions” that are called to trigger things like dialogue events and whatnot. Do I need an understand for every “Carry out” command or can I just create “carry out talking” and have this called straight after a character arrives? Also, is there an “on next turn” command available so the next time my guy types something happens or do I need use a Boolean and the “check every turn” to make that work?

Basically i’d like to have the talking engage with my genie on the next turn after they appear but give the player chance to do a few things first like try to flee the room or examine th genie before engaging in talk, BUT i’d like the genie to be the one to initialize the dialogue… hence the “wait a turn” approach.

I’m also thinking that a rule attached to the “spawn genie” carry out could say, “in two turns talk to player” or something to that effect. But I was hoping for a way to do this so I can keep my story contents a bit more localized. i’m keeping each summon event in it’s own chapter as each summoning is meant to do something a little different over the course of the game.

There are several conversation extensions that can help you with this. If you go to the I7 Extensions pane and click on the Public Library tab, you’ll see an organized list of available extensions. Check out those listed under §6. Other Characters§6.1. Getting Started with Conversation and §6.2. Saying Complicated Things.

If you post a brief example transcript of how you’d like the summoning of a genie and the subsequent conversation to work, someone can probably recommend the most suitable extension to achieve your goals.

Thanks for that. It may seem crazy but I can’t seem to find examples that show how the extensions actually work. I can include the extensions but the “documentation library” just shows the extensions themselves and no examples or codebase for reference demonstrating how to use the extensions.

In regards to transcription. I wanted something like this:

Genie Appears talk genie Genie responds with topics pick topic Genie talks on topic and/or does some actions associated with that particular topic (ie: grant a wish). pick departure. Genie leaves.

Basically i’d want a framework that’d let me write up a list of topic information, but be able to carry out an action or two dependant on which topics I pick. I was going to just write a series of includes, ie: include myWishTopic when genie is present and topic was selected: carry out action.

Something akin to that (my pseudocode is terrible, still learning i7 syntax) but you should get the idea.

THe player is supposed to be able to summon the genie by finding z_summon pieces around the map, and taunt the player effectively, but provide unlocks and other equipment as provided. So the actions will need to be able to create equipment and issue to player inventory, and possibly alter some things in the location too depends on circumstance.

All these I can do independently, just not sure on the best way to tie them into a conversation system, if I can even do that without resorting to a check for each action after a topic is picked.

My only other issue right now is for some reason I get a clone of things I’ve attached to my player. I have the spawning code as:

Jon is a person. Jon is a man. Jon is in Jon_Bedroom. The player is Jon.

but whenever I “examine”. I see Jon’s thing and your thing. as choices.

The indexer is showing that whatever thing I create that is a part of “every person” seems to create two for the first character viewpoint I set my player to. Is there a way to remove that duplicate? At the moment I’ve got a “remove your thing” from play when play begins that’s a workaround, but i’m worried that the “extra” person that seems to be coupled with the POV character Jon, could cause logic issues later in my game as viewpoints will shift again to partymates.

Last question too at the moment. Regarding scenes, if I create a scene, do any rules/actions/whatevers I do only work inside the scene if they’re declared there? if I declare anything of that sort outside of a scene (say different volume/part/section of the IF) is that the equivalent of a global rule/action/value/whatever?

bump.

Still haven’t been able to work out the way around that your/player problem yet. Best I can do is “remove attached things” at start, and just write overrides that when you examine yourself, you look at someone else. But it still prompts to examine “you” or the “player” you’re playing as, very annoying.

From the Inform 7 manual:

"In fact slightly odd things can happen if we combine this with changing the identity of the player. This works:

Cleopatra is a woman in Alexandria. The player is Cleopatra. 
A nose is a kind of thing. A nose is part of every person.

but if those lines are in reverse order then Cleopatra’s nose is assembled before she becomes the player, with the result that it ends up called “Cleopatra’s nose” rather than “your nose” in play - which is very regal but probably not what we want. To avoid this, settle the player’s identity early on in the source text."

Yes, im aware of thsr. But the player is pretty much set first before anything else.

Nevermind, figured it out.

My current problem is this however, I can’t figure out how to override the examine on a player/person to examine a thing I’ve attached to them instead.

I’ve got the following:

A body is a kind of a thing. A body has a text called desc. The desc is usually "blank". A body is part of every person.

now when I use the line in general play:

say "[desc of Player's body]" on the player or NPC, naming them explicitly it works. What am I doing wrong when trying this line?

check examining: if noun is a person, say "[desc of noun's body]" instead.

I get this:
Problem. In the line ‘say “[desc of noun’s body]”’ , I was expecting that ‘desc of noun’s body’ would be something to ‘say’, but it didn’t look like any form of ‘say’ that I know. So I tried to read ‘desc of noun’s body’ as a value of some kind (because it’s legal to say values), but couldn’t make sense of it that way either.

Now the only thing is that I can see is instead of a person, it’s just noun, but if I’ve aleady checked it’s a person as the noun, shouldn’t this line work anyway?

I know I can set person, NPC details quite easily just values of the player/npc/person type, but I explicitly want a body type to group sub items and do a few other functions in my game. So I need to know how to access the values of a thing attached to a person, but not off the person directly like “a person as a text called desc”.

The way Inform handles assemblies can be confusing, because it automatically does some stuff but not all the stuff you might think.

When you make an assembly using code like this:

A body is part of every person.

Inform goes through and gives the body that is part of John the name “John’s body,” and the body that is part of Mary “Mary’s body,” and so on. It’s kind of like you’d written:

John's body is a body. It is part of John. Mary's body is a body. It is part of Mary.

So when you explicitly refer to “John’s body,” Inform understands, because you’re using the actual name that the body has. But this doesn’t allow you to write variables like “noun’s body,” any more than if you created two objects called “John’s napkin” and “Mary’s napkin” you could write “the noun’s napkin.”

The solution here is to say this (I’m not on a computer that has Inform installed, so I may get the syntax slightly wrong):

a random body that is part of the noun

Here “a random” is a bit deceiving–you’ve set things up so that there’s always one and only one body that is part of the noun, so it’s “randomly” choosing that one. But Inform has no way of knowing at compile-time that there always will be one and only one body that is part of the noun, so we need to trick it with “a random.”

Also, it’s a bit more elegant to write:

Check examining a person: say "[desc of a random body that is part of the noun]" instead.

In general, it’s good to put your code in the rule header rather than if-clauses if you can; it’ll make sure that more specific clauses run first, and can save you some unnecessary headaches with things like “Instead” rules.

You can also use the built-in “description” property through something like this.

Check examining a person who incorporates a body (called the corpus): try examining the corpus instead.

This redirects examining a person to examining their body, prevents RTEs if someone somehow ends up without a body, and allows you to customize the body description however you like (by writing more rules for “examining”).

Awesome, thanks guys, that worked.

@matt w: I did originally have the check in the header, but as part of my debugging I moved it to an if statement to see if it was me getting the header rule part wrong or something else.

Is that issue regarding the building at runtime also why I had to check dropping a random z_summon instead of just saying drop z_summon earlier in the thread?

And will this work too now for any sub parts of body? say hands or legs or whatnot? I can say “desc of a random body’s hands that are part of the noun” or that effect? or do I have to nest in and find the random body, let it be say B and then “desc of a random hands that are part of B” or something?

Are you wanting to make the hands of Joe part of Joe’s body, rather than part of Joe? I wouldn’t recommend that.

If you really have to do it for some reason, then

random hands incorporated by a body incorporated by Joe

ought to work.

I was going to have them break down in a heirachy like this:

Body
 Head
  Face
   Eyes
   Nose
   Mouth
 Torso
  Arms
   Hands
 Legs
  Feet

Are you saying it’s better to leave them all as top-level to the players and/or NPCs?

This was meant to be for a clothing and makeup system (for female characters, obviously).

Mainly because i’d hoped I could trade these back and forth between players for my game as mentioned before, just trading arms instead of having to swap a heap of values, I can just swap the “things” attached between players.

Seems like it’d probably be safe to use “enclosed” rather than incorporated. Enclosure is the closure of incorporating, wearing, carrying, etc.; so anything that’s incorporated by the person would work, or anything that’s incorporated by something it incorporates. The only problem would be if you can pick up (or wear) body parts or other people, which I guess might be something that happens in the game you’re describing.

This was meant to be for a clothing and makeup system (for female characters, obviously).

Well, non-female people sometimes wear clothing and even makeup.

I guess using “enclose” would work. You’ll need to be careful with the names.

A body is a kind of thing. A body is part of every person.
A head is a kind of thing. A head is part of every body.
A nose is a kind of thing. A nose is part of every head.

Looks OK, but the player’s nose will come out with the name “your body’s head’s nose”, which is a trifle weird. (Of course there are plenty of ways round this, depending on exactly what effects you want.)

I can see how your approach would be useful if you want to have people switching body parts (that’s where this was going, right?); when you switch the head the nose comes along.

You could solve a lot of the issue with the weird names by writing printing the name rules:

For printing the name of a nose (called schnoz): say "[random person enclosing the schnoz]'s nose".

Even better would be to make a kind called bodypart, make nose/head/etc. kinds of body part instead of kinds of thing, and give every bodypart a kind text property that is set to its kind name. Then you can write one rule for every bodypart.

[code]A bodypart is a kind of thing. A bodypart has some text called kindname. The kindname of a bodypart is usually “body part”. [this is to catch anything we forget to set]
A body is a part of a kind of bodypart. A body is part of every person. The kindname of a body is usually “body”.
A head is a kind of bodypart. A head is part of every body. The kindname of a body is usually “head”.
A nose is a kind of bodypart. A nose is part of every head. The kindname of a body usually “nose”.

For printing the name of a bodypart (called limb): say “[random person enclosing the limb]'s [kindname of the limb]”.[/code]

This presupposes that one and only one person always encloses each bodypart. If you wanted to deal with loose bodyparts you’d have to write this rule so it only dealt with enclosed ones (and probably inserted the word “detached” into the name at the appropriate point). Again, you’d have to also be sure that no person could ever enclose another person.

The reason for the kindname property is that Inform 7 doesn’t provide a way to extract the bottom-level kind that a thing belongs to, so we just assign a text property to make sure that every nose gets called “nose” and so on. There’s an extension called Object Kinds that would let you do that without assigning a text property, but I haven’t played with that much.