2013-10-09 127 views
0

我有這段代碼和評論行打破它。這裏有什麼做錯了?我知道我可以說鋼筆可以是紅色,綠色或藍色;但我想使用值顏色或類似的東西與其他對象共享屬性。它爲什麼不讓我改變對象屬性的值?

NicePlace is a room. "Its a pretty nice place." 

A color is a kind of value. 
The colors are red, green, blue. 

A pen is a kind of thing. 
A pen has a color called pencolor. 

A coolpen is a pen. 
The pencolor of coolpen is red. 
[Now the pencolor of coolpen is blue.] 

There is a coolpen in NicePlace. 

回答

2

像「now ...」這樣的短語必須放在規則中,否則Inform不知道何時運行它們。所以試試這個:

When play begins: 
    Now the pencolor of coolpen is blue. 
+0

這很有效,謝謝! –

+0

原來有更多的規則語法讓IF7變得更容易。感謝提及規則。 –

+0

我認爲這一直都是如此。有定義世界的聲明,控制什麼時候發生的規則,以及改變世界和說東西的短語。如果您習慣了其他您可能感興趣的語言[Inform 7程序員手冊](http://www.cs.tufts.edu/comp/50GD/assignments/Inform_7_for_Programmers.pdf)。 – curiousdannii

相關問題