-
Notifications
You must be signed in to change notification settings - Fork 0
Command‐Guide
GdStepan2 edited this page Apr 12, 2026
·
1 revision
English: This project was created with the help of ChatGPT. Review commands and behavior before using them in real environments.
Русский: Этот проект создан с помощью ChatGPT. Перед реальным использованием проверьте команды и их поведение вручную.
- Core Output and Variables
- Math Commands
- Conditions and Loops
- Strings and Collections
- Files and JSON
- System and Utility Commands
- Special Import Modes
- Examples
| Command | Purpose | Example |
|---|---|---|
say |
Print text or expression result | say "Hello" |
set |
Create or update variable | set a = 10 |
del |
Delete variable | del a |
copy |
Copy value into another variable | copy b = a |
swap |
Swap values between variables | swap a b |
typeof |
Save value type name | typeof t = a |
say "Hello from GdPy"
set a = 2
set b = 3
set total = a + b
say total
| Command | Purpose | Example |
|---|---|---|
add |
Add to variable | add a 5 |
sub |
Subtract from variable | sub a 1 |
mul |
Multiply variable | mul a 2 |
div |
Divide variable | div a 4 |
mod |
Modulo | mod a 3 |
pow |
Power | pow a 2 |
len |
Store length | len size = items |
set a = 10
add a 5
mul a 2
div a 3
say a
| Command | Purpose | Example |
|---|---|---|
if |
Start condition | if a > 5: |
elif |
Extra condition branch | elif a == 5: |
else |
Fallback branch | else: |
endif |
End condition block | endif |
while |
Start while loop | while a > 0 |
endwhile |
End while loop | endwhile |
for |
Loop through sequence | for item in items |
endfor |
End for loop | endfor |
break |
Exit loop | break |
continue |
Skip to next loop step | continue |
set count = 3
while count > 0
say count
sub count 1
endwhile
if total > 10:
say "big"
elif total == 10:
say "equal"
else:
say "small"
endif
| Command | Purpose | Example |
|---|---|---|
append |
Add item to list | append items 5 |
extend |
Extend list | extend items other |
insert |
Insert into list | insert items 1 99 |
remove |
Remove item | remove items 99 |
pop |
Pop item | pop items |
clear |
Clear variable or console |
clear / clear = a, b
|
sort |
Sort list | sort items |
reverse |
Reverse list | reverse items |
unique |
Remove duplicates | unique items |
split |
Split text | split parts = text by "," |
join |
Join list to string | join line = parts by " / " |
replace |
Replace text | replace t = text old "a" new "b" |
upper |
Uppercase text | upper loud = text |
lower |
Lowercase text | lower soft = text |
strip |
Trim spaces | strip clean = text |
set text = " hello,world "
strip clean = text
split parts = clean by ","
join line = parts by " | "
say line
| Command | Purpose | Example |
|---|---|---|
readfile |
Read UTF-8 file | readfile t = "note.txt" |
writefile |
Write UTF-8 file | writefile "note.txt" with "hello" |
appendfile |
Append text to file | appendfile "note.txt" with "more" |
exists |
Check path exists | exists ok = "note.txt" |
mkdir |
Create folder | mkdir "data" |
listdir |
List folder content | listdir items = "data" |
readjson |
Read JSON file | readjson cfg = "config.json" |
writejson |
Write JSON file | writejson "config.json" with data |
mkdir "data"
writefile "data/note.txt" with "hello"
readfile note = "data/note.txt"
say note
| Command | Purpose | Example |
|---|---|---|
wait |
Sleep in seconds | wait(1) |
ask |
Ask input | ask name "Your name?" |
help |
Show command help | help |
dump |
Show variables/modules | dump |
now |
Save current datetime | now t |
today |
Save current date | today d |
assert |
Validate expression | assert total > 0 |
enter |
Wait for Enter | enter |
save |
Save screenshot | save |
screenshot |
Make screenshot | screenshot and save |
killpid |
Kill process by PID | killpid a |
dogfunny |
Fun console output | dogfunny |
end / close / stop
|
Stop program | end() |
| Import | What it enables |
|---|---|
import python |
Direct Python lines in script |
import error |
Error mode and error(...) controls |
import rights |
Rights/admin workflow |
import file |
Reserved placeholder for future file mode |
import desktop |
Desktop/system info mode |
import desktop-time |
Writes current time into variable |
import desktop-data |
Writes current date into variable |
import killpid |
Enables PID kill workflow |
import dogfunny |
Enables dogfunny
|
import screenshot |
Enables screenshot flow |
import error
error(custom)
error(off)
set boom = 10 / 0
if error == yes:
say "An error happened"
endif
error(clear)
import rights
rights(give)
if rights == yes:
say "Admin accepted"
elif:
say "No admin rights"
endif
Useful project examples:
example.gdpyexamples/arithmetic.gdpyexamples/collections.gdpyexamples/control_flow.gdpyexamples/files_json.gdpyexamples/libraries.gdpyexamples/rights_error.gdpyexamples/strings.gdpyexamples/system_fun.gdpy
- GdPy supports many aliases for commands, but the examples above use the main names.
- Some features are Windows-specific.
- Powerful features like Python mode, process control, file access, and rights handling should be used carefully.