Grid Sage Forums

Grid Sage Forums

  • April 30, 2024, 01:37:23 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

LINKS: Website | Steam | Wiki

Author Topic: How to use rex_spite.js?  (Read 1253 times)

0x41414141

  • Unaware
  • *
  • Posts: 3
    • View Profile
How to use rex_spite.js?
« on: April 11, 2018, 09:43:27 PM »

I'm a beginner with node.js, but I god I fucking hate it when developers include no example or comments in their code.

I'm trying to get this script to work, but it keeps throwing the error
"TypeError: Invalid non-string/buffer chunk"

Here is my code. test.xp is the xp file I want to display.
RexSprite(fs.createReadStream('test.xp'))

http://www.gridsagegames.com/blogs/files/rex_sprite.js
Logged

0x41414141

  • Unaware
  • *
  • Posts: 3
    • View Profile
Re: How to use rex_spite.js?
« Reply #1 on: April 11, 2018, 09:51:08 PM »

I tried

fs.readFile('./test.xp', function read(err,data) {RexSprite(data)})

Now I get no errors, but also no output.
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4317
    • View Profile
    • Cogmind
Re: How to use rex_spite.js?
« Reply #2 on: April 11, 2018, 10:45:54 PM »

Sorry I don't know anything about js myself, but you could try getting in touch with the original dev (Twitter, GitHub). Everyone who writes those third-party libs for REXPaint uses them in their own projects, and most have samples of their work on GitHub, but chiguireitor in particular essentially disappeared from our r/roguelikedev community a couple years ago and then for some reason the page for rex_sprite.js disappeared as well so I just started serving it from my site now.

...oh actually I see now he's still got his roguelike stuff online, in which he makes extensive use of REXPaint so you can try checking there for use cases!
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

0x41414141

  • Unaware
  • *
  • Posts: 3
    • View Profile
Re: How to use rex_spite.js?
« Reply #3 on: April 12, 2018, 01:45:13 PM »

Ah, thanks! I see the file is slightly different, but it'll do.
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4317
    • View Profile
    • Cogmind
Re: How to use rex_spite.js?
« Reply #4 on: April 12, 2018, 05:35:27 PM »

Oh did he change it? Maybe that's why he removed the other one (but he didn't mention it to me :P). If you confirm that the original one doesn't work but find a separate one that does, or changes that are necessary and end up getting this working for you, let me know and I'll update the resources page.

Note the one I've linked was originally a gist page, and I believe it was intended to be a single package for easy general use because he needed a somewhat modified version for his own use. In any case, I imagine you can learn more from seeing his use cases!
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon