Executing Javascript to submit a Hi Score??

Get help using Construct 2

Post » Wed Feb 25, 2015 11:53 am

I am looking to execute some Javascript but am having trouble using a variable within the call I am making.

Using a number is fine but I am getting errors trying to use a variable instead.
Would anyone have an idea of how I could go about this?

The call I am trying to make is: GameAPI.Score.submit(HiScore);

I am getting ReferenceError: HiScore is not defined.
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619

Post » Wed Feb 25, 2015 12:07 pm

If you're calling execute javascript and HiScore is a C2 variable then you'll need something like:
Code: Select all
"....GameAPI.Score.submit(" & HiScore & ");...."
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,150

Post » Wed Feb 25, 2015 12:37 pm

Brilliant thank you, Fixes my issue it appears.
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619

Post » Wed Feb 25, 2015 3:21 pm

You can use Javascript and write your own code construct 2. Where is that in the manual?
renny
B
7
Posts: 53
Reputation: 385


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests