Good afternoon, how can I capture the information through parameters in the url using the variable "projectVars"
If I check the game, always the variable has the value "projectVars=value"
Good afternoon, how can I capture the information through parameters in the url using the variable "projectVars"
If I check the game, always the variable has the value "projectVars=value"
I could get it working and will describe it below, although TBH I'm not sure how practically useful it is because you have to type a string into the game's project page on NewGrounds and the projectVars will always have the value of that string.
I made a test project and on NewGrounds' project page I turned on the
Use projectVars
checkbox at the bottom, and in the text box underneath it I put
holy crap this actually worked
Then for the game I wrote this as index.html and uploaded the zip
<html> <head></head> <body> <script> let params = new URLSearchParams(document.location.search); let projectVars = params.get("projectVars"); console.log("projectVars is: " + projectVars); </script> </body> </html>
I previewed the game and checked Developer Tools - Console tab and it said
projectVars is: holy crap this actually worked