jsbasic icon indicating copy to clipboard operation
jsbasic copied to clipboard

Sample adventure crashes; not completable

Open dfabulich opened this issue 4 years ago • 3 comments

To repro: https://www.calormen.com/jsbasic/

  1. Click the Select a sample… drop down
  2. In the Games section, select "Text Adventure (Floyd McWilliams)"
  3. Click Run
  4. Run these commands:
  • e
  • u
  • n
  • take key
  • s
  • w
  • w
  • unlock door
  • open left door (it doesn't matter which door you open)

A JS alert appears, "Illegal quantity in line 7130"

Screen Shot 2020-07-26 at 8 35 16 PM

dfabulich avatar Jul 27 '20 03:07 dfabulich

Hi, when you type "OPEN LEFT DOOR" (27 31 57) line 7120 calculates ARG using the second word number stored in INPTK(2) = 31 (LEFT) or 31 (CENTER) or 33 (RIGHT) subtracted by ITEMOFF = 33 (line 700) which translates to: ARG = 31 - 33 = -2 this happens because INPTK(2) will always be lower than ITEMOFF (=33) and it will fail on line 7130 because ILOC(ARG) translates to ILOC(-2) and arrays can't have negative indexes.

I am still debbugging it because lines 7120 and 7130 deal with both actions:

  • OPEN (LEFT|CENTER|RIGHT) DOOR
  • OIL DUMBWAITER OILCAN

I will submit a Pull Request when it is done. thanks

jonatasdemello avatar Jan 11 '24 23:01 jonatasdemello

Yeah, a PR is welcome.

inexorabletash avatar Jan 13 '24 18:01 inexorabletash