你能给我介绍一下文字冒险游戏编辑器INKY吗?它的语法是怎么样的?如果我想在其中做出子选项的效果应该怎么编写代码?
- User
你能给我介绍一下文字冒险游戏编辑器INKY吗?它的语法是怎么样的?如果我想在其中做出子选项的效果应该怎么编写代码?
Assistant
当然可以!INKY是一个用于创建交互式文字冒险游戏的编辑器,使用的语言是Inklewriter的脚本语言Ink。Ink语言设计简洁,易于学习和使用,适合创建复杂的叙事和对话。
Ink语言基础
Ink语言的基本语法包括以下几个部分:
- 故事节点(Knots):故事的主要部分,用
==表示。 - 选项(Choices):玩家可以选择的路径,用
*表示。 - 变量和条件:用于控制故事流程和存储信息。
基本语法示例
ink== Start == You wake up in a dark room. * [Look around] -> LookAround * [Try to open the door] -> OpenDoor == LookAround == You see a small table with a key on it. * [Take the key] -> TakeKey * [Leave the room] -> LeaveRoom == OpenDoor == The door is locked. * [Go back] -> Start子选项的效果
如果你想在选项中创建子选项,可以通过嵌套选项来实现。以下是一个示例:
ink== Start == You wake up in a dark room. * [Look around] -> LookAround * [Try to open the door] -> OpenDoor == LookAround == You see a small table with a key on it. * [Take the key] -> TakeKey * [Put the key in your pocket] -> PocketKey * [Leave the key on the table] -> LeaveKey * [Leave the room] -> LeaveRoom == PocketKey == You put the key in your pocket. * [Go back] -> LookAround == LeaveKey == You leave the key on the table. * [Go back] -> LookAround == OpenDoor == The door is locked. * [Go back] -> Start在这个示例中,选择“Take the key”后,会出现两个子选项:“Put the key in your pocket”和“Leave the key on the table”。选择其中一个后,会进入相应的节点。
使用变量和条件
你还可以使用变量和条件来控制故事的流程。例如:
inkVAR hasKey = false == Start == You wake up in a dark room. * [Look around] -> LookAround * [Try to open the door] -> OpenDoor == LookAround == You see a small table with a key on it. * [Take the key] -> ~ hasKey = true You take the key. * [Go back] -> Start * [Leave the room] -> LeaveRoom == OpenDoor == { hasKey: The door is unlocked. * [Open the door] -> OpenDoorSuccess } { not hasKey: The door is locked. * [Go back] -> Start } == OpenDoorSuccess == You open the door and leave the room.- 故事节点(Knots):故事的主要部分,用
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.