Another decide phrase

Once again trying to find the phrasing that Inform is looking for. These just kill me.

[code]An object has a number called the danger. The danger of an object is usually 0.

To decide which object is the preferred weapon:
decide on the object with the highest danger enclosed by the player.[/code]

A weapon is a kind of thing.
A weapon has a number called the danger rating. The danger rating of a weapon is usually 0.
Definition: a weapon is dangerous if its danger rating is more than 2.

To decide which weapon is the preferred weapon:
    decide on the most dangerous weapon enclosed by the player.

Is the problem here that you can refer to specific kinds by user-defined properties, but you can’t refer to objects as a whole that way? Are there other things you can do with kinds but not with objects? Where is this in the documentation?

I think the problem is that in order to use a superlative you have to define the comparative adjective. So Inform won’t define “highest danger” automatically, but if you define “dangerous” in a way that puts it on a scale then Inform will automatically understand the superlative of “dangerous.”

This is explained in sections 6.6-6.8 of the documentation–“Whereabouts on a scale?”, “Comparatives,” and “Superlatives.” At least in 6G60/6L02 and I think also in 6L38, the syntax is a little different from Draconis’s example, though:

[code]A weapon is a kind of thing.
A weapon has a number called the danger rating. The danger rating of a weapon is usually 0.
Definition: a weapon is dangerous if its danger rating is 2 or more.

To decide which weapon is the preferred weapon:
decide on the dangerousest weapon enclosed by the player.[/code]

The exact threshold for “dangerous” doesn’t matter unless you want to use the adjective “dangerous” by itself; the thing is that once you define “dangerous” with “or more” it knows that higher danger rating = more dangerous, and that lets you use the comparative and superlative. Unfortunately as per section 6.8 it just puts “-er” and “-est” on the end so we wind up with “dangerousest” rather than “most dangerous.” I have a uservoice suggestion to change this! In the meantime, if this is aesthetically displeasing I’d change “dangerous” to “deadly” (Inform will generate “deadliest” properly).

[rant=Some off-topic stuff about “most dangerous”]The error message when I tried “most dangerous” instead of “dangerousest” surprised me:

That suggests that “most dangerous” might be understood–but how?

…OK, on further check I think this is referring to the (obscure, to me) use of “most” to mean “at least 80 percent of” as in section 6.15 of Writing with Inform. My guess is Inform is trying to interpret “most dangerous weapon” as “most of the dangerous weapons” and becoming unhappy.[/rant]

Anyway, the upshot is that if you want to check a comparative/superlative for a number property you have to define a scalar adjective for that number property and then Inform will generate the comparative and superlative for you.

Good to know. Incidentally, you could define a less awkward superlative by saying “Definition: The most dangerous weapon is the dangerousest weapon”, couldn’t you?

Not like that. Definitions are always of the form “An X is A if…” (rather than “The X is…”).

You could write a phrase “To decide which weapon is the most dangerous weapon: …” (This is the same syntax as “preferred weapon”, just with different words."