Book of books. Many - in - one.

Oh no, it’s the lunatic again!

Hiya.

I’m trying to slap something together but none of the things I’m trying works. So sadly, no code examples as everything is fail.

GOT:
the read command. Read (item) will give you the reading-property of that item. (example: ‘examine memo’ will say “it’s a memo from the boss” but ‘read memo’ will say “dear staff. please stop photocopying your butts. the glass panel on the xerox machine is starting to crack. thank you. PS: or try losing some weight, you fat f***s.”)

NEED:
One book. When read it says

When you have it, you have access to all chapters by using ‘read order of the falcon’ but when you hit inventory it should only show the one book.

ATTEMPTED:
-I tried going at it with several books and hiding them, linking them to the main book and dropping them when that’s dropped and picking them up when the book is taken, but that’s getting me nowhere. Or I’m doing it wrong. :frowning:
-I tried putting it in one book and just trying to only show the part that’s requested (with my beloved counters) but that was an unspeakable mess of a thing.

BONUS:
-when new regions are visited, chapters unlock in this book. They are not just made visible, they are unreadable before they are shown.

… yes it’s sort of a pokedex.

All assistance welcome.

First idea: make a chapter a kind of thing. Make named chapters part of your book object. The description is something like “It’s an old book. You note chapter headings [a list of chapters incorporated by old book].”

Add chapters as necessary. "Now chapter 4 is part of old book. "

Huh, I think that’s what I’d have done. :slight_smile: Have the entire book, and decide whether or not to show a certain chapter at any given time based on the player’s progress (or a variable). Possibly using understand lines (the ones that go “understand X as Y when etc etc etc”) to correctly parse references to chapters that may or may not yet exist.

I don’t code anymore, but when I did, I was messy and was happy as long as I got the results I was looking for. :wink: HanonO’s suggestion (and maybe some more will crop up) should give you a lot less headaches.

I like HanonO’s solution, although I initially thought of it as a container. Something like this might work (spoilerized for length):

A book is a kind of thing. 
A chapter is a kind of thing. A chapter has a number called ordering. Understand "chapter" as a chapter. Understand the ordering property as referring to a chapter.

To decide whether we're reading ahead:
	if the noun is not a chapter, decide no;
	if the ordering of the noun is 1, no;
	if the noun is handled, no;
	repeat with passage running through handled chapters part of the holder of the noun:
		if the ordering of the passage is greater than the ordering of the noun, decide no;
	decide yes.

Before examining a chapter while we're reading ahead, say "You decide to skip ahead a bit."
Check examining a chapter (called passage): now the passage is handled.

The Secret of Monkey Island is a book. The description is "A hefty tome, bound in black leather and adorned with bas-relief pictures of pygmies, monkey heads, and cutlass-wielding pirates. Its table of contents holds [number of chapters part of the Secret of Monkey Island in words] chapter[s]: [list of chapters part of the Secret of Monkey Island]." It is proper-named. Before printing the name of The Secret of Monkey Island: say "The ".


Table of Guybrush's Adventures
chapter	description
The Three Trials	"The adventure begins when a someone by the name of Guybrush Threepwood appears on Melee Island, wanting to be a pirate. In order to do so, he must seek out the three pirate leaders, who order him to do three challenging tasks to prove himself worthy. Along the way he meets enemies and friends, including the lovely governor Elaine Marley."
The Journey	"Guybrush's initation of becoming a pirate has taken a setback when the beautiful govenor has been kidnapped by the ghostly pirate LeChuck. In order to save the Govenor, he has bought a ship and employed three crew members."
Under Monkey Island	"In this chapter Guybrush explores the Monkey Island, meeting a hermit and a tribe of cannibals. He gains entry to Hell and gets to board LeChuck's ship, but the ship leaves for Melee Island before Guybrush has the time to finish LeChuck off." 
Guybrush Kicks Butt	"This is the final episode of the game, set on the Melee Island again. LeChuck is about to marry Elaine — against her will — and Guybrush rushes in just in time to stop the ceremony. LeChuck is not happy and he starts beating Guybrush around, but with a certain liquid Guybrush finally prevails and gets Elaine."

Some chapters are defined by the Table of Guybrush's Adventures. 

The printed name of The Three Trials is "The Three Trials".
The printed name of The Journey is "The Journey".


When play begins: 
	repeat with N running from 1 to the number of rows in the Table of Guybrush's Adventures:
		choose row N in the Table of Guybrush's Adventures;
		now the ordering of the chapter entry is N;
		now the chapter entry is part of The Secret of Monkey Island.

Instead of taking a chapter part of a book (called novel), say "You can't just tear pages out of [the novel] at random!"

