0x416c616e / adiascript Goto Github PK
View Code? Open in Web Editor NEWProgramming language and IDE for simple scripts and input macros
Programming language and IDE for simple scripts and input macros
generatemutationsequence TODO: come up with more concrete ideas for it. The idea is that it can record your mouse or take a list of coords or something and then generate code that can take that and turn it into n frames of animation, each with random changes to the values that were used previously, so instead of being 100% random, they're just permutations, and they will be printed to the console. This is one of the cooler ideas for this project.
Ability to run scripts from cli rather than the GUI?
setvarrandom $x1 upperbound lowerbound
setvarrandom $x1 100 500
clickzigzag x1 y1 x2 y2 x3 y3 ... xn yn
unsetvar $xy1
clicksequence startx starty endx endy xiter yiter
clicksequencerandom
movesequence startx starty endx endy xiter yiter
# until you press shift, it will print your x, y coordinates to the console every n milliseconds
# this can be useful for copying and pasting to make a script that moves or clicks the same way you do
# with less manual writing required
# first arg = which command to do, which can be click, rightclick, or move
# second arg = time in milliseconds
mouserecorduntilshift click 10
everything should be mutable by default -- classes, functions, variables, and even the lines of code in the script being run
setfreeze true $x or setfreeze false $x -- ability to make something mutable or immutable, but this can be changed
setpermafrost true $x or setpermafrost false $x -- ability to make something permanently mutable or immutable
forkjoinloop -- takes a loop and makes a new thread for each iteration, which runs concurrently rather than sequentially
file IO
functions and classes
basic logging functionality -- like print, but to a log file
int arrays
multi-line comments /* */
string variables
string arrays
color variables to store the hex value of a color, must start with 0x instead of # because # is already used for comments
run shell commands, can store their output as a string
run JIT-compiled Java
assign an expression to an int instead of a value. example: int $y = expr (((2 * $y) + 1)/2)
pi constant
ability to undeclare a variable, not just set it to null (although that's also an option)
aopwait: aspect-oriented programming wait; implicit wait between every function call like click, move, etc.
example: aopwait 500
ability to create aliases, like alias bye = end
ability to redefine classes during runtime
alter class $someClass
# new class stuff
endalter
ability to change functions during runtime
test and debug functions, i.e. test $x == 5, and if it's false, then the program will print the value, exit, and change the text thing at the bottom
ability to print everything in RAM, like all the classes, functions, and variables and their current values
mouse recording to generate code or at least print it so you can copy and paste it, or maybe save it to a file?
import ../relative_path/somescript.ais -- imports the code, but runs it from the first import onwards, so extra files should only be used for classes, not loose code
loop infinite for loops in the actual program, not the UI loop thing -- can break out via the exitloop function
basically, infinite loop with exitloop on condition (if $x == 5 exitloop endif) then you can basically make "while" loops
Fizzbuzz (need to implement all these features eventually):
int $i = 0
int $either = 0
loop 100
update $either = 0
if $i % 2 == 0
print fizz
update $either = 1
endif
if $i % 2 == 0
print buzz
$either = 1
endif
if $either == 0
print $i
endif
update $i += 1
end
"var" update: just use the regular ones, i.e. click, but with the $ for the variable. Example: click $x1 $y1
clickvar
movevar
rightclickvar
waitvar
loopvar
typevarnumber
distortline startposx startposy endposx endposy maxvariationfromlinex maxvariationfrmoliney incrementx incrementy
# the above will take a straight line and warp it,
exitloop
exitmainloop
exitscript
# search through x, y (100, 100) to (500, 600) for a pixel with a color of 0xffffff
# maybe use 0x instead of # because # is already reserved for comments
clickpixelbycolor 100 100 500 600 0xffffff
clickallpixelsbycolor
clickanddragallpixelsbycolor direction etc.
color arithmetic operators
printallxywithcolor 0xffffff -- prints all the x y coordinate pairs that have a certain
clickrandomfromset x1 y1 x2 y2 x3 y3 ... xn yn
The above two functions can be used along with an image that has had a 'thresholds' filter applied to it, and then you can make random dot art that looks somewhat like the original image, but with elements of randomness, and it's incomplete rather than being a solid color (just lots of dots). And you can save each extra dot as a separate image, so then you can make an animation where it reveals the image from one individual dot placement to another, eventually filling it in.
printallrelativexywithcolor 0xffffff -- same as the above printallxy but with relative rather than absolute values
# math function i.e. y = x + 2 min x 100 max x 150
clickanddragfunction
Ability to play keys (from my JavaFX Piano repo)
piano tap e
wait 500
piano tap f
wait 400
piano tap e d
wait 600
piano hold c d
wait 400
piano release d
wait 300
piano release c
wait 1000
piano hold a b c d
wait 1200
piano release all
wait 800
piano tap randomkey
wait 500
This would be for the single octave that was already implemented in the JavaFX piano program.
Would have to account for the low-vs-high stuff in the octave, like if two notes have the same name, then have one be called lowX and another called highX.
It could also be used to play arbitrary mp3s. It would be like a tracker then.
Something like this:
track $drumsample = path/to/music/drum.mp3
loop 4
audio play track1 $drumsample
wait 100
audio play track2 $bassline
wait 100
endloop
track1, track2, etc. -- there can be 8 tracks played simultaneously. Think of each one like a separate mp3 player. They can continue to play a sample even after the interpreter gets to the next line. If you do a "play track1 $sample1" line followed by another "play track1 $sample2" line, it will stop playing $sample1 and instead play $sample2. But if you did track2 instead of track1 for the second play line, then it would have them playing side by side rather than one interrupting the other.
metaprogram keyword
//Java code goes here
endmeta
implicit wait between function calls
example: autowait 100
debugstart
debugend
# debugstart means start running the script from here
# debugend means stop running the script from here, and also don't loop anymore
the debug commands allow you to run a small section of a program instead of the entire thing
Maybe change syntax? Like going from "click 500 500" to "click(500,500);"
oscillate lines?
like oscillate 10 20 2 21 means oscillate between lines 10 and 20 and back 2 times before going to line 21
invert 10 20 3 21 means run lines 10 to 20 in reverse order and then go to 21
screenshot filename
or screenshottimestamp filename
log func_1 func_2 func_3
or: log all
or: log none
# the above will log either specific commands, or everything, to a file with a timestamp
you only need one log function call per script if you want to enable it, but you can use it multiple times if you want to change it mid-script
preprocessor directives or aliases or whatever:
define end bye
define loop repeat
define real_name alias_name
functions (this idea might be out of date):
intfn $sum ( int $a int $b )
int $retval = $a
update $retval += $b
return $retval
endintfn
int $fnexample = run $sum 100 200
Event handlers/lambdas (might be doable with JNativeHook):
event a ->
move 300 400
endevent
But so that the program wouldn't end prematurely, and without having to do some weird infinite loop with wait calls, instead maybe there can be a keyword called 'listenforevents' and it just goes indefinitely? Or, maybe just scrap the keyword listener thing altogether.
Unfinished idea about metaprogramming:
metaprogram
randomtohardcoded
generatepermutationsequences 60
endmetaprogram
-Highlight current line being run?
Relative to current mouse position:
If test script:
int $x = 5
if $x == 6
println a
if $x == 2
println bad
# test with and without the next line commented out
# elseif $x == 3
println bad
endif
elseif $x == 5
println b
endif
Another if test script should have multiple subsequent ifs on the same if level, not just nested ones. This will test to make sure the NEXT elseif/else isn't picked up by accident (searching for the elseif/else should only occur on the same ifLevel BEFORE the next endif on the same level).
Functions. - How functions can be implemented: before parsing and running the code with the normal interpreter stuff, go over the whole lines array once: first, find all declared functions and put them into a hashmap. Then, find each function call and then do a find-and-replace. Might have to convert it to an ArrayList first though, because it's harder to insert things between elements in an array. But then later convert back to the lines array. And function args can also have a find-and-replace thing. Maybe use something to distinguish between function scope and global scope, like $f$varName instead of $varName. Then, after all the find-and-replace stuff is done, proceed with the normal syntax-checking and then parsing/running (the two main things for each line in lines). Maybe there will be no return values, but the args themselves will change (like pass-by-reference).
Arrays, so you can do this: int[] $x = size 100, then update $x [3] = 5. But then all the arg-position and arg-length code would have to be changed... unless maybe you can only access an array element in update, like update $intVar = $x [3] or update $intArr [3] = $intVar. Just start with int arrays.
make sure loops and ends are matched -- this will have to happen before the first syntax-checking loop
Pseudocode:
int loopLevel = 0;
boolean error = false;
for (int i = 0; i < lines.length && !error; i++) {
if (lines[i].equals("loop")) {
loopLevel++;
} else if (lines[i].equals("end")) {
loopLevel--;
}
if (loopLevel < 0) {
error = true;
}
}
if (loopLevel != 0) {
error = true;
}
if (error) {
highlightErrorLine();
}
put "do you want to save your settings before exiting the advanced options window?"
when you close the advanced options window
add always on top, word wrap, wait5sforxy, and wait5sforcolor
to the configuration class
int $x = getX or int $x = getY, update $x = getX, update $x = getY, random int $x = getX 200, random int $x = 100 getY, print getX getY, println getX getY
setprintwait -- set the wait interval for the print/println commands
make it so you can only declare something once with int $x = 123. so int has to check if it's already in the hashmap, and if so, then throw an error.
ability to get user input and store it to a variable
rightclickrandom
waitrandom
pressrandomletter
pressrandomnumber
looprandom
pressandhold
releasekey
pressmulti ctrl c
clickanddragrandomfromcurrent
type hello -- instead of doing press h, press e, press l, press l, press o, you could just write a string and use it with the type keyword, and then it will type each character one after the other
add more non-alphanumeric characters to the press command, including middle click and scroll wheel scroll up and scroll down
pressdatetime # presses the current date and time, suitable for filenames
clickanddragsequence x1 y1 x2 y2 x3 y3 ... xn yn
clickanddragsequencerandom minX1 maxX1 minY1 maxY1 minX1 maxX1 minY1 maxY1 ,,, minXn maxXn minYn maxYn
Idea about multi-threaded loops (maybe I should implement it, maybe not):
int[] $x = size 100 default 1
# concurrent control flow
threadloop $t$i -> 50
update $x [$t$i] *= $t$i
endthreadloop
Eventually need to add all the features that would be needed in order to make a bootstrapped CLI-only interpreter, so an AdiaScript interpreter could be written in AdiaScript. Things I can think of off the top of my head that it will need: arrays, file IO, regex, string manipulation, string support in general, startsWith, etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.