0

我试图用“陌生人”代替[名词]。在这段代码中:

列出不起眼的项目的规则:什么都不做。

A staircase is a kind of door. A staircase is usually open.
A staircase is seldom openable. The ladder is a staircase. 
The ladder is above the Entry and below the Reception. 
The description of Entry is "You see ladder forward.".
A stranger man is man in the Reception. 
The description of Reception is "You see [the noun] at the reception. On the left side is corridor.".

在描述位置时,我看到的是“向上”而不是“陌生人”。但是在攻击和之后remove the noun from play;,我看到“什么都没有” - 好吧。

Entry
You see ladder forward.

>up

Reception
You see the up at the reception. On the left side is corridor.

>attack man
You attack the stranger man, causing 5 points of damage!

The stranger man attacks you, causing 7 points of damage!

>attack man
You attack the stranger man, causing 8 points of damage!

The stranger man attacks you, causing 7 points of damage!

>attack man
You attack the stranger man, causing 6 points of damage!

The stranger man attacks you, causing 2 points of damage!

>attack man
You attack the stranger man, causing 4 points of damage!

The stranger man attacks you, causing 8 points of damage!

>attack man
You attack the stranger man, causing 10 points of damage!

The stranger man die, you win!

>attack man
You can't see any such thing.

>look
Reception
You see nothing at the reception. On the left side is corridor.

为什么会这样?

4

1 回答 1

2

“名词”是一个全局变量,指的是前一个动作的主要对象是什么,在这种情况下是“向上”的方向。当您第二次查看时,它会尝试访问前一个对象,但由于解析器失败,结果是空对象,“无”。

我不太确定你想做什么,但试图提及一个不会总是出现在房间描述中的人几乎肯定是错误的方法。如果您要做的是在退出之前列出该人,那么 Emily Short 扩展的房间描述控制可能会有所帮助。

于 2017-02-26T13:10:09.153 回答