9

Inform7 にとって非常に新しく、そのスタイルです。提供されたドキュメントに目を通しましたが、一部のインターネット ブラウジングでは何も得られませんでした...これは、私が探しているものの単純化されたバージョンです。私はこのようなものを書きたい:

breakroom is a room. "A run of the mill breakroom."

soda pop is a kind of thing. "A refreshing soda pop."

soda machine is in the breakroom.  dispense button is on the soda machine.

instead of pushing dispense button:
    say "A soda can dispenses".
    create a soda pop (called pop) in the breakroom.

「休憩室でソーダ ポップ (ポップと呼ばれる) を作成します。」明らかに有効なコマンドではありませんが、私がやりたいことを伝えてくれることを願っています. 実行時にオブジェクトをインスタンス化する方法がわかりません。これは合理的に行うことができますか?どんな助けでも大歓迎です。ここで Inform を支持する人があまりいないことは承知していますが、試してみたいと思います。

4

2 に答える 2

8

Inform は動的オブジェクトをうまく処理できませんが、いずれにしても最善の方法ではないことがよくあります。セクション10.3。マニュアルのディスペンサーと小物の備品が役立つ場合があります。

これに最適なモデルは物理的なモデルだと思います。マシンで限られた数の缶を作成します。例えば:

Breakroom is a room. "A run of the mill breakroom."

A soda pop is a kind of thing.  The description is "A refreshing soda pop."

The soda machine is in the breakroom.  It is fixed in place and transparent.
The description is "Just an average soda machine, with a large dispense
button."

There are three soda pops in the soda machine.

The dispense button is a part of the soda machine.

Instead of pushing the dispense button:
        if a soda pop (called the can) is in the soda machine:
                move the can to the breakroom;
                say "A soda can dispenses.";
        otherwise:
                say "The machine is empty, so nothing happens.".

Test me with "look / x machine / push button / look / push button /
push button / push button / look".

(あなたが好むのopaqueではなく、機械を作ってください!)。transparent上記では、ソーダ ポップの説明も微調整しました。オブジェクト定義の後では"Blah"なく、単にThe description is "Blah"「調べる」説明ではなく、最初の説明 (部屋の説明の一部として出力される) を設定します。私はあなたがここで望んでいるものではないと思います - そして、私はボタンを別のオブジェクトではなく、マシンの「一部」にしました。

結果:

Welcome
An Interactive Fiction
Release 1 / Serial number 110324 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD

Breakroom
A run of the mill breakroom.

You can see a soda machine (in which are three soda pops) here.

>test me
(Testing.)

>[1] look
Breakroom
A run of the mill breakroom.

You can see a soda machine (in which are three soda pops) here.

>[2] x machine
Just an average soda machine, with a large dispense button.

In the soda machine are three soda pops.

>[3] push button
A soda can dispenses.

>[4] look
Breakroom
A run of the mill breakroom.

You can see a soda pop and a soda machine (in which are two soda pops) here.

>[5] push button
A soda can dispenses.

>[6] push button
A soda can dispenses.

>[7] push button
The machine is empty, so nothing happens.

>[8] look
Breakroom
A run of the mill breakroom.

You can see three soda pops and a soda machine (empty) here.

>
于 2011-03-24T21:52:52.180 に答える
6

この種のことを行うための拡張機能を作成しました: https://github.com/i7/extensions/blob/master/Jesse%20McGrew/Dynamic%20Objects.i7x

これを使用するには、プロトタイプ オブジェクト (「元のソーダ ポップ」など) を作成し、式を使用しa new object cloned from the original soda popて新しいオブジェクトをインスタンス化する必要があります。これは、オブジェクトの大規模な静的プールを作成するよりもメモリ効率が高くなりますが、Z マシン (Glulx のみ) では機能せず、オブジェクトが複雑な場合はいくつかの注意事項があります。

また、動的オブジェクトの作成が本当に必要かどうかを真剣に考えてください。「最後に購入したソーダを飲み終えていないのに、お金を使う気になれない」などのように、アクションを拒否する合理的な理由を考え出すと、プレイヤーにとってより簡単で混乱が少なくなる可能性があります。数千個のソーダ缶が横たわっていると、ゲームが遅くなる可能性がありますが、メリットはあまりありません。

于 2011-04-15T04:13:13.647 に答える