2017-02-25 59 views
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. 

爲什麼會發生這種情況?

回答

1

「名詞」是一個全局變量,指的是前一個動作的主要目標是什麼,在這種情況下是「向上」的方向。當你第二次看時,它會嘗試訪問前一個對象,但由於解析器失敗,結果是空對象,即「無」。

我不太確定你想做什麼,但試圖提及一個不會總是在房間描述中那樣的人,那幾乎肯定是錯誤的方法。如果您要做的是在退出前列出該男士,那麼艾米莉短褲的房間描述控制功能可能會有所幫助。

+0

但是,如何創建可從遊戲中刪除的角色的通用引用? – user3091874

+0

@ user3091874我不確定你的意思。 – curiousdannii

+0

我需要從遊戲中刪除角色,以及他在房間描述中提到的所有角色。 – user3091874