The Library is a room. The oaken bookshelf is a scenery supporter. The bookshelf is in the Library. The Secret of Monkey Island is on the bookshelf.

I feel silly, yet pleased. HanonO’s solution of using incorporation is the better technique, I think, so I ended up using that.

[rant]

[/rant]

I did that, but … how do i limit the chapters until X has been Y’d? i really tried doing this myself but i think i’m missing something because I don’t understand what that reading ahead thing does and … o.o i’m just so confused.

with the code, there is a book. but it has no reading material so READ doesn’t work, that’s probably on me…

but I can’t alter the code in such a way that read becomes available.
and i can’t limit the chapter things… but i can examine chapters, sort of, it doesn’t error there.

and well, examine should do other things. like reveal that on the back of the thing in big comforting letters it says “panic a lot and throw feces at passers-by.” (okay that’s a bit of a joke but still read and examine should be separate)

EDIT:
here’s my Reading code, maybe that helps!

[spoiler][code]A thing has some text called the reading-material. The reading-material of a thing is usually “”.

Understand the command “read” as something new.
Reading is an action applying to one thing and requiring light. Understand “read [something]” as reading.

Check reading:
if the reading-material of the noun is “”:
say "Nothing is printed on [the noun].” instead.

Instead of reading someone, say “That’s a ridiculous idea!” instead.

Carry out reading:
say “[reading-material of the noun].”
[/code][/spoiler]

Read is a synonym for examine out of the box. Create chapter objects with no location so they are out of play. When the player gets a chapter, add it to the book with “now chapter 1 is part of…” If you leave the read verb alone, the player should be able to examine or read the book, which hopefully has the description that lists chapters that are part of the book which can be read or examined further.

I’d recommend starting the book with a chapter in it to train the player to do this and so your list won’t be empty.

Also the code to receive a chapter should probably check itself “if chapter 2 is not part of old book: now chapter 2 is part of old book; say “hey, wasn’t there something relevant to this in the old book?””

If you want to specifically separate “read” you need to disconnect it from examine (as you’ve done I now see) and then have a “readable” adjective for printed material and “a readable thing has a text called readtext.” And then have your read verb check for a readtext and then display it.

I’d go with let read and examine be the same thing, but if you want this and still have trouble I’ll write the code out when I get home and have access to inform.

The way he’s written it is fine, actually. You don’t need a separate readable adjective. The test “if the reading-material of the noun is “”:…” serves that function.

But “examine falcon chapter” should still show the text of the chapter. A lot of players will use “examine” exclusively and never try “read”.

(It’s reasonable for “read sword” to return “Nothing is printed on the sword.”)

actually i want Examine Chapter to give the sypnosis and Read Chapter to give the whole chapter.

And that’s where my struggle is. :frowning:

that and the not showing it until it’s needed and not before.

I understand the idea of splitting "read and “examine”, but in essence you’re going to at some point have someone who will forget to both “read” and “examine” some or the other thing at some point and get stuck because they missed something important. Instead, I suggest training the player to examine things multiple times with varying texts. It gives the effect I think you want of a cursory read and a deeper read of in-game text without the chance the jaded player who just plows through only using X THING repeatedly and thoroughly (raises hand) won’t miss stuff.

[rant=rant-tagged for tidiness][code]“Chapter and Book”

A chapter is a kind of thing. The description of a chapter is usually “[one of]This one seems to go on at length about pretty much nothing.[or]You read through the entire chapter. Yep. No relevant information, but lots of lofty metaphors and big words.[stopping]”

Understand “chapter/chapters/section/sections” and “chapter/section about/on/regarding” as a chapter.

Understand “read about [something]” and “read chapter/section about/regarding/on [something]” and “skim [something]” and “peruse [something]” and “leaf through [something]” as examining.

Cave Entrance is a room. “The cave ceiling disappears into darkness above, and a spiral pathway seems to circle downward.”

An old book is in Cave Entrance. “[one of]Lying here in a significant position, and lit mysteriously by a dusty golden shaft of light from above, is an old book.[or]The old book seems to glimmer in the golden cave light, as if wanting you to notice it.[or]You turn around and startle a bit–the book seems to have changed location to nearer where you are standing. It’s a bit disquieting–almost as if [italic type]the book wants to go with you[roman type].[stopping]”. The description is “[one of]The leathery old tome seems thinner than its spine would suggest, almost as if whole sections of it have been torn out and are missing.[or]You flip through the pages of the book. It seems to contain chapters regarding [a list of chapters incorporated by old book].[stopping]”

Instead of opening old book, try examining old book.

