intfiction.org

The Interactive Fiction Community Forum
It is currently Wed Oct 24, 2018 1:18 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Changing body parts
PostPosted: Wed Aug 03, 2016 10:08 am 
Offline

Joined: Tue Aug 02, 2016 8:45 pm
Posts: 1
Not sure if this is wandered or not I can't manage to find the info I want. Basically I'm wondering how would I say give an item that when used or worn would change the value of a body part such as hair? Eg. Using a hair spray would lengthen hair and would be able to change description? I'm pretty new to i7 and am getting stuck on only this.(so far) any help would be nice.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Changing body parts
PostPosted: Wed Aug 03, 2016 7:40 pm 
Offline

Joined: Sat Dec 26, 2015 7:34 pm
Posts: 517
(This should go in the Inform 6 and 7 Development forum.)

Here's an example that assigns hair with random properties to each character at the beginning of a game and allows the hair to be changed.
Code:
"Hair Today, Gone Tomorrow"

Section 1 - Hair

A hair is a kind of thing. The indefinite article is "some". It is part of every person.

Hair-length is a kind of value. The hair-lengths are long, medium-length, and short.
Hair has a hair-length called the length.

Hair-color is a kind of value. The hair-colors are blonde, red, brown, and black.
Hair has a hair-color called the color.

Hair-straightness is a kind of value. The hair-straightnesses are straight, wavy, curly, and frizzy.
Hair has a hair-straightness called the straightness.

The description of hair is "[The item described] is [length of the item described], [straightness of the item described], and [color of the item described]."

Understand "my" as some hair when the item described is part of the player.
Understand the length property as describing hair.
Understand the color property as describing hair.
Understand the straightness property as describing hair.

When play begins:
   repeat with P running through people:
      let H be random hair that is part of P;
      now the length of H is a random hair-length;
      now the color of H is a random hair-color;
      now the straightness of H is a random hair-straightness.
   
Instead of examining a person, try examining random hair that is part of the noun.

Section 2 - Using

[This is more laziness than a good idea. Trying to avoid having to implement separate dye, curl, cut, straighten actions for this example.]

Using is an action applying to one carried thing.
Understand "use [something preferably held]" as using.

Report an actor using (this is the block using rule):
   say "[The actor] [don't] have any use for [regarding the noun][those] right now." (A).

The using action has a hair called H.

Setting action variables for using:
   now H is random hair that is part of the actor.

Section 3 - Other Actors

Persuasion rule for asking people to try doing something: persuasion succeeds.

Unsuccessful attempt by an actor taking when the reason the action failed is the can't take people's possessions rule:
   say "[The actor] [can't] take [the noun] because [if the holder of the noun is the player][we][else][the holder of the noun][end if] [are] holding it."
   
The block giving rule is not listed in the check giving it to rules.

Section 4 - Hair Dye

Hair dye is a kind of thing. The indefinite article is "some".

Hair dye has a hair-color called the color.
The printed name is "[color of the item described] hair dye".
Understand the color property as describing hair dye.

Check an actor using hair dye (this is the can't dye hair its current color rule):
   if the color of H is the color of the noun, instead say "[The H] is already [color of H]." (A).
   
[Suppress "Alice is unable to do that." msg when the check rule above has already printed a failure msg.]
Unsuccessful attempt by an actor using hair dye when the reason the action failed is the can't dye hair its current color rule: stop.

Carry out an actor using hair dye (this is the using hair dye rule):
   now the color of H is the color of the noun.
   
To dye is a verb.
Report an actor using hair dye (this is the report using hair dye rule):
   instead say "[The actor] [dye] [their] hair [the color of the noun]." (A).

Section 5 - Blades

A blade is a kind of thing.

Check an actor using a blade (this is the can't cut short hair rule):
   if the length of H is short, instead say "[The H] is already short enough." (A).
   
Unsuccessful attempt by an actor using a blade when the reason the action failed is the can't cut short hair rule: stop.

Carry out an actor using a blade (this is the using a blade rule):
   now the length of H is the hair-length after the length of H.
   
To cut is a verb.
Report an actor using a blade (this is the report using a blade rule):
   instead say "[The actor] [cut] [their] hair with [the noun]. It's now [the length of H]." (A).
   
Section 6 - Hair-growers

A hair-grower is a kind of thing.

Check an actor using a hair-grower (this is the can't grow long hair rule):
   if the length of H is long, instead say "[The H] is already long enough." (A).
   
Unsuccessful attempt by an actor using a hair-grower when the reason the action failed is the can't grow long hair rule: stop.

Carry out an actor using a hair-grower (this is the using a hair-grower rule):
   now the length of H is the hair-length before the length of H.
   
To massage is a verb.
Report an actor using a hair-grower (this is the report using a hair-grower rule):
   instead say "[The actor] gently [massage] [the noun] into [regarding the actor][their] scalp. Almost immediately, [the H] explodes in a flurry of growth. It's now [the length of H]." (A).

Section 7 - Hair Salon

Hair Salon is a room. "This mirror-filled room contains a number of hair care products and tools."

Some mirrors are scenery in the Hair Salon. Understand "mirror" as the mirrors.

Instead of examining or searching the mirrors, try examining the actor.

There is a hair dye in the Hair Salon. The color is blonde.
There is a hair dye in the Hair Salon. The color is red.
There is a hair dye in the Hair Salon. The color is brown.
There is a hair dye in the Hair Salon. The color is black.

Some scissors are a blade in the Hair Salon.

The hair-gro solution is a hair-grower in the Hair Salon. The indefinite article is "some". The printed name is "Hair Gro (tm) solution".

Understand "hair" or "gro" or "grow" or "growth" or "grower" as the hair-gro solution.

[TODO: curling iron, straightener]

Alice is a woman in the Hair Salon. "Alice is sitting nearby, looking at herself in a mirror."

Test dye with "x me / use red hair dye / x me / x alice / alice, use brown hair dye / x alice / alice, use red hair dye / give red hair dye to alice / alice, use red hair dye / x alice ".

Test scissors with "x me / use scissors / x me / give scissors to alice / x alice / alice, use scissors / x alice / alice, use scissors / x alice".

Test growth with "x me / use solution / x me / use solution / x me / give solution to alice / x alice / alice, use solution / x alice".

Test me with "test dye / test scissors / test growth".

_________________
Vince Laviano


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group