Skip to content

Add support for multi-column defines and additional define files/sheets #176

@nhmkdev

Description

@nhmkdev

Please describe your feature request.
Add support for being able to reference a sub-value of a define id.
Add support for including additional define files for a given project / layout (ideally available on both).

Describe the solution you'd like

For referencing columns:

Example:

define id name movement cost
alpha The Alpha 4 10
beta The Beta 3 6

An element could reference a sub value with: @[alpha.name] and for complicated nested lookups: @[@[character].name]

The delimiter . will not work with JavaScript so in that context __ (double underscore) is used.

Functionality in Beta Build

  • Allow project to reference multiple custom defines files (the old fixed name style is still supported)
  • All define files now support fields (completely optional).
    • This is a bit like introducing objects (for those programmers out there)

Work-in-progress build link: v.1.5.0.0-unstable.v.a5

How To Use

Create defines files (slightly new format)

define name move cost
alpha Alpha Ship 4 25
beta Beta Barge 2 40

Backwards compatibility: Old style define references like @[alpha] will still refer to the second column (in this case the name column)

Add global defines to the project

  1. Right-click the Layouts node (or click the Project menu) > Global Defines...
  2. Add define files the project (can mix and match CSV, Google, and Excel)

Use the define fields

Examples:

  • @[alpha.name]
  • @[alpha.cost]
  • @[alpha] (result will still be the second column, so Alpha Ship )

More complicated example

engines.csv

engine name move cost
slow Slow XL 2 10
turbo Turbo Fast 5 20

ships.csv

ship name engine cost
alpha Alpha Ship slow 25
beta Beta Barge turbo 40

Usage

Now you can reference the move of the ship's engine via: @[@[alpha.engine].move]
You could make this even further nested as necessary based on the context. There are a ton of opportunities using this style of object definition.

The Defines window is also helpful to debug/see what was loaded.

Prefix

Additionally you can give any of the global define sources a prefix to uniquely identify the entries within.

Example from above:

engines.csv

engine name move cost
slow Slow XL 2 10
turbo Turbo Fast 5 20

With a prefix: engine

Accessing the defines within engines.csv:

@[engine.slow.move]
@[engine.slow.cost]

Note: The prefix in this example happens to match the first column name but could be stuff and the following would apply:

Accessing the defines within engines.csv:

@[stuff.slow.move]
@[stuff.slow.cost]

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions