Inform7 规则中的同义词不会改变?
Synonyms in rules in Inform7 will not change?
为了使包含特殊门的当前 Inform7 项目中的代码更具可读性,我决定创建各种门和作为门的一部分的东西,以回溯打开和关闭哪些门。
背景:一扇门只有在之前被一种叫做 Mobitab 的东西操纵然后被 Securitypass 解锁的情况下才能打开。所以我创建了一种叫做 DoorpanelSM 的东西,其中有一个 属性 被操纵(通常为 0)和一个 属性 被激活(通常为 0)。我的门操作和解锁代码如下所示:
注意:问题已进一步缩小。编辑一直到底部!
TürpanelSM is a kind of a thing. Sicherheitsausweis can be used with TürpanelSM. TürpanelSM has a number called activated. Activated of TürpanelSM is usually 0. TürpanelSM has a number called manipulated. Manipulated of TürpanelSM is usually 0.
Unlocking a TürpanelSM with Sicherheitsausweis is an action applying to two things.
Understand "use [Sicherheitsausweis] with [a TürpanelSM]" as unlocking a TürpanelSM with Sicherheitsausweis.
Manipulating a TürpanelSM with Mobitab is an action applying to two things.
Understand "manipulate [a TürpanelSM]" as manipulating a TürpanelSM with Mobitab.
Understand "use [Mobitab] with [a TürpanelSM]" as manipulating a TürpanelSM with Mobitab.
Instead of unlocking a TürpanelSM with Sicherheitsausweis:
if TürpanelSM (called currentPanel) is part of a door and manipulated of the currentPanel is 0:
say "Securitypass not accepted. You could try to manipulate the panel...";
otherwise if TürpanelSM (called currentPanel) is a part of a door (called the parent) and activated of the currentPanel is 0:
now the parent is unlocked;
now the parent is open;
now activated of the currentPanel is 1;
otherwise if TürpanelSM (called currentPanel) is a part of a door (called the parent) and activated of the currentPanel is 1:
now the parent is closed;
now the parent is locked;
now activated of the currentPanel is 0;
otherwise if TürpanelSM (called currentPanel) is a part of a door:
Instead of manipulating a TürpanelSM with Mobitab:
if TürpanelSM (called currentPanel) is a part of a door and manipulated of the currentPanel is 0:
now manipulated of the currentPanel is 1;
say "Panel got manipulated";
otherwise if TürpanelSM (called currentPanel) is a part of a door and manipulated of the currentPanel is 1:
say "Panel was manipulated already.";
只有一扇门才有效。但是,如果我使用两扇或多扇门,则定义的门板属性似乎是全局的。我确定 now activated of the currentPanel is 0;
不会更改 currentPanel 的 属性,而是声明一个全局变量,该变量在以下每个条件下都需要。我完全找不到正确设置和获取我要求的面板值的方法。
显示问题的小测试程序(包括以上内容):
"TestsForSO" by geisterfurz007
Locker is a container.
Mobitab is in Locker.
Securitypass is in Locker.
Locker is in Hangar.
DoorpanelSM is a kind of a thing. Securitypass can be used with DoorpanelSM. DoorpanelSM has a number called activated. Activated of DoorpanelSM is usually 0. DoorpanelSM has a number called manipulated. Manipulated of DoorpanelSM is usually 0.
Unlocking a DoorpanelSM with Securitypass is an action applying to two things.
Understand "use [Securitypass] with [a DoorpanelSM]" as unlocking a DoorpanelSM with Securitypass.
Manipulating a DoorpanelSM with Mobitab is an action applying to two things.
Understand "manipulate [a DoorpanelSM]" as manipulating a DoorpanelSM with Mobitab.
Understand "use [Mobitab] with [a DoorpanelSM]" as manipulating a DoorpanelSM with Mobitab.
Instead of unlocking a DoorpanelSM with Securitypass:
if DoorpanelSM (called currentPanel) is part of a door and manipulated of the currentPanel is 0:
say "Securitypass not accepted. You could try to manipulate the panel...";
otherwise if DoorpanelSM (called currentPanel) is a part of a door (called the parent) and activated of the currentPanel is 0:
now the parent is unlocked;
now the parent is open;
now activated of the currentPanel is 1;
otherwise if DoorpanelSM (called currentPanel) is a part of a door (called the parent) and activated of the currentPanel is 1:
now the parent is closed;
now the parent is locked;
now activated of the currentPanel is 0.
Instead of manipulating a DoorpanelSM with Mobitab:
if DoorpanelSM (called currentPanel) is a part of a door and manipulated of the currentPanel is 0:
now manipulated of the currentPanel is 1;
say "Panel got manipulated";
otherwise if DoorpanelSM (called currentPanel) is a part of a door and manipulated of the currentPanel is 1:
say "Panel was manipulated already.";
想法是执行以下操作:
take Securitypass
take Mobitab
use Mobitab with TPTSM1 //which is the first doorpanel; manipulates the door
use Securitypass with TPTSM1 //opens the door
go west
use Mobitab with TPTSM2 //which would be the second doorpanel (to the northwest); says that the panel is already manipulated.
我不知道为什么...非常感谢任何帮助!
编辑:进一步调查,我使用了 showme
命令,发现第一扇门的变量被正确更改,并且它们都正确地为 0。但是据说面板已经被操纵尽管操纵值变为 0。也许问题与 currentPanel 相关?
更多编辑:实际上它看起来确实如此...... currentPanel 似乎总是 TPTSM1。我的理解是,每次对任何门板执行规则时,它都会相应地改变。我将如何更改代码来实现它?
更多编辑:如上所述(看起来) currentPanel
的值似乎在 manipulating/unlocking 之后固定。但是 showme 都看不到这个东西,我也不能在代码的其他地方使用它。我仅从仅在函数中作为参数已知的参数中了解此行为。所以这让我更加困惑...
您定义 "currentPanel" 太晚了。例如这里没有 link 到玩家当前操纵的门板:
if DoorpanelSM (called currentPanel) is part of a door ...
它只选择游戏中存在的一些面板,恰好总是 TPTSM1。
如果你之前定义过,这里:
Instead of unlocking a DoorpanelSM (called currentPanel) with Securitypass:
然后选择当前解锁的面板。或者,您可以使用 "noun",它自动成为当前操作的目标。
不相关的旁注:
Sicherheitsausweis can be used with TürpanelSM
不太可能按照您的意思去做:它创建了一个名为 "used with TürpanelSM" 的形容词并且什么都不做。
相反,使用数字属性来跟踪对象状态有些笨拙,通常使用形容词代替。所以你会定义 DoorpanelSM can be activated
,用 if currentPanel is activated
测试它并用 now currentPanel is activated
和 now currentPanel is not activated
.
设置它
为了使包含特殊门的当前 Inform7 项目中的代码更具可读性,我决定创建各种门和作为门的一部分的东西,以回溯打开和关闭哪些门。
背景:一扇门只有在之前被一种叫做 Mobitab 的东西操纵然后被 Securitypass 解锁的情况下才能打开。所以我创建了一种叫做 DoorpanelSM 的东西,其中有一个 属性 被操纵(通常为 0)和一个 属性 被激活(通常为 0)。我的门操作和解锁代码如下所示:
注意:问题已进一步缩小。编辑一直到底部!
TürpanelSM is a kind of a thing. Sicherheitsausweis can be used with TürpanelSM. TürpanelSM has a number called activated. Activated of TürpanelSM is usually 0. TürpanelSM has a number called manipulated. Manipulated of TürpanelSM is usually 0.
Unlocking a TürpanelSM with Sicherheitsausweis is an action applying to two things.
Understand "use [Sicherheitsausweis] with [a TürpanelSM]" as unlocking a TürpanelSM with Sicherheitsausweis.
Manipulating a TürpanelSM with Mobitab is an action applying to two things.
Understand "manipulate [a TürpanelSM]" as manipulating a TürpanelSM with Mobitab.
Understand "use [Mobitab] with [a TürpanelSM]" as manipulating a TürpanelSM with Mobitab.
Instead of unlocking a TürpanelSM with Sicherheitsausweis:
if TürpanelSM (called currentPanel) is part of a door and manipulated of the currentPanel is 0:
say "Securitypass not accepted. You could try to manipulate the panel...";
otherwise if TürpanelSM (called currentPanel) is a part of a door (called the parent) and activated of the currentPanel is 0:
now the parent is unlocked;
now the parent is open;
now activated of the currentPanel is 1;
otherwise if TürpanelSM (called currentPanel) is a part of a door (called the parent) and activated of the currentPanel is 1:
now the parent is closed;
now the parent is locked;
now activated of the currentPanel is 0;
otherwise if TürpanelSM (called currentPanel) is a part of a door:
Instead of manipulating a TürpanelSM with Mobitab:
if TürpanelSM (called currentPanel) is a part of a door and manipulated of the currentPanel is 0:
now manipulated of the currentPanel is 1;
say "Panel got manipulated";
otherwise if TürpanelSM (called currentPanel) is a part of a door and manipulated of the currentPanel is 1:
say "Panel was manipulated already.";
只有一扇门才有效。但是,如果我使用两扇或多扇门,则定义的门板属性似乎是全局的。我确定 now activated of the currentPanel is 0;
不会更改 currentPanel 的 属性,而是声明一个全局变量,该变量在以下每个条件下都需要。我完全找不到正确设置和获取我要求的面板值的方法。
显示问题的小测试程序(包括以上内容):
"TestsForSO" by geisterfurz007
Locker is a container.
Mobitab is in Locker.
Securitypass is in Locker.
Locker is in Hangar.
DoorpanelSM is a kind of a thing. Securitypass can be used with DoorpanelSM. DoorpanelSM has a number called activated. Activated of DoorpanelSM is usually 0. DoorpanelSM has a number called manipulated. Manipulated of DoorpanelSM is usually 0.
Unlocking a DoorpanelSM with Securitypass is an action applying to two things.
Understand "use [Securitypass] with [a DoorpanelSM]" as unlocking a DoorpanelSM with Securitypass.
Manipulating a DoorpanelSM with Mobitab is an action applying to two things.
Understand "manipulate [a DoorpanelSM]" as manipulating a DoorpanelSM with Mobitab.
Understand "use [Mobitab] with [a DoorpanelSM]" as manipulating a DoorpanelSM with Mobitab.
Instead of unlocking a DoorpanelSM with Securitypass:
if DoorpanelSM (called currentPanel) is part of a door and manipulated of the currentPanel is 0:
say "Securitypass not accepted. You could try to manipulate the panel...";
otherwise if DoorpanelSM (called currentPanel) is a part of a door (called the parent) and activated of the currentPanel is 0:
now the parent is unlocked;
now the parent is open;
now activated of the currentPanel is 1;
otherwise if DoorpanelSM (called currentPanel) is a part of a door (called the parent) and activated of the currentPanel is 1:
now the parent is closed;
now the parent is locked;
now activated of the currentPanel is 0.
Instead of manipulating a DoorpanelSM with Mobitab:
if DoorpanelSM (called currentPanel) is a part of a door and manipulated of the currentPanel is 0:
now manipulated of the currentPanel is 1;
say "Panel got manipulated";
otherwise if DoorpanelSM (called currentPanel) is a part of a door and manipulated of the currentPanel is 1:
say "Panel was manipulated already.";
想法是执行以下操作:
take Securitypass
take Mobitab
use Mobitab with TPTSM1 //which is the first doorpanel; manipulates the door
use Securitypass with TPTSM1 //opens the door
go west
use Mobitab with TPTSM2 //which would be the second doorpanel (to the northwest); says that the panel is already manipulated.
我不知道为什么...非常感谢任何帮助!
编辑:进一步调查,我使用了 showme
命令,发现第一扇门的变量被正确更改,并且它们都正确地为 0。但是据说面板已经被操纵尽管操纵值变为 0。也许问题与 currentPanel 相关?
更多编辑:实际上它看起来确实如此...... currentPanel 似乎总是 TPTSM1。我的理解是,每次对任何门板执行规则时,它都会相应地改变。我将如何更改代码来实现它?
更多编辑:如上所述(看起来) currentPanel
的值似乎在 manipulating/unlocking 之后固定。但是 showme 都看不到这个东西,我也不能在代码的其他地方使用它。我仅从仅在函数中作为参数已知的参数中了解此行为。所以这让我更加困惑...
您定义 "currentPanel" 太晚了。例如这里没有 link 到玩家当前操纵的门板:
if DoorpanelSM (called currentPanel) is part of a door ...
它只选择游戏中存在的一些面板,恰好总是 TPTSM1。
如果你之前定义过,这里:
Instead of unlocking a DoorpanelSM (called currentPanel) with Securitypass:
然后选择当前解锁的面板。或者,您可以使用 "noun",它自动成为当前操作的目标。
不相关的旁注:
Sicherheitsausweis can be used with TürpanelSM
不太可能按照您的意思去做:它创建了一个名为 "used with TürpanelSM" 的形容词并且什么都不做。
相反,使用数字属性来跟踪对象状态有些笨拙,通常使用形容词代替。所以你会定义 DoorpanelSM can be activated
,用 if currentPanel is activated
测试它并用 now currentPanel is activated
和 now currentPanel is not activated
.