Understand “leathery/tome/spine” as old book.

Chap1 is a chapter incorporated by old book. The printed name is “An Introduction”. The description is “[one of]You skim the introductory chapter of the book. It seems handwritten in spidery blue ink by someone named ‘Jurgen’.[or][italic type]I happened across an old book in a prominent place in the cave. My name is Jurgen, and this is the record of my adventures in the Catacombs of the Magical Flugelhorn.[roman type][stopping]”

Understand “introduction/introductory” as chap1.

Some Love Poems is a chapter incorporated by old book. The description is “[one of]These are some pretty awfully written love poems, you’d guess by a person named Jurgen.[or][italic type]Roses are Red[line break]Violets are Blue[line break]This catacomb is damp and dark[line break]But soon you’ll love it too.[roman type][paragraph break]Ugh.[or][first time]Okay, just one more, you decide:[paragraph break][only][italic type]There once was a man from Levine[line break]Who somehow packed far too many syllables into every verse line[line break]The rhyme scheme got off[line break]When he wrote about sheep.[line break]So instead he decided to try getting some sleep.[roman type][first time][paragraph break]You decide Jurgen isn’t a very good poet at all.[only][stopping]”

Understand “poem” as some love poems.

Chap2 is a chapter. The printed name is “a lengthy research of blind albino cave squirrels”. The description is “[one of]On a summary examination, this would seem to be a lengthy chapter regarding the habits of blind albino cave squirrels.[or]You settle down to read the chapter. [italic type]The Blind Albino Cave Squirrel is indigenous to caves, as they seem to be blind and not equipped with any sort of visionary apparatus. They also tend to range from a light gray to a pale white, depending on the depth one encounters them at beneath the surface of the earth’s crust. Be very cautious when around! Any foodstuffs containing acorns, nuts, legumes, or nut products are swiftly sought out by their keen olfactory senses, and more than one of my party has succumbed to the white slashing fury of their sightless nyctian attacks after (once again) not heeding my judicious warnings and thinking the rules don’t apply to them and ‘Oh, that Jurgen with his unecessary warnings! Surely one packet of peanuts in my pack won’t do any harm at all!’[roman type][stopping]”

Understand “lengthy/research/habit/habits/blind/albino/squirrels/squirrel” and “cave squirrels/squirrel” as chap2.

[I split this here because I only want it to match “cave squirrels” typed together and NOT just the word “cave” since there might be a different chapter just about the cave and I don’t want “read about cave” to disambiguate “do you want to read about the cave or cave squirrels?” and fail miserably.]

Deep Catacomb is down from Cave Entrance. “The cave deepens here, and you can hear the scritterings of [if we have examined chap2]what you imagine from your extensive research are blind albino cave squirrels[otherwise]some type of creatures[end if] in the distant shadows[if old book is not enclosed by the player].[paragraph break]You have this weird feeling like you have missed something important. Perhaps you should go back up and figure out what that is[end if].”

Carry out going down from Cave entrance:
if the player encloses old book:
if chap2 is not part of old book:
now chap2 is part of old book;
say “You hear a papery fluttering sound, and the old book’s leathery covers creak as if they are a little heavier somehow.”

Test me with “x book/d/u/read book/peruse chapter/introduction/read introduction/x poem/read poem/read another poem/d/u/take book/i/d/u/x book/read about squirrels/peruse lengthy research/d”

[/code][/rant]

I was playing around and skipped several steps. I should probably have made things a bit more obvious instead of being clever (“clever” in programming is not a compliment, after all).

Traditionally, as others have mentioned after your posts, Inform uses “examine” as a synonym for “read”. I’m fine with that. In my experience, dividing the two usually only creates frustration:

I may be alone on that score, but this just screams makework to me, and makes the parser seem like a resentful manservant purposefully trying to obstruct your progress.

Anyway. Because Inform conflates “examine” and “read”, and because “handled” is a boolean property of every thing, I used “handled” to determine whether we’ve read a chapter or not. The whole “reading ahead” thing was just playing around with the idea of reading chapters out of order: the way I set up the chapters, I create them via a table, and the row number of the table becomes the chapter ordering. The reading-ahead routine checks if there’s an un-handled chapter that goes immediately before the one you’re trying to read. If the chapter immediately before is un-handled (hence unread), it tells you you’re skipping ahead. Essentially a bit of fun, but the technique could probably be used to add flavor.

my books aren’t openable… just want to show off differences when using read and examine.
it has it’s purpose but i wanna keep secrets for the full game ^^

[rant]

[/rant]

sooooooooooooooooooo freaking helpful O.O thanks thanks thanks thanks thanks