en:authors_main:task_editor:advanced:edit_templates

Templates

Templates are dynamic expressions evaluated on the server before the page is sent to the players. In the browser, only the result of the expression for their specific team is shown. The template code itself is NOT visible, even in the page source code.

Classic applications of templates:

Templates can be written in regular editor mode or in Source mode in the task description, hint text, or bonus text. Templates can be nested.

To make it easier to write template syntax, you can copy and use a special spreadsheet: QEng Template Generation Google Sheet.

Various Types of Templates

{% match line }:{ 
  {%= 688 /*comment: lineup name*/}:{
Text for lineup with ID 688
  %}
 
  {%= 643 }:{
Text for lineup with ID 643
  %}
  {%= 653,655 }:{
Text for lineup with ID 653 or 655
  %}
 
  {%= ?}:{ 
Text for any other lineup
  %}
%}
{% match team }:{ 
  {%= 688 /*comment: team name*/}:{
Text for team with ID 688
  %}
 
  {%= 643 }:{
Text for team with ID 643
  %}
  {%= 653,655 }:{
Text for team with ID 653 or 655
  %}
 
  {%= ?}:{ 
Text for any other team
  %}
%}

Example in game

Useful for releasing codes or hints at a specific absolute time. To convert date/time, use Unix Time Converter.

{% unix_time 1639999296/*date in unix time*/, Opens, Left}:{
This text will be shown after the specified time.
%}

Example in game

*(Replace `code_1` with the required code index, e.g. `code_5` for the fifth code)*

{% match code_1 }:{ 
  {%= abc}:{
The answer "abc" is submitted for the first code.
  %}
 
  {%= bac, cba}:{
The answer "bac" or "cba" is submitted for the first code.
  %}
 
  {%= !no_answer!}:{
No correct answer has been submitted for the first code yet.
  %}
 
  {%= ?}:{ 
Some other answer synonym has been submitted.
  %}
%}
{% match code_first_2 }:{ 
  {%= abc}:{
The first answer submitted for this code was "abc".
  %}
  {%= !no_answer!}:{
The code has not been submitted yet.
  %}
  {%= ?}:{
Another answer was submitted.
  %}
%}

Just like codes, you can check answers for bonuses:

  • bonus_1 / bonus_first_1 — last or first answer submitted for bonus 1 on the current task.
  • gbonus_1 / gbonus_first_1 — last or first answer submitted for spanning (global) bonus 1. Spanning bonuses can be checked even on levels where they are not displayed.

Example in game

You can prepend who_ to answer checks to find out who in the team submitted the answer. Possible values:

  • me — code was submitted by the current logged-in user.
  • other — code was submitted by another team member.
  • !no_answer! — not submitted yet.

*(Anonymous players without registration are treated as the same user).*

{% match who_code_1 }:{ 
  {%= me}:{
I submitted the first code.
  %}
  {%= other}:{
My teammate submitted the first code.
  %}
  {%= !no_answer!}:{
Nobody has submitted the code yet.
  %}
%}

Prepend who_team_ to check which team solved a spanning/shared task: Possible values:

  • me — my team solved the code.
  • other — an opponent team solved the code.
  • !no_answer! — not solved yet.
{% match who_team_code_1 }:{ 
  {%= me}:{
Our team solved this code first!
  %}
  {%= other}:{
Opponent team solved this code first.
  %}
%}
{% match lang }:{ 
  {%= ru}:{
Russian interface language selected.
  %}
  {%= uk }:{
Ukrainian interface language selected (uk).
  %}
  {%= en }:{
English interface language selected.
  %}
  {%= ?}:{ 
Some other language.
  %}
%}

If your game uses paid levels or paid hints, you can check the purchase status:

  • product_KEY — where KEY is the product key from settings.

Possible values:

  • yes — product purchased by the team.
  • pending — payment started but not yet finalized.
  • no — not purchased.
{% match product_level_5 }:{ 
  {%= yes}:{
The team purchased access to level 5.
  %}
  {%= pending}:{
Payment is pending. Please wait and refresh the page.
  %}
  {%= no}:{
Access closed. Price is $1. Click to purchase:
%pay_button level_5%
  %}
%}
  • en/authors_main/task_editor/advanced/edit_templates.txt
  • Last modified: 2026/06/15 21:07
  • (external edit)