Skip to content

Commit 59b4b60

Browse files
authored
Update README.md
1 parent 6ece6e3 commit 59b4b60

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,84 @@ This would be a typical for- loop:
104104
The first argument of the _for [STRING] [STRING] [BLOCK]_ command is the variable name.
105105
>array = ["John" "Peter" "Chris"];<br>for i (length $array) {<br>println $array[$i];<br>};
106106
107+
## If
108+
Here is an example of an if- statement:
109+
>if (10 == 11) {<br>println "Condition is true";<br>} {<br>println "Condition is false";<br>};
110+
111+
But keep in mind, that the parantheses after the if are just wrapping another command ([ANY] == [ANY]) and are not there like in Java or other languages.
112+
>if $true {<br>println "true"<br>};
107113
## Thats it!
108114
Now, if you understand the basic syntax and command usage, you are ready to start!
109115
It may also be handy to notice, that this script also supports threading.
110116
You can use the _help_ command for a list of commands, but I will print them below, so you can have a look.
117+
118+
# The Big List
119+
<code>
120+
LIBRARY: 'Native' (65 commands)
121+
122+
println [ARRAY_ANY] Prints any object's toString() method in a new line
123+
print [ARRAY_ANY] Prints any objecs's toString() method
124+
[STRING] = [ARRAY_ANY] Defines a variable. Access it with $variableName
125+
[ARRAY_ANY] === [ANY] [STRING] [object] === [array] [index] [index] ... Like '=' for arrays
126+
[STRING] + [STRING] Adds two numbers and returns the result, if either of the arguments is not a number, two strings are added
127+
[STRING] - [STRING] Subtracts two numbers
128+
[STRING] * [STRING] Multiplies two numbers
129+
[STRING] / [STRING] Divides two numbers
130+
exec [STRING] Executes a shell command
131+
script [STRING] Executes a new script sub-process with its parent in- and outputs
132+
length [ANY] Returns the size of the array
133+
pop [ANY] [STRING] Removes the specified index of the array
134+
createdict Returns an empty dictionary
135+
get [DICTIONARY] [STRING] get [dictionary] [key] Returns the corresponding value of the key inside the dictionary
136+
set [DICTIONARY] [STRING] [ARRAY_ANY] set [dictionary] [key] [object]
137+
remove [DICTIONARY] [STRING] remove [dictionary] [key] Returns false, if there was no associated key with the name.
138+
clear [DICTIONARY] clear [dict] Removes all values from the dictionary
139+
isEmpty [DICTIONARY] Checks, if a dictionary is empty
140+
push [ARRAY_ANY] [ANY] Pushes a new value into the array
141+
[STRING] lt [STRING] Returns true, if argument 1 is less than 2 (If the arguments are not numbers, it checks the length of the string)
142+
[STRING] lteq [STRING] Returns true, if argument 1 is less or equal than 2 (If the arguments are not numbers, it checks the length of the string)
143+
[STRING] gteq [STRING] Returns true, if argument 1 is grater or equal than 2 (If the arguments are not numbers, it checks the length of the string)
144+
[STRING] gt [STRING] Returns true, if argument 1 is grater than 2 (If the arguments are not numbers, it checks the length of the string)
145+
[ANY] == [ANY] Returns true, if argument 1 and 2 are equal
146+
[ANY] != [ANY] Returns true, if argument 1 and 2 are not equal
147+
not [BOOLEAN] Inverts a boolean
148+
[BOOLEAN] and [BOOLEAN] [ANY] Chain boolean conditions: if ($true and $true or $false) {...
149+
random Returns a random number between 0 and 1
150+
[BOOLEAN] or [BOOLEAN] [ANY] Chain boolean conditions: if ($true or $true and $false) {...
151+
int [ANY] Casts the given value into java.lang.Integer
152+
float [ANY] Casts the given object into java.lang.Float
153+
string [ANY] Casts the given value into java.lang.String
154+
call [BLOCK] [ARRAY_ANY] Executes a function (Variable that is a block: x = { function code... }. You can also pass arguments. Access them inside the block with $0 $1 etc...Returns the returned value of the function
155+
if [BOOLEAN] [BLOCK] [BLOCK] If statement
156+
if [BOOLEAN] [BLOCK] If statement
157+
ifnot [BOOLEAN] [BLOCK] Inverted If-statement
158+
for [STRING] [STRING] [BLOCK] For loop: for i 10 {...}
159+
loop [BLOCK] Infinite loop. Use the break command inside it.
160+
break Breaks out of the next found loop in the stack. If no loop was found, this command interrupts the block
161+
kill [STRING] Stops the application and throws an error message
162+
input Reads input from the set input stream
163+
[ARRAY_ANY] typeof [STRING] Argument 2 is a string representation of the type like the command arguments. There are two adittional useful types: int and float
164+
wait [STRING]
165+
thread [STRING] [BLOCK] Runs a separate thread along the process
166+
kill [BLOCK]
167+
pause Pauses the block, the command is executed in
168+
pause [BLOCK] Pauses the specified block, if it is running in a separate thread.
169+
waitfor [BLOCK] Waits for a block to finish
170+
wake [BLOCK] Wakes the specified thread
171+
alive [BLOCK]
172+
return [ARRAY_ANY] Searches the first occurrence of a block that is a function and returns its given value or null (Block execution gets terminated)
173+
return [BLOCK]
174+
charAt [STRING] [STRING] [index] [string]
175+
stringLength [STRING]
176+
toArray [STRING]
177+
substring [STRING] [STRING] [STRING] [string] [begin] [end]
178+
version Prints the version of the script
179+
help Prints all the available commands with a brief explanation and arguments
180+
import [STRING] Imports a library from a compiled .jar file. The class should extend com.mygdx.devkev.devscript.raw.Library and be named CustomLibrary You can use a * to reference the current path the process is executed in (*/library.jar
181+
getFile [STRING] Returns a java.io.File object
182+
fileExists [OBJECT] Checks if a file exists
183+
deleteFile [OBJECT] Deletes a file. You can use this command, if you want to clear a files content and append lines with the writeFileLine command
184+
writeFileLine [OBJECT] [STRING] [file] [content] Appends a new line to the file
185+
listDirectory [OBJECT] Returns an array containing all files inside this directory
186+
</code>
187+

0 commit comments

Comments
 (0)