How do I make something happen upon entering a room?

???:
now the left hand status line is “You: [current hit points of player]”;
now the right hand status line is “Guard: [current hit points of guard]”.

Every turn (this is the gladiator-attack rule):
if the guard is not dead, try the guard attacking the player with a random weapon which is carried by the guard.

After going to the Guard Room:
	now the left hand status line is "You: [current hit points of player]"; 
	now the right hand status line is "Guard: [current hit points of guard]";
	continue the action.

However, you probably don’t want to go into combat mode every time the player enters this room, and you’ll need to change the status line back when combat is over.

Consider instead using a recurring scene for combat as in this example. (If the scene is recurring, make sure the begin and end conditions don’t ever happen simultaneously or Inform will flip out.)

if the guard is not dead, try the guard attacking the player with a random weapon which is carried by the guard. 
Definition: a person is living rather than dead if his current hit points are greater than 0.

I have the definition at the top of my program, and “if the guard is not dead” right under the “entering the room” text. I’m getting this message:

Problem. I am reading the sentence ‘Definition’ as a declaration of the initial state of the world, so I’m expecting that it will be definite. The only way I can construe it that way is by thinking that ‘if the guard’ and ‘try the guard attacking the player’ are two different things, but that doesn’t make sense, and the ‘if’ makes me think that perhaps you did not mean this as a definite statement after all. Although ‘if…’ is often used in rules and definitions of what to do in given circumstances, it shouldn’t be used in a direct assertion

It’s hard to debug your problem without seeing your full code. See if this helps as a starting point:

A person has a number called current hit points. The current hit points is usually 20.

Definition: a person is living rather than dead if his current hit points are greater than 0.

Safe Room is a room. Unsafe Room is north of Safe Room.

The guard is a man in Unsafe Room.

A weapon is a kind of thing.
A sword, a mace, and a petrified turnip are weapons carried by the guard.

After going to the Unsafe Room when the guard is living:
	now the left hand status line is "You: [current hit points of player]"; 
	now the right hand status line is "Guard: [current hit points of guard]";
	continue the action.
	[Remember to restore the status line when combat is over.]

Every turn when the guard is living and the guard can see the player:
	try the guard attacking the player with a random weapon which is carried by the guard.

Attacking it with is an action applying to one thing and one carried thing.
Understand "attack [someone] with [something preferably held]" as attacking it with.

[Check and carry out rules omitted for brevity.]

To attack is a verb.
Report an actor attacking someone with:
	if the actor is the player:
		say "[We] [attack] [the noun] with [the second noun]!";
	otherwise if the noun is the player:
		say "[The actor] [attack] [us] with [a second noun]!";
	otherwise:
		say "[The actor] [attack] [the noun] with [a second noun]!";