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

running the script #16

Open
Hunter556 opened this issue Aug 30, 2018 · 6 comments
Open

running the script #16

Hunter556 opened this issue Aug 30, 2018 · 6 comments

Comments

@Hunter556
Copy link

When i try to run the script i get this error:

TypeError: RecordedGame is not a function

@goto-bus-stop
Copy link
Member

The readme example is a newer version than the npm package. with the version currently on npm, you need to do:

const RecordedGame = require('recage').default

That'll be fixed in the next release. The current version on npm is missing a lot of the header information; I'm planning on doing a new release once the header reading is quite robust so you can get more player info and so on out of it.

@Hunter556
Copy link
Author

the error is gone.
in a side note : how to do I run the script to parse a certain file ? do I send the file path as an argument in the cmd line? Sorry for the noob question, my experience with node js is so limited

@goto-bus-stop
Copy link
Member

goto-bus-stop commented Aug 30, 2018

Change it to RecordedGame(process.argv[2]). (The 0th argv is the node command, 1st argv is the running file, 2nd and on are additional arguments) you can then do node script.js rec.mgz

@Hunter556
Copy link
Author

It worked, but does it handle all records version? I tried with wk record, and some old aoc record, both gave me something like this : u15: <Buffer 00 00 00 00 00 00 00> }
events.js:183
throw er; // Unhandled 'error' event
^

@goto-bus-stop
Copy link
Member

goto-bus-stop commented Aug 30, 2018

I think it only works with UserPatch 1.4 records right now. WololoKingdoms uses UP 1.5.

@Hunter556
Copy link
Author

weird, i tried it with UP 1.4 version but im getting this :Error: EBADF: bad file descriptor, close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants