intfiction.org

The Interactive Fiction Community Forum
It is currently Fri Nov 16, 2018 4:15 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 13 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Wed Oct 17, 2018 2:39 am 
Offline

Joined: Fri Feb 05, 2016 7:20 am
Posts: 28
advilexstrength wrote:
howtophil wrote:
You might want to check this post: viewtopic.php?f=7&t=26698&p=144801#p144801

it doesnt seem to work on playfic as i get the colon indentation error which i have no idea about.

As a side note, there are a great many things that doesn't work on Playfic because it's running version 6G60 which is from 2010. There have been some major changes in how I7 works since then, so you're better off downloading it for yourself.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Oct 17, 2018 4:03 pm 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 298
Location: Michigan
FictitiousFrode wrote:
advilexstrength wrote:
howtophil wrote:
You might want to check this post: viewtopic.php?f=7&t=26698&p=144801#p144801

it doesnt seem to work on playfic as i get the colon indentation error which i have no idea about.

As a side note, there are a great many things that doesn't work on Playfic because it's running version 6G60 which is from 2010. There have been some major changes in how I7 works since then, so you're better off downloading it for yourself.


This is very good advice and I second it.

_________________
~~~
My ebooks on Amazon
My ebooks on Smashwords


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Oct 20, 2018 3:01 pm 
Offline

Joined: Sun Feb 17, 2008 3:51 pm
Posts: 300
Hey Advil,

Sorry to leave ya hangin' there, buddy. I got side-tracked as usual. FYI - Writing with Inform is the name of the documentation that comes with the program itself. Just hit the "Documentation" tab and there's a numerical index to the examples. I didn't supply a link on purpose because the tabs tend to get screwed up. When using the examples in the built-in docs, just click on the icon next to the name of the example and the whole thing gets copied over to your source code. (Open up a separate empty project, erasing the name and everything first.)

I looked at "Safety" again and realized that it might not be as helpful as I thought, so I cooked up an example that might be more useful for your particular needs. I kind of forgot that doors and parts of doors can get a little tricky. Anyway, try it out. The code is behind the spoiler tag so it wouldn't take up so much space. It's pretty liberally commented so you shouldn't have any trouble figuring it out, but if you have any questions, don't hesitate to ask.
Spoiler: show
Code:
"Lab" by Michael Tarbert

[create a new action and some ways to understand it:]

Typing it into is an action applying to one number and one thing.
Understand "type [number] in/on/into [something]" or "enter [number] in/on/into [something]" as typing it into.

[catch when readers try typing gibberish:]

Understand "type [text] in/on/into [something]" or "type [text]" as a mistake ("You can only type numbers on something in this game.").
Understand "enter [text] in/on/into [something]" or "enter [text]" as a mistake ("You can only enter numbers on something in this game.").

[we add this next to avoid weird guesses from Inform when the player tries "type [a number]" without specifying what to type it into. Comment out this code and see what happens when you try "type 5" while holding the key:]

Does the player mean typing a number into the lab door: it is very likely.

[create the action's behavior using the standard check/carry out/report rules. Notice we name them all -- that helps later with debugging and is considered a best practice for actual works of IF (not neccessary for short code examples, but something to get used to doing IMO):]

Check typing it into (this is the convert typing into the number pad to typing into the lab door rule):
   if the second noun is the number pad:
      now the second noun is the lab door.
   
Check typing it into (this is the can only type into the lab door rule):
   if the second noun is not the the lab door:
      say "[The second noun] does not have a number pad." instead.

Check typing it into (this is the using wrong combination rule):
   if the number understood is not 2018:
      say "The number pad readout turns red and reads, 'ACCESS DENIED'." instead.
      
[we only get here if all the checks have passed:]

Carry out typing it into (this is the standard correct combination rule):
   if the second noun is locked:
      now the second noun is unlocked;
   otherwise:
      now the second noun is locked.

[any successfully caried out actions should generally be printed out in the "report" phase. Again, this is not a requirement, but a good practice:]   
   
Report typing it into (this is the standard report locking or unlocking lab door rule):
   if the second noun is unlocked:
      say "The number pad readout turns green and reads, 'ACCESS GRANTED: UNLOCKING'.";
   otherwise:
      say "The number pad readout turns red and reads, 'ACCESS GRANTED: LOCKING'.".


[we create a room and connect a special door called "the lab door" in it. We bracket the name in the room description so Inform knows it's already been mentioned in the description and won't mention it again in the "You can see... here" part. Also, don't name the door and the room it connects to with names that could confuse Inform (like "lab door" and "lab").]

Hallway is a room. "There's [the lab door] to the north."
North of the hallway is a door called the lab door.
The Laboratory is a room. "It's just your standard laboratory." North of the lab door is the Laboratory.

The description of the lab door is "There's a number pad on it.". The lab door is closed and locked.
The number pad is a thing. It is part of the lab door.
The golden key is carried by the player. The description is "The key isn't special -- it's just a thing that happens to have 'key' in the name.".

[to cover our bases:]
 
Understand "unlock [something]" as unlocking it with.
Understand "lock [something]" as locking it with.
Rule for supplying a missing second noun while unlocking the lab door with or locking the lab door with: say "There's no keyhole -- just a number pad." instead.

Instead of unlocking or locking the lab door with: say "There's no keyhole -- just a number pad!".

[and just to be cool:]

Understand "unlock [something] with [a number]" as typing it into (with nouns reversed).
Understand "lock [something] with [a number]" as typing it into (with nouns reversed).

Test me with "n / open door / i / unlock door / unlock door with key / x key / drop it/ x door / enter code / type xyz / enter 5 / type 5 into pad / enter 2018 into door / open it / n / lock door / close it / lock it with 2018 / s / unlock lab with 2018 / s".

That's it. Make sure to select everything in the code box to copy and paste into a fresh project to test it. Hope it helps a little and sorry for the delay. :)

_________________
Skinny Mike


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 20 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