CTELang

From Esolang
Jump to navigation Jump to search
CTELang
Paradigm(s)
Designed by oreiboon
Appeared in 2023
Computational class Turing complete
Major implementations C.T.E. (v1.0-v1.1)
File extension(s) .cttm

Overview

CTELang (Short for Click To Eleven Language) is a verbose programming language based off ClickClang (by SpaceByte), created around Feburary of 2023 by oreiboon for Click to Eleven, a modified version of click to ten, to allow modding of aforementioned game without directly modifying source code.

Oddities

  • While CTELang does allow for variables, it only allows for floating point numbers.
    • CTELang does technically allow you 2 string variables, however you can only modify and/or display them.
  • CTELang does not have conventional support for events and functions. The only "event" supported in CTELang is a Update event, which triggers the code after it every frame. To use said Update event, you put [UPDATE] before any code you want to run every frame.
  • Commands can have any amount of trailing subcategories after it and still work as intended. For example: text.output will function the same as text.output.string.

Predefined variables

CTELang gives users access to several internal values, displayed as integers, as described below.

  • text.length - The length of the main string variable.
  • game.mods - The amount of mods in the Mods folder.
  • game.clicks - The amount of clicks stored.
  • game.interval - The amount of clicks to add every time the player Left-Clicks.
  • game.goal - The amount of clicks needed to win the game.
  • game.deltaTime - The amount of time (in seconds) since the last rendered frame.
  • mouse.left - If the Left Mouse Button is being held down at the moment. (1 if true, 0 if false.)
  • mouse.right - If the Right Mouse Button is being held down at the moment. (1 if true, 0 if false.)
  • key.space - If the Space Key is being held down at the moment. (1 if true, 0 if false.)
  • key.left - If the Left Key is being held down at the moment. (1 if true, 0 if false.)
  • key.down - If the Down Key is being held down at the moment. (1 if true, 0 if false.)
  • key.up - If the Up Key is being held down at the moment. (1 if true, 0 if false.)
  • key.right - If the Right Key is being held down at the moment. (1 if true, 0 if false.)

Commands

Game

Subcommand Description Version
game.set <clicks|interval|goal> <value> Sets the desired game variable to <value> (Can be a variable.) v1.0+
game.persist.set <key> <value> Stores <value> at <key> as data that persists across sessions. v1.1.1+
game.persist.get <variable> <key> Gets <key> from persistent data and stores it into <variable>. Defaults to 0 if <key> isn't in persistent data. v1.1.1+

Text/Log

These are put under the same category, because they have similar functions.

Subcommand Description Version
text.clear
log.clear
Clears the specified string. v1.0+
text.output Renders the specified stored string to the screen. v1.0+
log.output Logs the specified stored string. v1.0+
text.append.string <string>
log.append.string <string>
Appends <string> to the end of the specified string. v1.0+
text.append.variable <variable>
log.append.variable <variable>
Appends the value of <variable> to the end of the specified string. (If it exists.) v1.0+
text.append.space
log.append.space
Appends a space to the end of the specified string. v1.0 (Removed in v1.1)
text.append.newline
log.append.newline
Starts a new line for the specified string. v1.0 (Removed in v1.1)

Variables

Subcommand Description Version
variable.set <varname> <value> Sets/Creates a variable under <varname> with the value of <value>. (Can be a variable.) v1.0+
variable.math.add <varname> <value1> <value2> Sets/Creates a variable under <varname> with the value of <value1> + <value2>. (Can be variables.) v1.0+
variable.math.sub <varname> <value1> <value2> Sets/Creates a variable under <varname> with the value of <value1> - <value2>. (Can be variables.) v1.0+
variable.math.mul <varname> <value1> <value2> Sets/Creates a variable under <varname> with the value of <value1> * <value2>. (Can be variables.) v1.0+
variable.math.div <varname> <value1> <value2> Sets/Creates a variable under <varname> with the value of <value1> / <value2>. (Can be variables.) v1.0+
variable.math.mod <varname> <value1> <value2> Sets/Creates a variable under <varname> with the value of <value1> % <value2>. (Can be variables.) v1.0+
variable.math.pow <varname> <value1> <value2> Sets/Creates a variable under <varname> with the value of <value1> ^ <value2>. (Can be variables.) v1.1.2+
variable.math.sin <varname> <value1> Sets/Creates a variable under <varname> with the value of sine(<value1>). (Can be a variable.) v1.1.2+
variable.math.cos <varname> <value1> Sets/Creates a variable under <varname> with the value of cosine(<value1>). (Can be a variable.) v1.1.2+
variable.math.round <varname> <value1> <value2> Sets/Creates a variable under <varname> with the value of <value1> rounded to <value2> decimals. (Can be variables.) v1.0+
variable.math.floor <varname> <value1> Sets/Creates a variable under <varname> with the value of <value1> rounded down to the nearest integer. (Can be a variable.) v1.1.2+
variable.math.ceil <varname> <value1> Sets/Creates a variable under <varname> with the value of <value1> rounded up to the nearest integer. (Can be a variable.) v1.1.2+
variable.math.abs <varname> <value1> Sets/Creates a variable under <varname> with the value of abs(<value1>). (Can be a variable.) v1.1.2+
variable.math.clamp <varname> <value1> <value2> <value3> Sets/Creates a variable under <varname> with the value of <value1> clamped between <value2>-<value3>. (Can be variables.) v1.1.2+
variable.math.min <varname> <value1> <value2> Sets/Creates a variable under <varname> with the value of <value1> or <value2>, whichever is lower. (Can be variables.) v1.1.2+
variable.math.max <varname> <value1> <value2> Sets/Creates a variable under <varname> with the value of <value1> or <value2>, whichever is higher. (Can be variables.) v1.1.2+

Control

Handles the control flow of code.

Subcommand Description Version
control.condition.equals <value1> <value2> <lines> Skips <lines> lines if <value1> == <value2> is false. (Can be variables.) v1.0+
control.condition.notequals <value1> <value2> <lines> Skips <lines> lines if <value1> == <value2> is true. (Can be variables.) v1.0+
control.condition.greater <value1> <value2> <lines> Skips <lines> lines if <value1> > <value2> is false. (Can be variables.) v1.0+
control.condition.notgreater <value1> <value2> <lines> Skips <lines> lines if <value1> > <value2> is true. (Can be variables.) v1.0+
control.condition.lesser <value1> <value2> <lines> Skips <lines> lines if <value1> < <value2> is false. (Can be variables.) v1.0+
control.condition.notlesser <value1> <value2> <lines> Skips <lines> lines if <value1> < <value2> is true. (Can be variables.) v1.0+
control.goto <line> Goes to line <line> in the current file. v1.0+

Example Mods

Click to twenty

A mod that, as the name suggests, lets you click to 20 instead of the base 11.

game.set.goal 20

Display Counter

A mod that replaces the default text with a counter that shows how many clicks you have out of the amount you need to `win`.

v1.0

[UPDATE]
text.clear
text.append.string Clicks:
text.append.space
text.append.variable game.clicks
text.append.string /
text.append.variable game.goal
text.output

v1.1+

[UPDATE]
text.clear
text.append.string Clicks: 
text.append.variable game.clicks
text.append.string /
text.append.variable game.goal
text.output