Inform7 中规则中的同义词不会更改吗?



为了使代码在当前包含特殊门的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;没有更改当前面板的属性,而是声明了在以下每个条件下要求的全局变量。我完全无法找到正确设置和获取我要求的面板值的方法。

显示问题的小测试程序(包括上述):

"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.";

这个想法是执行以下操作:

采取安全通行证
将 Mobitab
与 TPTSM1 一起使用//这是第一个门板; 使用带有TPTSM1的安全通行证操纵门//打开门
向西
使用带有TPTSM2的Mobitab//这将是第二个门
板(向西北); 表示面板已纵。

我也不知道为什么...任何帮助都非常感谢!

编辑:进一步调查,我使用了showme命令,发现变量在第一张门上正确更改,并且它们都正确位于0。然而,据说尽管操纵的值为0,但面板已经纵了。也许问题与当前面板有关?
更多编辑:实际上它看起来像那样...当前面板似乎始终是TPTSM1。我的理解是,每次为任何门板执行规则时,它都会相应地更改。我将如何更改代码来实现此目的?
甚至更多编辑:因此,如上所述(看起来),currentPanel的值似乎在操纵/解锁后被修复。但是,showme 既看不到这个东西,也不能在代码中的其他地方使用它。我只从仅在函数中作为参数知道的参数中知道这种行为。所以这让我更加困惑...

你定义"currentPanel"太晚了。例如,这里没有指向玩家当前正在操作的门板的链接:

if DoorpanelSM (called currentPanel) is part of a door ...

它只选择游戏中存在的一些面板,恰好总是TPTSM1。

如果您之前定义它,请在此处:

Instead of unlocking a DoorpanelSM (called currentPanel) with Securitypass:

然后,它选择当前正在解锁的面板。或者,您可以使用"名词",它自动成为当前操作的目标。


不相关的旁注:

Sicherheitsausweis can be used with TürpanelSM不太可能做你想做的事情:它创造了一个名为"与TürpanelSM一起使用"的形容词,并且没有做任何其他事情。

相反,使用数字属性来跟踪对象状态有些笨拙,通常使用形容词代替。所以你会定义DoorpanelSM can be activated,用if currentPanel is activated测试它,用now currentPanel is activatednow currentPanel is not activated来设置它。

相关内容

  • 没有找到相关文章