可能的房间列表而不是可能的方向

时间:2017-02-22 11:04:37

标签: inform7

我尝试列出用户可能去的方向。但是对于故事的基调,不要说“你可以去南北”,但“你可以去洗手间和厨房”更好。

我找到了帽子代码,但它只显示了方向。

Definition: a direction (called thataway) is viable if the room 
thataway from the location is a room.

After looking:
    say "you can go [list of viable directions]."

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

绝对不是最好的方式,但我遇到了类似的问题,我最终迭代了你创建的路线列表,并将每个房间添加到房间列表中,然后可以说:

nLooking is a number that varies. nLooking is 0.

After looking:
    now nLooking is 1;
    let accessibleRooms be a list of rooms;
    let pDirections be list of viable directions;
    repeat with dirToLookAt running through pDirections:
        try silently going dirToLookAt;
        if rule succeeded:
            add the location of the player to accessibleRooms;
            try silently going the opposite of dirToLookAt;
    now nLooking is 0;
    say "You can go to [accessibleRooms].".

Before going through a locked door when nLooking is 1:
    stop the action.

我使用nLooking来阻止输出

  

(第一扇门)
  它似乎被锁定了。

在寻找可以进入的房间时 if rule succeeded检查palyer是否能够进入房间。如果是这种情况,则玩家走进的房间会被添加到列表中,玩家会被移回他来自的地方。

这只有在没有制作混乱地图的情况下才能发挥作用,其中移动方向相反,并不意味着一个人落在同一个房间。人们可能只是将玩家放回他来自的房间......

我知道的答案很晚,但也许可以帮助有相同问题的人:)