• The moderator of this forum is jetou.
  • Welcome to Smogon! Take a moment to read the Introduction to Smogon for a run-down on everything Smogon, and make sure you take some time to read the global rules.

HTML extracting battle logs from ongoing battles? (wolfram)

i'm doing a school project using surface level machine learning to analyze replay data and give action feedback in mathematica because i don't have the time yet to become versed in java. ideally, i want to be able to call some function Import[] with a live battle link that would be able to extract the replay logs, but right now, at just the most basic part of the process, i'm getting an error message that i must use java. i'm super unfamiliar with like... everything regarding HTML so can anyone please offer some insight on how i could get my hands on the temporary battle logs?

here's the basic code that i got concerned at:
1715124232752.png


even if you're unfamiliar with mathematica, just general advice on how to approach this would be super helpful :,)
 
To view the log of an ongoing battle, you would need to connect to our WebSocket, wss://sim3.psim.us/showdown/websocket. Then send |/j BATTLE-ID to connect to the battle. You'll receive something like
Code:
>BATTLE-ID
|init|battle
... (battle log separated by newlines)

See https://github.com/smogon/pokemon-showdown/blob/master/PROTOCOL.md for a more detailed explanation of our WS protocol.
 
thank u so much for the pointer, i had no idea what web sockets even were haha.

i'm having trouble actually connecting to the socket tho, as when i try from either link specified on the github, i get:
1715185838191.png

i'm able to open other basic sockets just fine, so do you have any ideas as to what i'm doing wrong?
 
i managed to get it to work by routing the websocket through a usermade database! however, it won't run online without a wolfram mathematica membership since the free cloud version doesn't support websockets :,) so this whole project is a little doomed LOL.....

i dont know how to code in java or python, but does anyone think that could be viable to learn to execute a basic data extraction code in a different language in a limited timeframe?
 
i managed to get it to work by routing the websocket through a usermade database! however, it won't run online without a wolfram mathematica membership since the free cloud version doesn't support websockets :,) so this whole project is a little doomed LOL.....

i dont know how to code in java or python, but does anyone think that could be viable to learn to execute a basic data extraction code in a different language in a limited timeframe?
shouldnt be too hard w/ python ye
 
Back
Top