apowers313 / NetHackJS

The original NetHack rogue-like game built as a JavaScript WebAssembly module
Other
8 stars 0 forks source link

How to access in-game data? #1

Open bo3tools opened 3 years ago

bo3tools commented 3 years ago

Is there a way to read the current in-game data, like player's HP or AC (u.uhp, u.uac from struct you) and level object data from the generated JS code? I've seen the create_global function that looks like it makes a setter/getter that references a set pointer but I couldn't find any examples on how is it used and how to get global struct offsets of the game.

apowers313 commented 3 years ago

You would have to export the variables as a global in NetHack. See CREATE_GLOBAL in sys/libnh/libnhmain.c