Feature Support for scripting in JavaScript

ikzann

Member
Oh, and I am quite sure I used svn add before generating the latest couple of patch files. If something is still not applying cleanly, please let me know.
 

fronobulax

Developer
Thanks, frono, and thanks for all the review you've done so far. Here's a patch that has rhino in a src/jar/ directory (placing the jar still needs to be done manually). Can split this up into a sequence of patches if you'd like, but i suspect it would be easier for someone with commit access to do so when we are actually ready to commit.

v6 had some bad sections or whatever it is called when a patch doesn't work. I did src/jar and rhino manually. It built but running generated lots of errors. I'm thinking the errors are in the patch are the cause but bottom line is the patch didn't completely apply.
 

ikzann

Member
Hm, it applied cleanly for me, but on double check there were some issues with the build.xml changes. Here's an updated patch. I executed the following commands to apply it. Please let me know if this does not work for you.
Bash:
svn checkout https://svn.code.sf.net/p/kolmafia/code/ kolmafia-code
cd kolmafia-code
svn patch ~/Documents/Projects/kol/old-kolmafia/javascript-v7.txt
mkdir -p src/jar
cp ~/Downloads/rhino-1.7.13.jar src/jar/
ant daily
java -jar dist/KoLmafia-20501M.jar --CLI
# js Item.get("hair spray")
 

Attachments

  • javascript-v7.txt
    425.1 KB · Views: 2

fronobulax

Developer
v7 worked.

I'm not understanding why reverting it was a multi-step process but I'm getting impatient so...

I get in trouble assuming silence is consensus but in the absence of other opinions, I am inclined to implement src/jar and the associated build changes, commit them, add the rhino jar and commit it and then commit v7. Maybe I'll do it 11/19 in the morning EST?

I note pizzable.js in the script most recently used list. Probably worth some thought at a later time about handling extensions. test, test.ash and test.js could be three different files and we should protect a user who is foolish enough to have them, as much as possible.
 

MCroft

Developer
might be nice (but not show stopping, in any way) to add some of those js Item.get("hair spray") items to the tests that ant test runs.
 

fronobulax

Developer
might be nice (but not show stopping, in any way) to add some of those js Item.get("hair spray") items to the tests that ant test runs.
We can certainly think about it but the test / JUnit environment for mafia is enough different from the one I have forgotten how to use that I'm not sure I want to reclimb the learning curve. Although there is one example of using a script in a test so...
 

MCroft

Developer
"More tests" is on my wish-list of things for the app, even though I didn't do it for my last change.
 

fronobulax

Developer
The fear of two threads confusing things was founded.


In the interest of moving ahead, lets accept the src/jar convention. I'll create the directories and check in rhino. I'm OK with the build.xml changes in the Javascript patch so I will extract them and check them in separately from the rest of the JavaScript.

The daily task made the same jar with the directory and rhino present as it did without, using the changed build so breaking things apart doesn't seem to hurt anything or even make a difference until Javascript is added.

I intend to check in both the build changes and the JavaScript changes as they exist later today, trusting that with three sets of eyeballs it is a matter of asking forgiveness, not permission :)
 

gausie

Develpoer
I have been running the latest patch and not encountering any issues at all while actually writing and running JS.

I've also been tinkering with a widely-featured library I would like to publish for mafia JS script-authors to use 👀
 

fronobulax

Developer
r20505

It built in Jenkins so I think we can shift to bug reporting and new features, both of which might deserve their own thread.

I confess I have not verified the source for adherence to formatting standards and may never do so.

I did not update .classpath since I don't need the file and there seemed to be an end of line issue.
 
Top