Directory
Directory
The complete EZCode Syntax. Ordered by alphabetical order. For quick Syntax, also see README.md.
The await
keyword is used to delay the program. It can be used in two ways. One, await milliseconds
where `milliseconds is a number, will delay the program by the inputted time.
var tick 100
loop true {
await tick
}
This is a common use of the await keyword. The next way the await keyword can be used is with an argument await argument
where argument is a boolean value. See arguments for details.
The bringto
keyword brings a control to the front or back of the display. There is bringto front controlName
and bringto back controlName
.
shape player
bringto front player
A common use of the bringto
keyword is to make sure the control added is sent to the front. Or if there is a background that is declared after another control, to send the background to the back.
The button
keyword is used to create a button. It will create it to the visual output or create an instance that can be displayed to a window. The syntax is relatively simple, button name
or button name properties
. The default values for the properties are as follows. backcolor:[255;255;255]
, x:0
, y:0
, width:75
, and height:25
.
button btn1 // create a button with default values
button btn2 x:50, y:50, text:Press Me! // create a button with custom values
event btn2 click On_Click_Method // set the trigger for when the button gets clicked
btn1 width:150 // change the properties of a button
See Properties for more details on property values.
The clear
keyword is used to clear the console. It can be used by itself, or have an argument after it clear argument
.
print Input Your Name
var _input : input console
clear
print Welcome, `_input`
This code will ask for the name of the user, clears the console, and then welcomes the user. This is an ordinary use of the keyword clear
.
The keyword destroy
is used to destroy a control. When an object is destroyed, it can never be accessed again. An error will occur if it is trying to be accessed. destroy controlName
is the correct syntax, but there is also destroy controlName argument
. This will only destroy the control if the argument is true
.
The else
statement is only useful after an if
statement. If the if
statement's argument is false
, then the code inside the else
statement will run. The syntax for this is very simple, else : code...
or else : { code_inside_brackets }
. If the else
statement does not use brackets, then it will execute the next line of code, whether that be right after the colon, or on the next line.
if false : // Nothing
else : {
// Code
}
This code will skip over the if
and go straight to the else
because the if statement's argument is false.
endmethod
is what ends a method. If there is no endmethod
to a method
, then the program will not run and will give an error.
The event
keyword is for controls or windows. This acts as a trigger for the inputted action. Whenever the control or window is triggered, it can play a file, method, or single segment of code. The correct syntax is event control_or_window eventType filePath_or_method_or_code
.
shape player
event player click ~/player_clicked.ezcode`
In this example, a control named 'player' is created. It is then given the event click
set to a file. If this control is clicked, then the file will be played.
The list of events for controls:
click
when the control is clicked by the mousehover
when the mouse hovers over the controlmove
when the control's position changesscale
when the control's width or height changesbackcolor
when the control's backcolor changesforecolor
when the control's forecolor (text color) changesimage
when the control's image is changedimagelayout
when the control's imagelayout (ex. tile, zoom, etc)font
when the control's font is changedtext
when the control's text is changed
The list of events for windows:
click
when the window is clicked by the mousehover
when the mouse hovers over the windowmove
when the window's position changesscale
when the window's width or height changesbackcolor
when the window's backcolor changesforecolor
when the window's forecolor (text color) changesimage
when the window's image is changedimagelayout
when the window's imagelayout (ex. tile, zoom, etc)font
when the window's font is changedtext
when the window's text is changedfocused
when the window is the active windowcontroladded
when a window is displayed to the windowcontrolremoved
when a window is removed from the windowdefocused
when the window stops being the active windowclose
when the window is closedopen
when the window is openenabledchanged
when the window becomes enabled or uneneabledkeydown
when a key is pressed down and the window is focusedkeyup
when a key lifted and the window is focusedkeypress
when a key is pressed while window is focusedresize
when the window's width or height changesresizestart
when the window starts changing sizeresizeend
when the window finishes changing size
The file
keyword is used to manipulate files. There is read
, write
, validpath
, play
, playproj
, create
, exists
, and delete
. The following syntax is:
file read filepath
: This reads a file and outputs the contents.file read C:/file.txt => file_contents
file write text_or_var filepath
: This writes contents to a file.file write This\_is\_a\_test\_file C:/file.txt
: writes to a filefile write This\_is\_a\_test\_file C:/file.txt => result
: Outputs a boolean if writing was successful
file validpath text_or_var
: This returns a boolean if the inputted text could be a valid file.-
var inputted_file : input [console](Programs.md#console) file validpath inputted_file => valid if valid : print Valid Path! else : print Invalid Path ):
-
file play filepath
: This plays a file using EZCode.file play ~/code.ezcode
: Plays the file in the programfile play ~/code.ezcde => results
: This outputs the console of the file into a variable`
file playproj filepath
: This plays a EZProj filefile playproj ~/Project.ezproj
: Plays the project in the programfile playproj ~/Project.ezproj => result
This outputs the console of the file into a variable
file create filepath
: This creates a file and outputs a boolean if successfulfile create file.txt
: Creates the filefile create file.txt => result
Creates the file and outputs boolean if successful
file exists filepath
: This outputs a boolean if file existsfile exists C:/Project/file.txt => result
file delete filepath
file delete ~/file.txt
: Deletes the filefile delete ~/file.txt => result
Delets the file and outputs a boolean if successful
The file
keyword uses output characters to output the results. See Output Characters.
The global
keyword is used for declaring a variable, list, group, or control. It's placed before the keyword to make it global. When a method runs, all variables, groups, lists, or controls from the method that ran it are inaccessible unless they are declared global.
method start
global var text \!
txtMaker : Hello World
endmethod
method txtMaker : something:\!
text = 'something'
endmethod
This is the main way of using the global
keyword. The reason that global
is necessary is so that variables, groups, lists, and controls can be used across different methods.
The group
keyword is used to declare a group. A group is an array of controls and is used to change the properties of all of the controls in the group. There is a way to create a new group new
, add a control add
, replace equals
, remove a control remove
, clear all of the controls clear
, destroy the group destroy
, destroy the group and destroy all of the controls in it destroyall
, and change the properties of all of the controls change
.
group name new
: Creates a new groupgroup name new : controls...
: Creates a new group and adds controls to itgroup name add controlName
: Adds a control to the groupgroup name equals index controlName
: Replaces the controls with the corresponding index with the control inputtedgroup name remove index_or_name
: Removes a control from the group by name or indexgroup name clear
: Clears all of the controls from the group (does not affect the controls)group name destroy
: Destroys the group making it inaccessible (does not affect the controls)group name destroyall
: Destroys all of the controls in the group as well as the groupgroup name change : properties...
: Changes all controls in the group relative to the inputted properties (Ex: controls's 'x' value is '5.' the inputted properties are '10' so the new control's properties are '15')group name argument change : properties...
: If the agrument is true, this changes all controls in the group to the properties, else it changes them relative to the controls properties
shape s x:0
label l x:5
button b x:10
textbox t x:15
group g new : s, l, b, t
group g change : x:50 // offsets all control's x positions by 50
The if
statement is used for executing code only if the argument given is true. An argument
is a boolean value. The syntax for it is simple if argument :
. Here is a common use of the if
statement
var number 0
loop 100 {
if number > 50 : // execute code
number + 1
}
There can only be one :
for the line containing the if statement. An error will occur because it won't find where the argument ends and the code begins.
To extend the argument to have more than one condition is can be done with the and
(also &
) and or
keywords. An example if a = 1 & b = 2 :
This statement will be true only if a
is equal to one and b
is equal to two. See Conditional Syntax. If an if statement is true, then it will run the code after the :
, whether it be right after it, the next line, in a couple lines, or if the code is in brackets ({
, }
). if wanted, the opening bracket does not need to be right after the colon, but can be on the proceeding lines.
The input
keyword is used for getting inputs from the computer. This keyword outputs its value using output characters ( See Output Characters). The syntax is as follows.
input console
: waits for the user to input into the console.input console => var_input
:var_input
is equal to what the user inputted into the console.
input key
: returns all of the Keys being pressed as text.input key => keys
:keys
is equal to all of the keys being pressed separated by,
. As an example, if 'A' and 'B' were being pressed at the same time, then the output would beA, B
.
input key keyName
: returns a boolean if the key is being pressed. -input key Space => space
:space
is equal to1
or0
depending on the space bar being pressed.input mouse wheel
: returns1
,0
, or-1
depending on the state of the mouse wheel.input mouse wheel raw
: returns the raw output of the mouse wheel. Effected by speed of mouse wheel. See Microsoft Learn.input mouse button
: returns all of the mouse buttons being pressed as text.input mouse button => btns
:btns
is equal to all of the mouse buttons being pressed separated by,
. As an example, if the 'Left' and 'Right' mouse buttons were being pressed at the same time, then the output would beLeft, Right
.
input mouse button buttonName
: returns a boolean if the mouse button is being pressed. -input mouse buttob Left => click
:click
is equal to1
or0
depending on the left button being pressed.input mouse position
: returns a value of thex
andy
positions of the mouse formatted asx, y
.input mouse position X_or_Y
: returns the value of the position of the mouse axis.input mouse position x => mouse_x
:mouse_x
is equal to the x position of the mouse
The insetance
keyword is used for declaring a control. It's placed before the keyword to edit the syntax of the control declaration. The syntax, instance control properties
removes the name declaration, but requires it as one of the properties.
var i 0
loop 10 {
instance shape name:box'i', bg:[255;0;0]
i + 1
}
This is the most common use of instance
. It allows 10 different shapes to be made each with uinque names. The names of the shapes shown above would be, box0
, box1
, etc. The shape can be accessed with a variable in the name as follows, (#properties).
group boxes new
var i 0
loop 10 {
instance shape name:box'i', bg:[255;0;0]
boxes add box'i'
i + 1
}
This will add all of the shapes to a group. This can only be done with the instance
keyword because the normal way of decalring a control will check if a control already exists by that name and set it to it if it does.
The intersects
keyword was made for checking if two controls are intersecting each other. It uses Output Characters to return values. The syntax is simple: intersects conntol_1 control_2
. An example of this being used is as follows.
shape obj1
textbox obj2
intersects obj1 obj2 => touching
The label
keyword is used to create a label. It will create it to the visual output or create an instance that can be displayed to a window. The syntax is relatively simple, label name
or label name properties
. The default values for the properties are as follows. x:0
, y:0
, backcolor:[255;255;255]
, and autosize:true
.
label lb1 // create a label with default values
label lb2 x:50, y:50, text:Hello World // create a label with custom values
lb1 text:Hurray // change the properties of a label
See Properties for more details on property values.
The list
keyword is used to declare a list. A list is an array of values and is used to store and use values in the list. There is a way to create a new list new
, add a value add
, replace equals
, remove a value remove
, clear all of the values clear
, and destroy the list destroy
.
list name new
: Creates a new listlist name new : values...
: Creates a new list and adds values to itlist name add valueName
: Adds a value to the listlist name equals index valueName
: Replaces the values with the corresponding index with the value inputtedlist name remove index
: Removes a value from the list by the indexlist name clear
: Clears all of the values from the listlist name destroy
: Destroys the list making it inaccessible An example oflist
is as follows.list name split value splitter
: This will set the list to text split by the splitter value. An example,list name split Yes;No;Maybe ;
. This will set the list toYes;No;Maybe
split by the semicolon;
.
var name John Doe
list main new : Hello, 'name'
To access a value from a list, use listName:index
. An example of this being used is in the Loop Statement.
The loop
statement is used to loop through code. Its syntax is simple, loop loopTimes { }
or loop argument { }
. The statement will loop through all of the code within its brackets. It can loop by an argument or by a number. Here are some common examples of it being used.
var notQuit true
loop notQuit {
// code...
}
The code above creates a program loop which will loop until the variable notQuit
becomes false.
list values new : a, b, c, d, e, f
var i 0
loop values:length {
print values:i
i + 1
}
The code above loops through a list and prints the list's values.
The math
keyword is used to complete mathematic equations. It uses Output Characters to return the value. Here is an example,
var X 100
math X / 50 + 10 => Output
In this example, a variable named X
is created and assigned the value of 100
. Then the variable Output
is assigned to X / 50 + 10
which will return 12
.
There is Mathematical Functions that can be used inside of the segment. Here is a list of all of them,
abs(Value)
: This will return the absolute value of the value inputtedneg(Value)
: This will return the negative of the value inputtedsq(Value)
: This will return the inputted value squaredsqr(Value)
: This will return the square root of the inputted valueround(Value)
: This will return the value inputted to the nearest whole numberpow(Value,Exponent)
: This will retutn the value to the poswer of the Exponent inputtedclamp(Value,Min,Max)
: This will return the Value withen the minumum and maximum inputtedsum(Value1,Value2,etc)
: This will return the sum of all of the values inputtedavg(Value1,Value2,etc)
: This will return the average of all of the values inputtedmin(Value1,Value2,etc)
: This will return the lowest number inputtedmax(Value1,Value2,etc)
: This will return the largest number inputtedpi()
: This will return pi (π3.1415927
)
For the Math Functions, there can not be any spaces inbetween the inputs. For example, the average function, avg(100,30,80,90,20)
. In this, there can be no spaces in between the commas. Here is an example of the funtions being used,
var X 0
var BoundsEnd 100
loop isRunning {
await 100
// Movement
var Left : input key Left
var Right : input key Right
if Left : X - 10 | if Right : X + 10
// Bounds
math clamp(X,0,BoundsEnd) : X
}
In this example, A simple movement system is created with Left
and Right
movement. The code will then clamp X
in between 0
and BoundsEnd
which equals 100
.
The messagebox
keyword is used to display a message to the user through a Window's popup message. The syntax is simple, messagebox
title text`.
A method is code that can be called from anywhere in the program. Its syntax is as follows, method name
or method name : values
. It needs endmethod
to end the method. If there is no endmethod, then the program will give an error and will not run. Here is an example,
method Start
//code...
endmethod
If there is one method in the program, then all code needs to be in methods. The startup method is the first method in the startup file. It is usually named start
, but it could be anything.
The way methods with values work is it takes values and there default value, method name : val1:defaultVal, val2:defaultVal
. A method will also return the variables given into the method. Here is an example of a method with values,
method Start
var Value 10
Clamp : Value, 0, 5
// value is now equal to 5. It got clamped between 0 and 5.
endmethod
method Clamp : value:0, min:0:, max:0
if value < min : value = min
if value > max : value = max
endmethod
In this example, the Clamp
method takes 3 values, value
, min
, and max
. When it is called, the variable Value
is put into the method. The method can change any variable put into it. So Value
will then be set to 5
becaue it was 10
and was clamped between 0
and 5
.
A method without values can be called like this,
method Start
ExampleMethod
endmethod
method ExampleMethod
// code...
endmethod
here are the various ways to call a method:
methodName
This will call a method that has not input values.methodName : val_1, val_2
This will input the values into a method. The inputted value can be a variable or any value. If it is a variable, the variable can be manipulated by the method like in theClamp
example above.methodName => var_1, var_2
This will create variables from the method. This is why the method has default values.
Here is a great example of methods being used:
method Start
global var running true
loop running {
await 10
INPUTS => left, right, up, down, space
if space : Jump
}
endmethod
method INPUTS : l, r, u, d, space
l : input key Left
r : input key right
u : input key up
d : input key down
space : input key space
var quit : input key escape
if quit : running = false
endmethod
method Jump
// Handle Jumping
endmethod
The print
keyword has the simple function of printing values to the console. The syntax is simple, print text...
. Here is a simple example.
var name John Doe
print Hello, `name`
The shape
keyword is used to create a shape. It will create it to the visual output or create an instance that can be displayed to a window. The syntax is relatively simple, shape name
or shape name properties
. The default values for the properties are as follows. backcolor:[0;0;0]
, x:0
, y:0
, width:50
, and height:50
.
shape shp1 // create a shape with default values
shape shp2 x:50, y:50 // create a shape with custom values
shp1 width:150 // change the properties of a shape
See Properties for more details on property values.
The sound
keyword is used to create an instance of a sound player. Here is the syntax.
sound stopall
: Stops all sounds playingsound volume value
: Sets the volume of all sounds (0 - 1)sound name new filepath
: Creates a new sound instance from the filesound name play
: Plays the soundsound name playloop
: Plays the sound in a loopsound name stop
: Stops the soundsound name destroy
: Destroys the sound completely
The stop
keyword is used to stop a file, method, or entire EZCode program.
stop all
: This stops the entire EZCode program.stop return
: This will stop the current method or file that was being played from another file or method.
Here is an example of stop return
:
method Start
Next
print end
endmethod
method Next
stop return
print next
endmethod
This will stop the method before it prints next
while still printing end
in the first method.
The textbox
keyword is used to create a textbox. It will create it to the visual output or create an instance that can be displayed to a window. The syntax is relatively simple, textbox name
or textbox name properties
. The default values for the properties are as follows. x:0
, y:0
, width:75
, height:50
, and backcolor:[255;255;255]
.
textbox tbox1 // create a textbox with default values
textbox tbox2 x:50, y:50, text:Hello World // create a textbox with custom values
tbox1 text:John Doe // change the properties of a textbox
See Properties for more details on property values.
The var
keyword is used to create a variable. A variable is an instance that holds a value. It has very simple syntax, var name value
or var name : code_output
. Here are some examples,
var name John Doe
: This creates a variable namedname
and sets its value toJohn Doe
var readFile : file read ~/text.txt
: This creates a variable namedreadFile
and sets its value to whatevertext.txt
contains.
var pos_x 50
var pos_y 25
shape Player x:pos_x, y:pos_y
var KeyInput : input key
Var's value can be changed with the =
, +
, -
, /
, or :
. Here are some examples.
var x 0
loop 50 {
x + 1
}
var text
text = Hello World
var Up 0
Up : input key up
To be specific, +
(adds to end of text), -
(subtracts characters from end of text. For example: txt - 5
this removes the last 5 characters from txt
), and =
(sets text) can be used for text and -
, +
, =
, *, and
/` can be used for numbers.
The window
keyword is used to create a window. A window is a WinForms window. The syntax is as follows. Create a new window new
, change the properties change
, clear controls in window clear
, open the window open
, close the window close
, display a control on the window display
, destroy the window destroy
.
window name new
: Creates a new windowwindow name new : properties...
: Creates a new window and sets it's propertieswindow name change : properties...
: Changes the window's propertieswindow name clear
: Clears all of the controls from the windowwindow name open
: Opens the windowwindow name close
: Close the windowwindow name display controlName
: Display a control to the windowwindow name destroy
: Destroys the window making it inaccessible (does not affect the controls) See Properties for more information on properties Windows are accessible from any method. There is noglobal window
.
Special Keywords modify the code. The are started with #
. The #
can be connected or seperated by a space to the keywords (#suppress error
or # suprress error
). Here is the list of the Spcial Keywords.
This is used to suppress an error from showing in the console. It is used at the end of the line of code that might create an error. It's syntax is simple, # suppress error
. Here is an example.
var Number : input console
var NewNumber (Number * 2) # suppress error
This example gets input from the console. It then tries to multiply it by 2. If an error occurs, like if Number
is a text value, it will not create an error in the console.
This is used to create an error to the console. It can be used in its own line, or after a line of code. Here is the syntax, # create error
or # create error Error Text
. If no error text is supplied, it will output, An error occured in Segment <Code_Line>
. If Error text is supplied, it will output the text exactly.
This will set the current file that is being played. It is really only used in the background by the Player to tell the code what file is currently being played. The syntax is simple, # current file URL_PATH
.
This is used to set the project properties without using an EZProj file. This is mainly used by the Player to set the Project properties from the EZProj file. The syntax is, # project properties : properties...
The properties are syntaxed like control's properties with, propertyName:Value
. Here is an example,
# project properties : name:Project Properties Test, isviusal:true
All the properties are the EZProj Properties.
This is used to start and end EZText. Here is an example,
print This is EZCode
# eztext start
Write This is EZText to the console.
# eztext end
print This is EZCode
If there is no # eztext end
then it will just assume the rest of the document is EZText.
Properties are the different values a control or window has. Properties are separated by commas. The value is set with colon. shape name x:50, y:50
.
id
: This is used for having another way of identifying a control. This can be used to check what control it is, or to call the control using the id.-
shape name id:shape1 shape1 x:50
-
focus
: This is used to set the control as the focus control. Takes argument.font
: This is used to change the default font of the window. Syntax is as so:font[Font_Name;Size;Style]
. TheFont_Name
is the name of the font (example:Arial
. Uses fonts allowed by Microsoft).Size
is the size of the font (example:12
). Can not be negative size.Style
is likebold
,regular
,underline
,italic
, orstrikeout
.readonly
: This is used only for textboxes. It will make the user unable to change the text of the textbox. Takes argument.enable
: This will enable or unenable the control. Takes argument.font
: This is used to change the font of the control. Syntax is as so:font[Font_Name;Size;Style]
. TheFont_Name
is the name of the font (example:Arial
. Uses fonts allowed by Microsoft).Size
is the size of the font (example:12
). Can not be negative size.Style
is likebold
,regular
,underline
, orstrikeout
.label name text:Hello World, font:[Consolas;15;Bold]
point
orpoints
: This is only used for shapes. It is for setting custom points of the shape. The syntax is as follows:points:[(0*0);(50*0);(50*50)]
. The whole thing is inside[ ]
. Each point is separated by;
. Each position is separated by*
. The example shown creates a right triangle with the points (0, 0), (50, 0), and (50, 50).autosize
orauto
: This is used with the text property. It sets the control's size to match the size of the text. Takes argument.multiline
ormulti
: This is only used for textboxes. Sets if the textbox is allowed to be multi lined. Takes argument.wordwrap
orwrap
: This is only used for textboxes. Sets if the text allows scroll or wraps around to the next side. Needsmultiline
to be true. Takes argument.verticalscrollbar
orvertical
: This is only used for textboxes. Sets if the vertical scrollbar should show on the textbox. Needsmultiline
andwordwrap
to be true. Takes argument.horizantalscrollbar
orhorizontal
: This is only used for textboxes. Sets if the horizontal scrollbar should show on the textbox. Needsmultiline
andwordwrap
to be true. Takes argument.text
ort
: The text the control shows. Only applies to button, textbox, or label. Takes any text.x
: The x position of the control. Takes a number.y
: The Y position of the control Takes a number.height
orh
: The height of the control. Takes a number.width
orw
: The width of the control. Takes a number.backcolor
,bc
, orbg
: This controls the backcolor of the control. It's syntax is as follows:bg:[R;G;B]
. The rgb values need to be 0 - 255.forecolor
,fc
, orfg
: This controls the forecolor of the control. It's syntax is as follows:fg:[R;G;B]
. The rgb values need to be 0 - 255.poly
orp
: This is the polygon count for shapes. Lowest is 3 (being a triangle) and there is no max. Takes a number.image
: This is the background image of the control. It takes in a file URL. If the url is not a local path, then replace theC:\
withC\;/
and all of the other backslashes\
to forward slashes/
.imagelayout
: This is the image layout of the control. It takes one of the following options,tile
,center
,zoom
,none
, orstretch
.align
: This will align the text only in labels and buttons. It takes one of the following,topleft
,topcenter
,topright
,middleleft
,middlecenter
,middleright
,bottomleft
,bottomcenter
, orbottomright
to align the text.name
: The name of the control. Takes any text.visible
: If the control is visible.anchor
: Anchors the control to the Window. If the window resizes, then the control will resize with it. It Acceptsnone
,left
,right
,top
, and/ordown
. It always needs one vertical and one horizantal. If none are given, it will revert toleft
ortop
.
focus
: This is used to set the window as the focus window. Takes argument.enable
: This will enable or unenable the window. Takes argument.font
: This is used to change the default font of the window. Syntax is as so:font[Font_Name;Size;Style]
. TheFont_Name
is the name of the font (example:Arial
. Uses fonts allowed by Microsoft).Size
is the size of the font (example:12
). Can not be negative size.Style
is likebold
,regular
,underline
,italic
, orstrikeout
.autosize
orauto
: This sets the window's size to match the controls within it. Takes argument.text
ort
: The text the window shows. Takes any text.x
: The x position of the window. Start position needs to be set to manual (startposition:manual
). Takes a number.y
: The Y position of the window. Start position needs to be set to manual (startposition:manual
). Takes a number.minheight
: The minumum height of the window. Takes a number.minwidth
: The minumum width of the window. Takes a number.maxheight
: The maximum height of the window. Takes a number.maxwidth
: The maximum width of the window. Takes a number.height
orh
: The height of the window. Takes a number.width
orw
: The width of the window. Takes a number.backcolor
,bc
, orbg
: This controls the backcolor of the window. It's syntax is as follows:bg:[R;G;B]
. The rgb values need to be 0 - 255.forecolor
,fc
, orfg
: This controls the forecolor of the window. It's syntax is as follows:fg:[R;G;B]
. The rgb values need to be 0 - 255.image
: This is the background image of the window. It takes in a file URL. If the URL is not a local path, then replace theC:\
withC\;/
and all of the other backslashes\
to forward slashes/
.imagelayout
: This is the image layout of the window. It takes one of the following options,tile
,center
,zoom
,none
, orstretch
.opacity
: This sets the opacity of the window and all of the controls in it.minimizebox
: This sets if the window shows the minimize box as an option for the window. Takes argument.maximizebox
: This sets if the window shows the maximize box as an option for the window. Takes argument.showicon
: This sets if the window should show the icon at the top left corner of the window. Takes argument.showintaskbar
: This sets if the window should show the icon in the taskbar. Takes argument.icon
: This is the icon of the window. It takes in a file URL. If the URL is not a local path, then replace theC:\
withC\;/
and all of the other backslashes\
to forward slashes/
.state
: This sets the state of the window,maximized
,minimized
, ornormal
.type
: This sets the type of window,none
: no top bar and can't move or resizefixed3d
: has a slight 3D look on border. Can't resizefixeddialog
: makes user unable to click any other window in the program until the window closes. Can't resizefixedsingle
: can't resizefixedtoolwindow
: makes window a tool window (no icon and only X button on top right) and can't resizesizable
: normal windowsizabletoolwindow
: makes window a tool window (no icon and only X button on top right)
startposition
: The start position of the window whenever the window opens.manual
: manually set the position withx
, andy
center
: sets the start position to the center of the screendefault
: sets the start position to the window's default (also default value of window)defaultbounds
: sets the start position to the window's default bounds position.
Arguments are a boolean value (true or false) that can be obtained from various options. First option is just inputting true
, false
, yes
, no
, y
, n
, 1
, or 0
as the value. These can be obtained from variables,
var running true
if running : // code
Another option is using the Question Mark Syntax.
If the argument is inside an if statement, then the argument uses a conditional statement.
The Question Mark Syntax uses ?(condition)?
to get an argument. Inside these parenthesis, there can be a condition statement like, ?(x = 5)?
. In this example, if x
is equal to 5
, then it will return true, else it will return false.
A condition is when multiple values are compared. The conditional characters can be used =
(equal), >
(greater than), <
(less than), or !
(not). A combination can be used, >=
which is greater than or equal to. To add multiple statements together, and
(also &
), or or
can be used. As an example, if x > 10 or y > 10
will return true if x
or y
are greater than 10. Another example, if x <= 0 and x ! -5
will return true if x is less than or equal to 0 and not -5. !
can also be used with a boolean, if ! running
will return true if running
is false.
Output characters is a special syntax to output value from a line of code that allows it. Input, file, intersects all give an output. There are 3 ways to get the output.
code => var
:=>
this will goes after the line of code and will create a variable with the output.file read ~/file.txt => contents
, in this example a file is read and the contents is outputted to new variable namedcontents
.code : var
::
this will goes after the line of code and will set the corresponding variable to the output.intersects ob_1 ob_2 : collision
, in this example, the code will check ifob_1
andob_2
intersect. It will output the value to a preexisting variable namedcollision
.var : code
::
this will goes before the line of code and will set the variable to the output.var keys : input key
, in this example, the code will get the keyboard input and set the value to the variablekeys
. This can also go to a preexisting variable,Left : input key Left
.
Comments are apart of the code that doesn't run. It is started with //
and the rest of that line is excluded from bing executed. Here is an example, print Hello World // This outputs to the [console](Programs.md#console) 'Hello World' and doesn't output anything after the '//'
.
Each line of code is seperated by a newline, or the pipe character |
. Here is an example,
var text Hello World | print 'txt'
Go to Segments to learn about what counts as a segment.
A special character is a set of characters that output a different character. This can be used in any text input part of code. For example, var text Hello,\nJohn Doe
. In this example, \n
outputs as new line. Therefore, text
outputs as:
Hello,
John Doe
Here is the list of special characters.
@s:
: If at beggining of text, gets litteral textprint @s: No\_Space 'X'
: This will printNo\_Space 'X'
.
\!
: Value is nothing ''btn text:\!
: This sets a control namedbtn
text to nothing.
\n
: Value of newlineprint Hello\nWorld!
: This outputs to the console:-
Hello World!
-
\_
: Value of space ' 'file write Hello\_World C:\path.txt
: This writesHello World
to a file.
~\
or~/
: Uses local pathfile play ~\file.ezcode
: This is used for local paths for the current file being played.
\;
: Value of colon ':'if \; = whatever :
: The\;
is changed to a:
and is allowed by the if statement (only 1 colon for the line of an if statement).
\q
: Value of equal sign '='var txt a\_\q\_b
: The\q
is changed to=
. Althoughvar txt a = b
could also output the same thing.
\c
: Value of comma ','label name text:Hi\c everybody!
: This creates a label and sets its text toHi, everybody!
and doesn't mess up the properties by using a comma.
\e
: Value of exclamation mark '!'var name \e
: The\e
is changed to!
. Althoughvar name !
could also output the same thing.
\p
: Value of period '.'. No great use for this except in EZText\$
: Value of pipe '|'print Agency \$ Thing
: This outputsAgency | Thing
without causing an error of there be a pipe|
character separating the lines of code.
\&
: Value of semicolon ';'var semi \&
: The\&
is changed to;
. Althoughvar semi ;
could also output the same thing.
\-
: Returns a value with the '-' taking out the character before itvar val h3 | val = 'val'\-
: This will outputh
by subtracting the last character fromh3
.
\"
: Value of single quote '''var val hello | print \"'val'\"
: This will output'hello'
.
\->
: Value of->
. This is necessary because of Arrow Continuing Code.print value \-> 10
: This outputsvalue -> 10
.
\(
and)\
: Solves equation inside of the backslashed parenthesis. This is used for Text valuesprint Value = 10 + 10 = \10 + 10\ Hurray! // outputs 'Value = 10 + 10 = 20 Hurray!'
: This can be put inside of text to have an equation made withen the text.
(
and)
: Solves equation inside of the parenthesis. This is used for Number values- `var X (10 - 5) // X will equal to the equation from the brackets.
'variable'
: writes out the value of the variablevar val Hello | print 'val' World!
: This gets a variable inside of text input.
The ->
modifier extends the line of code to the next line. It is placed at the end of the code that you want to seperate between multiple lines. Here is an Example,
print Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod tempor incidunt ->
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrum exercitationem ->
ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.
This will output in one line, instead of seperate lines. It is only used if the line of code is long and it looks better to put it on multiple lines. It comines the segments and only counts as one segment.
References are values that can be referenced by the code. The syntax is owner:valName
. Examples of this being used:
print Hello, system:machine:username
This will output Hello, <USER_NAME>. If your Window's User Name was, jbrosdev
, then it would output Hello, jbrosdev
.
shape s x:50, y:50
print X = s:x
The creates a shape and prints its X value.
Variables, Lists, and Groups each have length
reference which returns the length of the value.
- group:
length
returns how many controls are in the group
- variable:
length
returns the length of characters of the valuecontains
returns1
or0
if the value is in the variable
- list:
length
returns how many values are in the listcontains
returns1
or0
if the value is contained in the list
var val abcdef
var Leng val:length
// returns 6
var val abcdef
var Con val:contains:abc
// returns 1
Here is a tree graph made from all of the system values. Use the path as reference and join each with a :
. For example, if trying to get to time's utcnow
, get the path and use a colon inbetween each directory, system:time:utcnow
.
-
system
:-
time
: if justsystem:time
, then it is routed tosystem:time:now
-
time
today
:MM/DD/YYYY HH:MM:SS AM/PM
Gets date and then 12:00:00 AM (Start of the day).now
:MM/DD/YYYY HH:MM:SS AM/PM
Gets date and time.utcnow
:MM/DD/YYYY HH:MM:SS AM/PM
Gets UTC (Coordinated Universal) Date and Time.unixepoch
:MM/DD/YYYY HH:MM:SS AM/PM
Gets the Unixepoch (January 1st, 19701/1/1970 12:00:00 AM
).hour24
:HH
Gets the current hour (24 hour system).hour
:H AM/PM
Gets the current hout (12 hour system).minute
:00
Gets the current minute.second
:00
Gets the current second.milisecond
:000
Gets the current milisecondnownormal
:MM/DD/YYYY HH:MM AM/PM
Gets date and time (not seconds).now24
:MM/DD/YYYY HH:MM:SS
Gets date and time with 24 hours system.date
:MM/DD/YYYY
Gets the current date.datedash
:MM-DD-YYYY
Gets the current day.month
:MMMM
Gets the current month (name).monthnumber
:MM
Gets the current month (number).day
:DD
Gets the current day (number).dayname
:DD
Gets the current day (name).
-
random
: Gets a random number between the next two numbers given,system:random:0:10
. This will give a number between 0 and 10. -
random
single
: Gets a random decimal between 0 and 1.
-
machine
machinename
: Gets the computer's name.osversion
: Gets the operating system's name and versionis64bitoperatingsystem
: Gets if the machine is a 64 bit operating system.username
: Gets the User's Username.workingset
: Gets the machine's working set.hasshutdownstarted
: Gets if the machine has started shutting down.
-
isnumber
: Returns 1 or 0 if the input given is a number,system:isnumber:inputvalue
.-
print Input a number! var [console](Programs.md#console)Input : input [console](Programs.md#console) var isNumber system:isnumber:[console](Programs.md#console)Input
-
-
currentfile
: Returns the current file path that is being played. If the file is unkown, returns empty. -
currentplaydirectory
: Returns the current path of the executable file that is playing the EZCode. -
space
: Returns a space character. Same as\_
(see Special Characters) -
newline
: Returns a new line. Same as\n
(see Special Characters) -
pipe
: Returns a pipe character. Same as\$
(see Special Characters) -
nothing
: Returns nothing. Same as\!
(see Special Characters)
-
These are the list of all of the property references for controls controlName:propertyReference
.
id
: Returns the control's ID.x
: Returns the control's X position.y
: Returns the control's Y position.w
orwidth
: Returns the control's width.h
orheight
: Returns the control's height.backcolor
,bc
, orbg
: Returns the control's backcolor. Formatted asR, G, B
.backcolor-r
orbcr
: Returns the control's red value backcolor.backcolor-g
orbcg
: Returns the control's green value backcolor.backcolor-b
orbcb
: Returns the control's blue value backcolor.t
ortext
: Returns the control's text.forecolor
,fg
, orfc
: Returns the control's forecolor. Formatted asR, G, B
.forecolor-r
orfcr
: Returns the control's red value forecolor.forecolor-g
orfcg
: Returns the control's green value forecolor.forecolor-b
orfcb
: Returns the control's blue value forecolor.click
: If the control is a button, it will return if it is currently being clicked.font
: Returns the control's font. Formatted asFont_Name, Font_Size, Font_Style
. Example,Arial, 12, Bold
.fontname
: Returns the control's font name.fontsize
: Returns the control's font size.fontstyle
: Returns the control's font style.point
orpoints
: If the control is a shape, it returns the custom points set for the control. Formatted as{X=X_point1, Y=Y_point1}, {X=X_point2, Y=Y_point2}, etc...
.auto
orautosize
: Returns the control's auto size property.multi
ormultiline
: If the control is a textbox, it will return the multiline property.wrap
orwordwrap
: If the control is a textbox, it will return the wordwrap property.vertical
orverticalscrollbar
: If the control is a textbox, it will return the horizantal scrollbar property.horizantal
orhorizantalscrollbar
: If the control is a textbox, it will return the vertical scrollbar property.p
: orpoly
: If the control is a shape, it returns the polygon count.z
orzindex
: Returns the control's Z index. The Z index is the order what controls are over others. When using thebringto
property, this can be effected, as well as when creating a control.focused
: Returns if the control is focused.enabled
: Returns if the control is enabled.readonly
: If the control is a textbox, it will return the readonly property.image
: Returns the control's Background image's file path.imagelayout
: Returns the control's image layout.name
: Returns the control's name
These are the list of all of the property references for windows windowName:propertyReference
.
id
: Returns the window's ID.x
: Returns the window's X position.y
: Returns the window's Y position.w
orwidth
: Returns the window's width.h
orheight
: Returns the window's height.backcolor
,bc
, orbg
: Returns the window's backcolor. Formatted asR, G, B
.backcolor-r
orbcr
: Returns the window's red value backcolor.backcolor-g
orbcg
: Returns the window's green value backcolor.backcolor-b
orbcb
: Returns the window's blue value backcolor.t
ortext
: Returns the window's text.forecolor
,fg
, orfc
: Returns the window's default forecolor. Formatted asR, G, B
.forecolor-r
orfcr
: Returns the window's red value for the defaul forecolor.forecolor-g
orfcg
: Returns the window's for the defaul forecolor.forecolor-b
orfcb
: Returns the window's for the defaul forecolor.font
: Returns the window's default font. Formatted asFont_Name, Font_Size, Font_Style
. Example,Arial, 12, Bold
.fontname
: Returns the window's default font name.fontsize
: Returns the window's default font size.fontstyle
: Returns the window's default font style.auto
orautosize
: Returns the window's auto size property.focused
: Returns if the window is focused.enabled
: Returns if the window is enabled.image
: Returns the window's Background image's file path.imagelayout
: Returns the window's image layout.minimizebox
: Returns if the window's minimize box is enabled.maximizebox
: Returns if the window's maximize box is enabled.showicon
: Returns if the window shows its icon in te top left corner.showintaskbar
: Returns if the window shows its icon in the taskbar.icon
: Returns the window's icon as a path.state
: Returns the windows state.startposition
: Returns the windows default start position.type
: Returns the windows type.maxwidth
: Returns the max width of the window.maxheight
: Returns the max height of the window.minwidth
: Returns the minumum width of the window.minheight
: Returns the minumum height of the window.opacity
: Returns the opacity value of the window.
A Segment is each "line" of code. A segment includes, a line of code, each side of a |
(go to Code Seperation), and comments. It does not include an empty line, or if there is nothing in between |
. It also doesn't include Arrows ->
that combine lines. Here is an example to explain it better.
print Segment 1
// This is Segment 2
print This is Segment 3 because the line above it is empty
||||||
var val Segment 4|// Segment 5
print A lot of text. ->
This is the same line ->
as the one above.
print Segment 6
loop 10
{ // Segment 8
// Segment 9
} // Segment 10
Errors are the way EZCode communicates that something wrong is with the code. If it can, it will explain what is wrong, and maybe how to fix it. Depending on the Project Properties, it may include what file the error is in, Method it is in, and also what Segment it is in. Here is an example of an error, C:\Directorty\file.ezcode - Method : (ex00) Error Message in segment 1 : line of code
. The first part of the error is the file and method. The middle is the error id, the message, and the segment. The last bit is the segment of code that caused the error. If none is there, then EZCode does not know why the error occured.
If there is an error that is just a message and keeps the program from running, it is because the methods aren't set up properly. Here is an example, Expected a method for a 'endmethod' in around segment {SEGMENT}
Directory
An unknown error occured.
$"An error occured"
An error occured with a keyword. Very broad and not specific.
$"An error occured with '{keyword}'"
Naming Violation with control, variable, list, or group.
$"Naming violation, '{name}' can not be used as a name"
Could not find control by that name.
$"Could not find a Control named '{name}'"
Could not find a Variable or Sound Player ny that name.
$"Could not find a Variable or Sound Player named '{name}'"
Could not find a Group by that name.
$"Could not find a Group named '{name}'"
Could not find a Window by that name.
$"Could not find a Window named '{name}'"
Naming violation. There is already a variable, control, list, or group named that.
$"Naming violation, there is already a '{keyword}' named '{name}'"
Unable to solve the equation.
$"Unable to solve the equation"
Cannot name that variable, list, control, or group to that because there is already a method named that.
$"Can not name '{keyowrd}' as '{name}' because there is a method already named '{name}'"
If if
or else
does not have a :
after it (see if or else).
$"Expected ':' for '{keyword}'"
If if
can only have one :
in the segment (see if).
$"Expected only one ':' for '{keyword}'"
Expected control after instance
$"Expected 'textbox', 'label', 'button', or 'shape' after {keyword}"
Expected the correct declaration after global
$"Expected 'var', 'list', 'group', 'instance, 'textbox', 'label', 'button', or 'shape' after {keyword}"
Could not find the inputted file.
$"The file, '{file}' does not exist"
Expected the correct word for syntax.
$"Expected {words}"
$"Expected {words} for {keyword}"
Expected the correct word after the special keyword
$"Expected '{word}' keyword after '#{keyword}'"
Error from EZText.
Error when making a control equal to another control, for example, shp1 = shp2
.
$"An error occured when setting '{control.Name}' to '{SettingControl}'"
Error setting parameter when calling methods.
$"Error setting the parameters for '{method.Name}'"
Expected the output characters after calling the method.
$"Expected ':' or '=>' to set parameters for '{method.Name}'"
Could not find a keyword, variable, control, list, or group by that name.
$"Could not find a keyword, variable, control, list, or group named '{keyword}'"
Error solving math value. For example, math sqr(0)
.
$"Error solving '{value}' with the value '{eq}' with '{keyword}'"
$"Error solving '{value}' with the values '{eq}'. Try removing spaces between values, '{SYNTAX}'. This is with '{keyword}'"
Error solving math value because there was not the right amount of values inputted.
$"Expected {MANY} parts for {FUNCTION} function with '{keyword}'. Correct Syntax, '{SYNTAX}'"
Expected value to be in between 0 and 1.
$"Expected {PROPERTY} value to be withen 0 and 1"
Error setting icon or image to control or window.
$"An error occured setting the icon to '{name}'"
Errors with setting font to control or window.
Not a valid font name,
$"'{fontname}' is not a valid font. Try 'Arial' or go to https://learn.mcrosoft.com for more information about supported WinForms fonts. Exception for '{name}'"
Not a valid font size,
$"Expected a number greater greater than zero for font size value"
Not a valid font style
$"'{fontstyle}' is not a valid font style. Valid styles are: Regular, Bold, Italic, Underline, Strikeout.. Exception for '{name}'"
Requires a set or minumum amount of values withen []
for property.
$"Requires 3 values for {PROPERTY}"
$"A minumum of 3 points required for the {TYPE} '{name}'"
Requires value to be incased in []
. For example, bg:[0;0;0]
$"Expected '[' and ']' for {PROPERTY} value"
the inputted property name is not a valid property.
$"'{property}' is not a correct property for '{name}'"
Needs :
to initialize value/s to set.
$"Expected ':' to initialize values to the {TYPE}"
If there is no closing bracket }
after openning bracket {
for loop, if, or else
$"Expected closing bracket for '{keyword}'"
Missing value/s to set type.
$"Missing values to set to the {TYPE}"
$"Expected values to set the {TYPE}"
Expected a type of variable
$"Expected a list variable"
$"Expected a number Variable"
$"Expected a boolean Variable"
Missing a value or index to remove from list or group
$"Expected an index or a value to remove from the list"
$"Expected an index or a value to remove from the group"
Error splitting values to list.
$"Error splitting values to list"
An error setting the variable to the correct value.
$"There was an error setting the variable to the correct value"
$"There was an Error with changing '{var.Name}'"
There was an error with ?()?
$"There was an error with ?( boolean )?"
Expected variable name after output character
$"Expected new variable name after '=>' for '{keyword}'"
$"Expected new variable name after ':' for '{keyword}'"
The minumum value can not be greater than the maximum value for system:random
$"Minumum can not be greater or equal to the max in 'system:random'"
Only certain control/s has the property
$"Only {CONTROLS} have '{PropertyName}' property"
Expected a value to check if it contains, listName:contains:value
$"Only {CONTROLS} have '{PropertyName}' property"
Expected a the correct control type.
$"Expected '{controlType}'"
$"Expected '{controlType}' for '{control.Name}'"
A control aready has the ID inputted
$"A control already has the id: '{id}'. For control '{control.Name}'"
The instance keyword needs to have name:
property.
$"Control instance created has no name. Please add the name property, `name:`, to the control"
Error with setting points for shape.
Expected 2 values for point (x and y).
$"Expected 2 values for a single point in points value"
Expected parenthesis to hold point in.
$"Expected '(' and ')' for points value"
Expected )
to end the equation.
$"Syntax error. Expected ')' to end equation."
An error while finding the methods.
$"An error occured while finding and setting methods. C# ERROR MESSAGE:'{ex.Message}'"