LostJustice wrote:shubla wrote:Current issues:
Currently graalvm does not support multithreading, so if you click a button in PBotWindow while the javascript is already running, it will crash.
Thus you cannot stop your scripts at all by clicking the button while they are running for example. May fix if I come up with some good solution to this issue.
If you have any suggestions about how the API could be improved, for example, some functions to add, please tell at the Purus Pasta discord server!
It does support multithreading. You start the thread on the java side and use the java implementation of it. Issue why it crashes it because you are not creating handling or scheduling for activating the button during the click event. Create thread -> Thread does the actual button click -> schedule and start thread.
You don't understand what I meant.
The issue is that if there is a script running, there is no way of calling function from that script instance. For example, by pressing a button in the client gui. With nashorn this was possible. Yeah there are some stupid workarounds, but they are rather ugly.
Example of how you could do in nashorn:
Run a script, have a button, and when you press the button, it executes a function from the script, changing state of the instance while it is running. Quite handy for stop buttons etc. I guess? Of course, there are possible concurrency issues, but who cares about those 8)
I don't know how other people use the API themselves, like if they used this feature or not.