Search results

  1. philmasterplus

    Bug - Fixed put_shop() coerces item quantity from float to int incorrectly

    Update: This was not a JavaScript issue, but a problem with the ASH function itself. See reply #4 and below. As such, I have renamed the thread title (previously "JavaScript: putShop() bug due to typing issues"). TL; DR: When calling putShop(), be sure to wrap the item quantity argument with...
  2. philmasterplus

    Bug available_choice_select_inputs() incorrectly parses <select> tags

    KoLmafia r20631: Due to a flawed regex pattern in ChoiceUtilities.java, the available_choice_select_inputs() function incorrectly parses certain choice adventures. For example, the Fortune Teller page contains the following HTML: <select name="which" id="which" required> ... </select> The...
  3. philmasterplus

    IntelliJ: How to enable warning messages for tests?

    I meant the IDE running static analysis in the background and highlighting errors, warnings, etc. That solved it! Thank you. P.S. When I followed the Intellij Setup instructions on the wiki, I didn't have to "Mark as Sources Root" on /src/ or /lib/; IntelliJ just did it for me, so I wasn't...
  4. philmasterplus

    IntelliJ: How to enable warning messages for tests?

    I've been following the instructions on our wiki for IntelliJ. It's been working great so far, but there's a problem: Test code in the /test/ directory are not automatically verified/linted (i.e. no IDE errors or warnings). Since code under /src/ are verified/linted automatically, I assume it's...
  5. philmasterplus

    Bug - Fixed get_stash() checks existence of shop instead of clan stash

    Just discovered this while looking at RuntimeLibrary.java in r20625: public static Value get_stash( ScriptRuntime controller ) { MapValue value = new MapValue( DataTypes.ITEM_TO_INT_TYPE ); if ( !KoLCharacter.hasStore() ) { return value; } The...
  6. philmasterplus

    Bug - Fixed JavaScript: bufferToFile() fails due to type issues (+ patch added)

    Here's a patch that special-cases bufferToFile() so that, if the first argument is a String, it is converted to a buffer (Java StringBuffer) before being passed to the actual function. It does not affect the ASH runtime in any way.
  7. philmasterplus

    Feature - Implemented JavaScript: Remove custom valueOf() implementation for enumerated types

    Here's a patch that removes the custom valueOf() implementation for all enumerated data types. Since all enumerated types now inherit Object.prototype.valueOf(), they are always transformed to a string by the ToPrimitive() operation. This patch breaks almost all JS code that relies on numeric...
  8. philmasterplus

    Feature - Implemented JavaScript: Remove custom valueOf() implementation for enumerated types

    Currently (r20617), there are three ways of retrieving the numeric ID of an enumerated data type (e.g. Item, Effect, Familiar): Using the toInt() library function Using the id property (only available for a few types) Using the custom valueOf() method The last method allows an enumerated type...
  9. philmasterplus

    Display3: A responsive three-column display case UI

    Version 0.1.2 is now available. It brings several fixes and changes, including the ones reported in reply #2. Collapse tables into 1-2 columns when the window becomes small (in v0.1.1) Remove the "multiple matches for rock" warning messages (in v0.1.1) Fix some parsing bugs Correctly render...
  10. philmasterplus

    Postmortem: Attempt at source map support

    This is a report of my failed foray into adding source map support for the JavaScript runtime. I'm putting this so that other people do not waste time like I did. TL;DR: Due to limitations of Rhino, it is impossible to add source map support for JavaScript stack traces in KoLmafia. Preamble...
  11. philmasterplus

    Crimbo 2020

    I believe your (buffed stat/base stat) ratio determines how much donations you get. Thats why it tries to pick the stat with the best ratio. And why some people were intentionally reducing their stats during early December. (Technically, the base stat part has a minimum of 100, so the "become...
  12. philmasterplus

    Feature - Implemented Escape HTML in exception messages

    Here's an alternative patch that doesn't touch KoLmafia.updateDisplay(). Instead, the JavascriptRuntime class escapes "<" and "&" in for exception messages before passing them to updateDisplay().
  13. philmasterplus

    Feature - Implemented Escape HTML in exception messages

    My suggestion doesn't touch print_html(). Script writers can still render HTML in the gCLI when they want to. This handles the case when they don't want to render HTML--when KoLmafia prints a stack trace. That said, it is possible to escape HTML before the message is passed to...
  14. philmasterplus

    Feature - Implemented Escape HTML in exception messages

    With JavaScript, we can now throw exception objects with arbitrary messages. If these error messages contain text that can be interpreted as HTML, the error message shown in the gCLI is rendered as such. This makes it hard to debug JavaScript errors. For example, suppose the following code is...
  15. philmasterplus

    Bug - Fixed (patch included) Item.seller, Item.buyer throws error in JavaScript

    KoLmafia version: r20608 Steps to reproduce Run js Item.get('wicker shield').seller in the gCLI. Expected result Same value as running js Coinmaster.get('Dimemaster') Actual result > js Item.get('wicker shield').seller Script exception: ASH function returned native Java object. Returned...
  16. philmasterplus

    Bug - Fixed Fix [wiki] link in right-click menu for items with multi-word names (updated)

    The previous patch resulted in a small conflict with r20600. I posted a fixed patch (filename philmasterplus-fix-wiki-link-renamed-2.patch) in the first post.
  17. philmasterplus

    Display3: A responsive three-column display case UI

    I don't know about a "universal" relay override, but it would require more than CSS to manipulate KoL's markup. 4-6 layers of nested tables and CENTERs...does not make a fun bed for styling. I'll be seriously impressed if you can hack it together with pure CSS.
  18. philmasterplus

    How can I ensure that a custom outfit has all the pieces?

    Ah, thank you. I only saw your reply after I edited my post. Looks like your script also handles some edge cases (e.g. display case).
  19. philmasterplus

    How can I ensure that a custom outfit has all the pieces?

    I've been living with a shattered hippy stone for a while, and occasionally my farming gear is stolen while I'm away. Is there a built-in method that retrieves any missing pieces of an outfit? Edit: Nevermind. This should probably work: boolean ensure_outfit(string outfit_name) { int [item]...
  20. philmasterplus

    Display3: A responsive three-column display case UI

    Thank you. I was considering making it responsive so that when the page shrinks, the tables auto-collapse to 2 columns, then 1 column. I can't promise anything, but I'll post an update when I make progress.
Back
Top