What is a good way to handle combat in a sci-fi game? I am thinking here about an RPG style game, where simulated dice are rolled and that, together with a the skill of the attackers and other considerations, determines the success of the action.

It seems to me that it is quite different to melee, because the position of the attacker and the target are much more important, i.e., how far apart and how much cover, and in IF these are generally left unsaid. The player is just in the room, and that is all you need for melee.

Are there are games already that handle this well? What are approaches that do or that might work?

Just to be clear on where I am on this, I already have a combat system for melee, and that handles dice, skill, HP and attacks. That is suitable for a fantasy, but, as you point out, irrelevant for sci-fi.

It is not just representing how far apart and cover, it is how the player influences that via an IF interface. That is what I am stuck on.

There are basically two ways to attack a character or an object at range:

Throw something at the target. In a parser game, this can be a two object command. The weapon to throw, and the target to throw it at.

THROW banana AT monkey

Fire a missile-launcher at the target. Conceptually there are three objects here: The missile-launcher, the missile (the object fired), and the target. Typically the missile will be implied if the missile-launcher only fires one kind of thing. E.g. a gun only fires bullets. Or you can have a command to put ammunition in the missile-launcher:

Took a look at Code-10 (had never even heard of Instead before, so that was fun). It is not how I would do it, but does seem to suggest a graphical representation may be the way forward. It turns it into quite a different game, however, less IF, more turn-based strategy game. Maybe that is a good thing.

One possibility is to have different positions of cover in the room, represented as enterable containers, and keep track of the degree to which each position is exposed to each other position. Then you can >MOVE BEHIND THE COUNTER, >FIRE AT TERRORIST, >SUPPRESS THE COUNTER, >THROW GRENADE AT COUNTER, and so on.