intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Jan 19, 2019 4:56 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Jan 07, 2019 8:08 am 
Offline

Joined: Sun Jan 06, 2019 2:44 pm
Posts: 1
I'm very new to this, but i want to make custom commands like "scream" or "push mat." instead of look under. any help.
just in case this is what i have so far

Code:
"first test" by R3M
Include Hidden Items by Krister Fundin.




[Front porch]
front porch is a room. "the house towers above you as you are blinded by the light reflecting from the windows."

player is in front porch.

the welcome mat is scenery in front porch. the description is "a standard welcome mat that lies crooked on the ground. it has a small bulge in the middle "

a white door is a locked door. it is north of front porch and south of hallway. "a white door leads [if the player is in front porch]into the house[otherwise]outside[end if]."

the description of a white door is "a beautiful looking white door, apon closer inspection it seems handcrafted. a welcome mat lies crooked on the ground."

a small key is a thing. the description is "a small golden key."

a small key unlocks a white door.


instead of looking under the welcome mat for the first time:
   move a small key to front porch;
   say "you found a small golden key.";


[Hallway]
hallway is a room.
"a beautiful hallway filled with statues and paintings."


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Jan 07, 2019 8:50 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5526
Location: Burlington, VT
Pushing is a built-in action so you don't have to define it! You should probably still allow "look under mat" as a synonym though. One way to do that would be with a kind of action:

Code:
Pushing the mat is moving the mat. Looking under the mat is moving the mat. Pulling the mat is moving the mat.

Instead of moving the mat for the first time...:


(In this the name of the kind of the action is "moving the mat"--the fact that "the mat" is part of the name doesn't mean anything, it just makes it easier to keep track of.)

If you do want to make a custom command for a new action, then you need to define the action, define Understand lines for the commands leading to the action, and write rules for the action:

Code:
Screaming is an action applying to nothing.

Understand "scream" as screaming.

Instead of screaming: say "Even if you're outside, you can still use your inside voice.


Or for an action that takes a noun:

Code:
Lifting is an action applying to one thing. 
Understand "lift [something]" as lifting.
Instead of lifting the welcome mat: try looking under the welcome mat.
Instead of lifting something: try taking the noun.


(The more specific "instead" rule runs before the more general one, so this means "lift mat" turns into looking under the mat and "lift key" or anything else turns into taking it.)

Hope this helps! Also I am unable to use Inform to test the code right now so apologies if there is an error.


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: GiannisG and 15 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