首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Inform7规则中的同义词不会改变吗?

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

Stack Overflow用户
提问于 2017-05-11 08:06:53
回答 1查看 62关注 0票数 0

为了使包含特殊门的当前Inform7项目中的代码更具可读性,我决定创建各种门和东西,它们是门的一部分,可以回溯打开和关闭哪些门。

背景:只有当门之前被叫做Mobitab的东西操纵,然后被安全旁路解锁时,才能打开门。因此,我创建了一种名为DoorpanelSM的东西,它使用一个操作的属性(通常为0)和一个激活的属性(通常为0)。我的操作和解锁的代码如下所示:

注意:问题进一步缩小了。编辑一直到底部!

代码语言:javascript
复制
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的属性,而是声明了一个全局变量,这个变量在下面的每种条件下都会被请求。我完全无法找到正确设置和获取我所要求的面板的值的方法。

用于显示问题的小型测试程序(包括以上内容):

代码语言:javascript
复制
"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 //的Mobitab,这是第一个门板;操作门 在TPTSM1 //打开门时使用安全通道 往西走 使用带TPTSM2 //的Mobitab,这将是第二个门面板(向西北方向);表示面板已经被操纵。

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

编辑:进一步研究,我使用了showme命令,发现变量在第一扇门上被正确地更改了,并且它们在0的位置都是正确的。然而,据说该面板已经被操纵,尽管被操纵的价值为0。也许问题与currentPanel有关?

更多的编辑:实际上看起来就像.currentPanel似乎永远是TPTSM1。我的理解是,每次对任何Doorpanel执行规则时,它都会相应地发生变化。我将如何更改代码以实现这一点?

更多的编辑:如上所述,currentPanel的值在操作/解锁后似乎是固定的。然而,showme既没有看到这个东西,也不能在代码的其他地方使用它。我只从仅在函数中被称为参数的参数中才知道这种行为。所以这更让我困惑..。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-05-12 08:00:27

你定义"currentPanel“太迟了。例如,这里没有到播放机当前正在操作的门面板的链接:

代码语言:javascript
复制
if DoorpanelSM (called currentPanel) is part of a door ...

它只选择了游戏中存在的一些面板,而这个面板总是TPTSM1。

如果您在前面定义了它,请在这里:

代码语言:javascript
复制
Instead of unlocking a DoorpanelSM (called currentPanel) with Securitypass:

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

无关的边注:

Sicherheitsausweis can be used with TürpanelSM不太可能做你想做的事情:它创建了一个名为“与Tür复合ü一起使用”的形容词,并且什么也不做。

相反,使用number属性来跟踪对象状态有点笨重,而形容词则是常用的。因此,您需要定义DoorpanelSM can be activated,用if currentPanel is activated测试它,并用now currentPanel is activatednow currentPanel is not activated设置它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43909809

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档