Giter Site home page Giter Site logo

adiascript's People

Contributors

0x416c616e avatar

Stargazers

 avatar

Watchers

 avatar  avatar

adiascript's Issues

New features

New features to add:

Commands/syntax:

  • 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.

  • metaprogramming -- ability to add your own keywords and their meanings, maybe see the Oracle Compiler API?
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?

  • proceedonpress a
  • proceed on press could make the script wait until the user presses a key to continue, for situations where you need a combination of automatic and manual input

Relative to current mouse position:

  • clickrandomrelative
  • rightclickrandomrelative
  • moverrandomrelative

GUI features:

  • Ability to save current script
  • Ability to open an existing script
  • Edit -> Find next (from current cursor position?
  • Edit -> Replace all
  • Ability to change code and console text color
  • Ability to save settings
  • Ability to open previously-opened script on startup
  • Multiple script tabs?
  • 'Log to file' feature for logging every single line that is run -- it can output to two logs simultaneously: one is the literal code (clickanddragrandom 100 150 300 350 100 150 300 350) and the other logs the actual values (clickanddrag 123 334 147 301)
  • 'Advanced usage' menu item to complement the 'Basic usage' one, and it has a link to Markdown documentation on GitHub or something, which will contain more detailed info about the new commands.
  • color picker tool, similar to the "get coords" button but for hex color values

Finished new features:

  • Nested loops!!!
  • Ability to write 'infinite' instead of number for loop in "Times to repeat" section
  • alert
  • moverandom
  • clickrandom
  • clickandhold
  • releaseclick
  • rightclickandhold
  • releaserightclick
  • variable declaration
    • can actually be a class, called Variable, and it will have these properties: type (just int for now), and intValue
    • then make a HashMap<String, Variable> where the string keys are the names, i.e. "$x1" and the values are the Variable objects
  • int $x = $y (just pass-by-value at that particular line, not a second reference to the same var)
  • ability to use variables in int, click, clickrandom, rightclick, rightclickandhold, clickandhold, clickanddrag, clickanddragrandom, move, moverandom, loop, and wait
  • Console TextArea
  • Ability to print to the consoleTextArea (both literal text and variables). If it starts with $, get it from the var hashmap. If it doesn't, just print it literally.
  • When printing, if there are 10,000+ lines in the consoleTextArea, get only the last 1,000. If there are more than 20,000 characters, get the last 120,000.
  • Switch text to monospaced font
  • clear -- get rid of the current text in the console
  • change "end" to "endloop" so that all things will be consistent: if/endif, fn/endfn, class/endclass, alter/endalter, loop/endloop, etc.
  • arithmetic
  • middleclick, middleclickandhold, and releasemiddleclick
  • minimize and unminimize commands
  • random int -- example: random int $x = 100 500
  • random update $x = 100 200
  • it's only random for the declaration, but it remains the same every time it's referenced (unless it's updated or reassigned or nulled)
  • made valid-var-checking for print, println
  • CSS for dark mode/light mode for the radiobutton, tabs, and tabnode
  • destroy keyword
  • improve println performance from 50ms to 1ms with no exceptions, thanks to using Platform.runLater(new Runnable(){}
  • removed print for now because there are issues with really long lines, and the substring splicing thing for trimming the output based on total console text size got rid of all the linebreaks, messing up the output
  • Finished esoteric font feature in the advanced options window
  • Light mode/dark mode stuff for new GUI elements
  • New GUI features (stubs/unimplemented)
  • New skeleton for Advanced Options menu
  • implemented increase/decrease indent button functionality

In progress

  • BUGFIX: fix "random int $x = 100 200". Currently, it only works if you do this: "int $x = 0" followed by "random update $x = 100 200". Maybe this is because of the parse-checking stuff before it's put into the variables hashmap?
  • if/elseif/else/endif!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    • Current part of if feature to do: findNextTrueElseifOrElseOnSameIfLevel(currentIfLevel, lineNumber, lines, variables)
      • Specifically: evaluate the expression for the part where it's found a suitable elseif
      • Next: find if there is a next else block for the same if. Make sure it works for multiple elseifs in the same if block!
      • findNextEndifOnSameIfLevel
      • elseif/else/endif cases in switch statement
  • Another thing for the 'if' feature to consider: should it return the line number of the actual elseif/else, or the one after it?
  • figure out the function/aspect line number problem

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();
}
  • Note: also need to have similar logic for if/elseif/else/endif!!!

  • 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.