Clothes make the man : counters and dresscode (and scoring)

Hi ladies, gentlemen, and androgynous lizard people from dimension Vzzzbx.

I like putting bonus stuff in things.

My ‘The Benevolent Bystander’ mod for skyrim is basically just me adding easter eggs to the game.

Now what I’m trying (and failing) to do are three things:

1 - certain parts of an outfit can only be found by a certain hidden tool already working in game.
When wearing one article of those special clothes, specialcounter should go up by one.

When you examine yourself, one of three things should happen
you’re not wearing any of the special clothes: regular description
you’re wearing some of the special clothes but not all of them: regular description plus text indicating you’re wearing some weird stuff
you’re wearing all the special clothes: regular description plus alternate text indicating you’re wearing all the weird stuff

So far, I haven’t even been able to get any sort of counter working.
Turns out

[if specialcounter is larger than 0][line break][line break]You're wearing something weird, though. [otherwise][end if]

can’t help me.

2 - I want a bouncer to work that will stop the player from entering unless he’s wearing a badge.
2.5 - also, the bouncer should kill the player if he leaves while no longer wearing the badge.


…what? Corporate espionage is srs bsns.

3 - when you collect special things I’ve hidden, like a random potato that’s particularly nasty, score should go up.
Again, as I’ve pointed out, I haven’t even been able to get any sort of counter working. :frowning:

EDIT: i got scoring working sort of but i’m still open for pointers and advice.
Also, is there a way to change the scoring sentence to something custom? (found it!)
Also, is there a way to have scoring without it telling you when you gain a point?

When the game ends, the amount of score should indicate how well you’ve been gathering crazy stuff in a text that has various versions.

Bonus points if it has room for a special mention of the specialcounter stuff.

Help me and you will receive your fake internet reward:

Regarding the badge: check my suggested code in this thread
https://intfiction.org/t/inform-the-reliques-of-tolti-aph/67/1

You’d want to go for code like

Check going south from Guard Room: If the player does not wear sparkly badge: End the story saying "Why didn't you wear the badge? You are dead!"

Regarding the pieces of an outfit.

[code]allgreenarmor is a number that varies.

Carry out putting on green helmet:
Increase allgreenarmor by one.

Carry out taking off green helmet:
Decrease allgreenarmor by one.

The description of the player is “[if allgreenarmor is 0]You are dragon food[else if allgreenarmor is 1]You are slightly protected from the dragon[else if allgreenarmor is greater than 1]You are fully clothed in green armor[end if].”[/code]

You don’t need to make a numeric variable for the second one, you can just refer to “the number of green pieces of armor worn by the player” (along with a “Definition: a piece of armor is green if it is the green helmet or it is the green breastplate”).

But they both work. Its like when Zarf is all DONT EVAR USE PRIVATELY-NAMED… One thing about Inform is its flexible enough to allow multiple solutions. There’s always a better one. I always have people holler at me WHY ARENT YOU USING INDEXED TEXT or WHY ARENT YOU PUTTING THIS IN A TABLE? Because sometimes it makes more sense to me.

True. My preference is to make my code as elegant and natural-English-like as possible, so “the number of green pieces of armor” feels better than “allgreenarmor”. But you’ll get the same basic effect either way.

I think, even if you’re using allgreenarmor as a numeric variable (or “green armor count”) or something, it’s probably better to wrap it in a “To decide” phrase rather than manually changing it whenever the player takes off or puts on a piece of green armor. Something like this:

To decide what number is allgreenarmor: decide on the number of pieces of green armor worn by the player.

This would prevent you from hitting any bugs if there was some possibility that a piece of green armor could disappear without the player explicitly taking it off, or if something in the way the action was processed didn’t reach that particular carry out rule, or something like this.

Sorry if this is hollery! But I have hit bugs before when I was basically keeping track of things in two different ways and they got out of sync, so I like to avoid that if possible (I don’t always find it possible). This is even a principle of programming, I guess.

Everyone has a personal-style sense of how to name variables and so on.

I recommend against privately-named because, for most people, it’s wasted effort. You’re thinking about a detail that does not make your game better or even noticeably different. (Getting the right synonyms on an object does matter, but as I said in that thread, privately-named is a distraction from that unless you paint yourself into an internal-name corner.)

Maintaining a counter works, but it has a potential bug that “the number of green whatevers” avoids. If the counter winds up wrong – because the green bandana caught fire or was stolen by a pickpocket or whatever – you have a hard-to-diagnose bug. (Player types “X ME”, gets wrong result, now you have to figure out what went wrong in a previous action.)

I am a big fan of code patterns that rule out potential bugs. This is a personal-style issue but it’s worth pointing out.

EDIT-ADD: matt w was posting at the same time as me, obviously. :slight_smile:

Definitely. I guess that encompasses the complaint that codery people have that inform 7 is “inexact”. In my case I would need to make sure the game had no way to make armor disappear off a person.

One (fairly simple) way to code the first part of the badge problem is:

Instead of going south from the checkpoint when the ident badge is not worn, say "'Where's your ID? You can't go in there without an ID.' You're not about to challenge the heavily armed security guard."

This can be adapted to handle the .5 of the problem as well :slight_smile: Attaching the conditional onto the end of the rule means you don’t have to worry about coding the alternative, as the default rules aren’t being blocked in that case.