特殊なドアを含む現在のInform7プロジェクトでコードを読みやすくするために、ドアの一部であるドアや物を作成し、開閉するドアを後退させることにしました。
背景:Mobitabと呼ばれていたもので以前に操作された後、セキュリティパスでロック解除された場合のみ、ドアを開くことができます。だから、私はDoorpanelSMと呼ばれるものを作成しました(通常は0)、プロパティをアクティブにしました(通常は0)。ドアの操作と解除のコードは、次のようになります。Inform7のルールの類義語は変更されませんか?
注:問題はさらに絞り込まれました。編集が一番下まで来ています!
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.";
1つのドアは素晴らしいです。しかし、2つ以上のドアを使用すると、定義されたドアパネルのプロパティはグローバルに見えます。私はnow activated of the currentPanel is 0;
がcurrentPanelのプロパティを変更していないと確信していますが、以下の各条件で要求されるグローバル変数を宣言しています。私は、私が求めているパネルの値を正しく設定して入手する方法を見つけることができません。
問題を表示する小testprogram(上記を含みます):
"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.";
アイデアは、次の操作を実行することです:
は/ がTPTSM1とMobitab
使用Mobitabを取るSecuritypass
取ります/これは最初のドアパネルです。ドアを操作する
セキュリティパスをTPTSM1と併用すると、ドアが開きます。
西に行く
MOBITABでTPTSM2 //を使用して、北西に2番目のドアパネルになります。パネルは既に操作されていると言います。
私は何の手がかりもありません。何か助けがありがとう!
EDIT:showme
コマンドを使用して、最初のドアで変数が正しく変更されており、両方とも正しく0であることがわかりました。しかし、操作値beeingにもかかわらずパネルが既に操作されていると言われています問題はcurrentPanelのものに接続されているのでしょうか?
編集:実際それはちょうどそのように見える... currentPanelは常にTPTSM1と思われる。私の理解は、ルールがどんなドアパネルに対しても実行されるたびにそれが変わるということでした。それを達成するためにコードをどのように変更すればよいでしょうか?
さらに編集:上記のように(外見上)、currentPanel
の値は、操作/ロック解除後に修正されているようです。しかし、showmeもこのことを見ていませんし、コード内の他の場所で使うこともできません。私はパラメータとして関数内でのみ知られているパラメータからこの動作を知っています。だからこれは私をさらに混乱させます...
助けてくれてありがとう!これは、ロック解除部分と完全に機能しているようです。操作のための代わりのルール(私はロック解除の方法とまったく同じように変更されました)は、コンパイルエラーをスローし、アクションが意味をなさないと伝えます。どちらのアクションも[アンロック/操作]は2つのことに適用されるアクションです。 追加のヒントもありがとう! – geisterfurz007
アクションが正しく定義されていません。あなたはカスタムロック解除をアクションで削除することができます(これは既に標準ライブラリに定義されています。定義は何もしません。単に 'Underpass 'を[DoorpanelSM]で「unlockpass」としてください)それを操作するアクションは、2つのことに適用されるアクションです。 「DoorpanelSM」を操作することを理解してください。 「DoobpanelSM」で「Mobitab」を操作することを理解してください。 – JJJ
あなたは最高です!迅速な返信をありがとう!すべて今はうまく動作します:) – geisterfurz007