Skip to content

YA WORD

Crypto Morin edited this page Mar 16, 2022 · 8 revisions

Yet Another Way Of Reading Documentations

Documentations written in YAWORD format use a mix of YAML and Ruby syntax.
This combination is useful on GitHub which allows authors to express their intent and available values for YAML config options in a compact and colorized way on GitHub with the least amount of syntax overhead.

How to read this document?

Imagine this as your config.yml and these are all the option names you can choose.
Right in front of the options there are some words like Text and Number these are the types-the values that can be used for those options.

Types

Text: This means it's a normal text. You can put whatever you want,
      but some of them have a link right after them and you can only choose one of those words from the link.
Boolean: Either 'true' or 'false'
Number: A positive integer. 0, 1, 2 etc (but not for example 1.455 or 56.434, 3.5)
        Note that this option is mainly used for specifying "ticks" of something. 20 ticks in Minecraft is 1 second.
        If you're interested about ticks, visit https://minecraft.fandom.com/wiki/Tick
Decimal: A positive decimal. 0, 1, 2, 1.455, 4.345, 4.5, 777.55 etc

Number and Decimal might be followed by ; Min - Max for the minimum and maximum values (inclusive) that you can use for this option. E.g.

option: Number ; 0 - 10

It means you can only choose a number between 0 and 10 (including 0 and 10)

Sometimes a single option can have different values:

amount: Number or Text or Boolean

This is straightforward English and shouldn't need any explaining.

Conditional Options

case # ignore this line
when { type: Something } then option: ...

It's just simple English! It says only when the option type has value Something then the option named option is useful.
So for example

case # ignore this line
when { type: BOAT } then tree-species: Text

Means that tree-species option is a text option that is only useful if the type option is set to BOAT

Similarly something like

case option: Something
  when { someOtherOption: Sth } then           # Options
  when { someOtherOption: SomethingElse } then # Options2
end

Means that option should have values specified in the # Options part if someOtherOption is Sth and it should have values specified in the # Options2 part if someOtherOption is SomethingElse

Classifications

Sometimes to avoid repeating the same thing over and over again you'll see Capitalized words like Item and Potion These are called type classifications. So if you see something like

class Loot
  chance: Number
  rarity: Text
end

To understand this, all you have to do is to replace the options between class (definition) and end where you saw Loot

start-loot:
  chance: Number
  rarity: Text
end-loot:
  chance: Number
  rarity: Text

E.g.

# More complex types:
class Item:   "https://github.com/CryptoMorin/XSeries/wiki/XItemStack"
class Potion: "https://github.com/CryptoMorin/XSeries/wiki/XPotion"
class Entity: "https://github.com/CryptoMorin/XSeries/wiki/XEntity"

Aliases

Sometimes type classifications are just simple types like Text, but they only accept certain formats of a text, for this reasons, type aliases are written like this:

alias Math: for Text "A math expression."
alias Ticks: for Number "Amount of ticks. Note: Every second has 20 ticks."
alias Health: for Decimal "The health of the mob." ; 0 - 1024
Clone this wiki locally