Skip to content

Value syntax

tjjfvi edited this page Jan 30, 2019 · 2 revisions

To use a property of the payload, prefix the name with a dot (.).

Otherwise, to send a plain string, prefix it with nothing or a colon (:).

To send a file, use @f{relative path to gcode} or @-{absolute path} were the path is in value syntax.

To format a value, use $F... where F is:

  • t: format it as time. Follow it with F{value}, where F is one of the subformats listed under Interpretation algorithm

To include a value in your Applet, either type {{ValueN}} or click the Add Ingredient button.

Examples

  • .name: the property name of the event payload
  • :lalala: the text lalala
  • word: the text word
  • @f.path: (for the PrintDone event) a link to the contents of the gcode.
  • @-.movie: (for the MovieDone event) a link to the rendered timelapse
  • @-:/home/pi/test.txt: a link to the contents of /home/pi/test.txt
  • @-/home/pi/test2.txt: a link to the contents of /home/pi/test2.txt
  • $t:.time: show time print took in H:MM format,
  • $tm.time: show time print took in Hh Mm format.

Interpretation algorithm

  1. If the value begins with a dot (.), it will use that prop of the event payload (e.g. .name for PrintDone)
  2. If it begins with an at symbol (@):
    1. path will be the result of interpreting the string with the first two characters removed as a value
    2. If the second character in the value is an f it will prepend to path the base uploads folder
    3. Otherwise, the second character should be a dash (-)
    4. It will then upload the file at path to file.io and return a link to that file.
  3. If it begins with a colon (:), it will use the string after the colon
  4. If it begins with a dollar sign ($), it will:
    1. If the second character is a t:
      1. Let time be the result of interpreting the string with the first three characters removed as a value.
      2. If the third character is :, it will format time in H:MM format (e.g. 1:02).
      3. If the third character is $, it will format time in H:MM:SS format (e.g. 1:02:34)
      4. If the third character is h, it will format time in Hhformat (e.g.1h`)
      5. If the third character is m, it will format time in Hh Mm format (e.g. 1h 2m)
      6. If the third character is s, it will format time in Hh Mm Ss format (e.g. 1h 2m 34s)
  5. Otherwise, it will just send the plain text
Clone this wiki locally