Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<<numberslider>> in the numberpool addon breaks on example use case, variable undefined #343

Open
Robert-Lloyd3 opened this issue Dec 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Robert-Lloyd3
Copy link

Robert-Lloyd3 commented Dec 30, 2024

Describe the bug.

The <<numberslider>> macro in the numberpool addon for SugarCube v2 (listed on The SugarCube v2 home page) fails when provided with the example usage case from the included numberpool documentation on latest Chrome-based browsers. Other browsers have not been tested to see if the issue reproduces.

<<numberslider "$opacity" $opacity 0 1 0.5>>

To Reproduce:
Steps to reproduce the behavior:

  1. In Twine, create a new Story
  2. Install the numberpool addon per instructions
  3. Add the following to the default start passage
<<set $opacity to 0.5>>
<<numberslider "$opacity" $opacity 0 1 0.5>>
  1. Click on Build, then Play
  2. A wild error message appears
    Error: cannot execute macro <<numberslider>>: Cannot read properties of undefined (reading 'hasOwnProperty')

Expected behavior.
A horizontal slider from 0 to 1 with half-step increments is expected to be displayed.

Screenshots.

  • None.

Project details.

  • SugarCube Version: 2.37.3
  • Included Add-ons: numberpool
  • Included Libraries: None
  • Compiler & Version: Twine 2.10.0

Desktop details.

  • Windows 11
  • Chrome 131.0.6778.205 (Official Build) (64-bit)
  • Edge 131.0.2903.112 (Official build) (64-bit)

Smartphone/tablet details.

  • Not tested

Additional context.
To fix this issue, replace the following lines

return null !== parent && parent.hasOwnProperty("pool") ? parent.pool : null

with:

return undefined !== parent && null !== parent && parent.hasOwnProperty("pool") ? parent.pool : null

I'd submit the fix, but I have been unable to find the repo for it.

Thanks.

@Robert-Lloyd3 Robert-Lloyd3 added the bug Something isn't working label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant