Bug JavaScript bugs

ikzann

Member
This is a tracking thread for early JavaScript bugs, since I expect there to be quite a few.
  • Error messages when a value is missing on one of the globals are garbage.
  • Translate record types for e.g. maximize return value.
  • jsref command like ashref.
  • Wiki documentation. (first stab here)
  • Rhino copyright info for Credits.
  • Better ways to interrupt running JS code (currently only interrupts when going into ASH)
  • Equality does not work correctly on enumerated types.
  • there are still some things broken with require...
  • Lib.write does not work in relay scripts
Features:
  • Consult script support
  • Lifecycle script support
  • XML() object support (this already works)
  • require() support, for both ASH and JS
  • Relay script support (both override + menu)
 
Last edited:

ikzann

Member
Fairly critical bug that breaks the Ezandora choice override script arrangement. Fixed in this patch.

Parent ash interpreters weren't being passed down to children run via cli_execute, so the children could not access the relay request. This patch rewires that together. This was an error in my refactoring of the Interpreter code.
 

Attachments

  • fix-choice-v2.txt
    903 bytes · Views: 3

ikzann

Member
This fixes the bad error message when using a nonexistent function on the runtime library.
 

Attachments

  • to_string.txt
    709 bytes · Views: 3

ikzann

Member
This is a big patch to set up consult scripts, "lifecycle" scripts (choiceAdventureScript, betweenBattleScript, etc.), and combat filter functions. I think this mostly completes the refactoring to pull all the non-ASH-specific stuff apart from the ASH code, but it's still a little bit messy. I've attached tests for filter functions (just run the script), consult scripts (need to make a CCS to match), and choiceAdventureScript (need to set the pref).
 

Attachments

  • test-choice.js
    164 bytes · Views: 0
  • test-consult.js
    151 bytes · Views: 0
  • test-filter.js
    131 bytes · Views: 0
  • all-js-v2.txt
    76.3 KB · Views: 1

ikzann

Member
Here is another patch to implement require() for both ASH + JS scripts. Can be tested with require("zlib.ash").getvar("verbosity") and require("test-require.js").main(0, Monster.get("zobmie"), "") with the below version of test-require.js installed.
 

Attachments

  • test-require.js
    184 bytes · Views: 1
  • require-v3.txt
    25.8 KB · Views: 4

gausie

Develpoer
This is a big patch to set up consult scripts, "lifecycle" scripts (choiceAdventureScript, betweenBattleScript, etc.), and combat filter functions. I think this mostly completes the refactoring to pull all the non-ASH-specific stuff apart from the ASH code, but it's still a little bit messy. I've attached tests for filter functions (just run the script), consult scripts (need to make a CCS to match), and choiceAdventureScript (need to set the pref).
Thank you ikzann, r20520
 
Last edited:

gausie

Develpoer
Here is another patch to implement require() for both ASH + JS scripts. Can be tested with require("zlib.ash").getvar("verbosity") and require("test-require.js").main(0, Monster.get("zobmie"), "") with the below version of test-require.js installed.
And this has landed in r20521!
 

ikzann

Member
This patch should handle relay scripts correctly, both override scripts and those from the menu. Notably, in order to avoid breaking backwards compatibility with e.g. Guide, I've added a new GET argument to the relay menu scripts that triggers execution of any relay_x.js script vs simply returning it as a JS file. Guide calls its main JS file "relay_Guide.js."
 

Attachments

  • relay-scripts.txt
    4.5 KB · Views: 1

ikzann

Member
And a fix for several require bugs. You can test with svn checkout https://github.com/phulin/bean-daily/branches/main/build and test-require.

Incidentally, the project I stuck this in is an example of how you can set up modern JS tooling for relay script stuff. Everything is written in TypeScript and transpiled down to the version of JS that rhino supports, so you can get all the new fancy features.
 

Attachments

  • fix-require.txt
    8.7 KB · Views: 1

ikzann

Member
Fixes some bugs with argument inversion on library functions, and some type conversion issues. It also reworks some of the proxy record code to work in a more consistent way.
 

Attachments

  • misc1.txt
    26.7 KB · Views: 1
Top