A few hopefully easy questions

How strange…only a week in, and I’m dreaming about coding. That hasn’t happened since I learned BASIC back when I was eleven! (And that was a loooong time ago…)

Thanks very much for suffering further questions. I’d imagine that these things are rudimentary, but I simply can’t find relevant bits in the manual (or online), search as I might. I’m probably just not taking the right approaches, meaning that I’m looking at the wrong tutelage for each idea.

Most simply (I think): How does one turn off the scoring? My first game doesn’t involve a score, and while I can probably experiment with interrupting the verb “score” with a message, that doesn’t solve the problems of the banner and the quit/win-game “You have scored…” bit.

Another basic thing that I just can’t glean: Is there a way to “pry” (such as with a unicorn’s horn – but it could be a crowbar or any such thing, of course)? My player must pry the eye out of a dragon, as it’s a light source.

I’ve obviously drawn a map prior to beginning to type in my object descriptions, and one of the rooms involves an obstructed direction – not a door, but merely the usual ability to leave the room. The player can still go back out the way he’s come in, of course. A group of angry bugs is blocking further progress to the south. Elsewhere in the game, the player has found a used soda can. If he drops this can in the bugs’ location, they swarm over to it and get stuck to its sticky-sweet sides, allowing progress to the south. (Yes, I’m deliberately keeping the puzzles simplex for now!)

I cannot, for the life of me, figure out how to block a particular direction with a (non-takeable) object that moves once of its own accord. Would I just check the current location in the can’s “after drop” section, or am I way off? I would need to change its description to include the bugs stuck to it, once it’s been dropped there – and change it to “non-takeable” as well.

The bugs don’t need to be addressed on a per-bug basis, or treated as an animated character, so my guess – but it’s only a guess – is that this one object, the “group of bugs,” can serve as one thing unless the player tries to count them, in which case I’ll insert a special message such as “They’re too numerous to count.” Am I on the right path?

Finally (sorry again about all the queries…once I get these things, doors in my head will open, spiderweb-like, to many other things), the game is won when the player places five objects – a plate, a glass, a spoon, a knife and a fork – on the table in a particular room, and then drops a token into a slot that’s in the same room. How would you approach this? Should I put this table-check in the room’s code, or the table (scenery) code instead? And how, for the love of Lebling, does one create a static/scenery “slot” that accepts just one object, and then spits it back onto the floor if the right conditions aren’t met on another piece of scenery in the same room? Would these things be in the token code, or the slot code, or neither?

Thank you very, very much for considering these questions. I know it takes time to explain such things to a novice, and I truly appreciate the help. It would be endlessly valuable to me.

Well, this part I can answer - it’s been a long time since I’ve last tried to do anything with Inform 6. Something akin to the following should at least help you along:

[code]object -> soda_can “soda can”
name ‘soda’ ‘can’,
description [;
print “Your basic soda can”;
if (self.bugged)
print “. There’s bugs stuck all over it”;
before [;
if (self.bugged)
“Yuck! With all those bugs stuck to it?”;
after [;
if (self.location == room_with_bugs) {
self.bugged = true;
“The bugs swarm from around the southern exit to the soda can, where they seem to get stuck.”;

object room_with_bugs
description “…”,
n_to room_without_bugs,
s_to [;
if (soda_can.bugged)
return room_past_bugs;
“All those swarming bugs hinder your way past them to the south.”;
has light;[/code]

And yes, you only need one object for the bugs. :slight_smile:

Wow; that helps immensely. I really appreciate that, Rioshin. Thanks. :slight_smile:

! Put this before including Parser
Replace ScoreSub;
Replace FullScoreSub;
Replace DrawStatusLine;

! Put this after including Parser (but before VerbLib)
Object LibraryMessages
with before [;
	Score: print "Congratulations"; rtrue; ! I think you need some text here like 'congratulations' because otherwise you get a spurious full stop.

! And then somewhere near the end of your code:
[ DrawStatusLine width posa posb;
	@split_window 1; @set_window 1; @set_cursor 1 1; style reverse; 
	width = 0->33; posa = width-26; posb = width-13; 
	spaces (width);
	@set_cursor 1 2; PrintShortName(location); 
	if (width > 76) { 
		@set_cursor 1 posb; print "Moves: ", sline2; 
	if (width > 63 && width <= 76) { 
		@set_cursor 1 posb; print sline1, "/", sline2; 
	@set_cursor 1 1; style roman; @set_window 0; 

[ ScoreSub;
	"This game doesn't use a scoring system.";

[ FullScoreSub;

You need to make a new verb. It seems chapter 30 of the DM4 covers this. However, ‘pry’ is a verb included in the library as a synonym for unlock. So I imagine you’d need to do something like this:

Object eye_of_dragon "eye" dragon
with ...
	before [;
			move self to player;
			"You grab the eye in your hands, pull fiercely, and after a minute of back-breaking force, finally manage to extricate the faintly glowing eye from its former draconian position."; ! Or something.

! After including Grammar:
	"That sounds like a mad idea.";

Extend 'pry' first
* noun 'out' 'of'/'from' noun -> Pry
* noun 'out' noun -> Pry
* noun 'from' noun -> Pry;

“A token. A slot. But how to put it all together without my insert-token-into-slot spell?” (Zork Grand Inquisitor)

There are probably loads of ways of approaching this. I personally might go for something like this:

[ CheckForWin;
	if (plate in table && glass in table && spoon in table && knife in table && fork in table && token in slot) {
		print "You've done it! Now we just need the butler to show up!^";
		deadflag = 2; ! This means trigger the winning ending.

Object table "table" winroom
with after [;
			if (CheckForWin()) rtrue;

Object slot "slot" winroom
with after [;
			if (CheckForWin()) rtrue;
			move noun to location;
			print_ret (The) noun, " is ejected from the slot and flies onto the floor.";

Receive is a so-called ‘fake action’ because it is automatically generated whenever there is an Insert action. You could equally put Insert actions on the cutlery and the token. If you had wanted the player to be able to put all the cutlery in a bag, say, and then put the bag on the table, then this code wouldn’t trigger a win: you’d need the IndirectlyContains(container,contained) routine, which checks to see if an object is somewhere in the ‘family tree’ of another object.

Edit: Oh, and if you’re wondering how I knew that ‘pry’ was a pre-defined verb, then you may find this page helpful: it’s the Inform library’s source code - specifically, all its world model verb definitions.

A thousand thanks for this indispensable assistance. And thanks also for the link to the source code! That’ll come in extremely handy, for obvious reasons. Very much obliged. (Should I have just inspected the .h files I’ve actually been using? I’m almost afraid to “touch” them, if you see what I mean.)

I think you can remove score completely by “Constant NO_SCORE;”

As for Kivie’s kitchen code example:

  • As the code is, the token will be ejected unless it is the last object put in. As a result, there’s no point in checking for a win on the table’s insert action.
  • Alternately, you could have slot:Insert refuse anything but the token as too big, block any LetGo actions.

If there more multiple ways that the player could finish off the victory, you should probably put the code that checks for a win in the player’s each_turn routine instead of checking each final action.

Thanks for the addendum. :slight_smile:
I’m really grateful for the help. I’m having a ball writing this first proper IF story.