Accessing variables in the .html file

If I add a variable in the wick editor, lets say…

this.score = 123;

How can I access this variable in the .html file once exported?

Example :
<script>alert(this.score);</script>

Many thanks for any assistance offered!

Just thinking… if that is exactly what you want to accomplish, why you don’t add that code in the editor itself? It should work the same when you export it to html.

1 Like

Yes - that is more logical. I’m trying to submit the data to the database, but, I can just make the php request from inside the wick editor. Many thanks :grinning:

I guess that if you set window.myVar in wickeditor you can display it next in your html page.
not tried it but it should work as window is the top common element in dom

1 Like

You can also store the variable in the current (or in another) windows local storage so that you’re capable of accessing it through that specific window using js or html

1 Like

If that so, you could also add an html element to the dom, and hide it with the value from the editor. I have done that before with regular js.

I have tried this same kinda thing with putting scores for games into a mysql database. I wanted to make a scoreboard system that would be on a website but I never got it to work. php is not my strong suit :(

@pyronode

game_login.zip (513.7 KB)

Have a look here. The sql statement is in the _config.php file. It uses cookieClicker wick and prints the last score under the profile page.

username: test
password: test

1 Like

im in school right now but i will check that out later! :+1:

is there a easier way to import a wick .html file? (this is if i already had put the score variable in my project like in your project)

Hi pyronode,

I’m sorry, but, I’m not quite sure that I understand what you require. Are you trying to integrate the score counts into an existing website?