Manually add JS Code

Get help using Construct 2

Post » Thu Dec 05, 2013 8:51 pm

[quote]OK, I think the answer is yes as I don't get any errors.[/quote]
yep.

[quote]Do I use Ajax for this, or should I create functions in code to do these?[/url]
Whichever you can use to get it to work. I'm not too familiar with ajax calls but it may be simpler to use the plugin if there are edge cases it handles. But again I have a knowledge gap about that that you can probably find alot of resources about with google.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Thu Dec 05, 2013 9:04 pm

...Thinking out loud:

If it is values you seek from the url, or any other thing that lead a user to your program, and your using a database with web resources on your own host, you could perhaps use a simple php landing page.

Like, link to your game becomes: http://somewhere.com/game/game1/index.php (insteead of index.html)


Have the PHP catch anything you need, from URL variable, to surfer details, to user login details etc, and stuff that in a database with a generated code by php. Then have PHP forward you to your index.html.

When the game starts perform an ajax request to your server which again generates the code and fetches whatever details you had it store.

Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Thu Dec 05, 2013 9:19 pm

Thanks to both of you.

I'm really trying figured out exactly what they are trying to do with the code and just reconstruct it using Construct.

My issue right now is variables that are created in the Java Script code cannot be accessed by C2, or by other functions that I can see. Recreating what they want in C2 might be the only way.

Or I need to go the SDK route, if that will even work with what they want.
B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Post » Thu Dec 05, 2013 9:33 pm

If the client page generates some code in their webpage, cant you use a native javascript ajax post to a php database, and have cs2 retrieve that ?

Major advantage of using the cs2 ajax is that it is most compatible.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Thu Dec 05, 2013 11:28 pm

Sure, but that is not how they have it setup :). So I am kind of stuck trying to get it to work with their code that they can't alter so it stays uniform per developer.
B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 48 guests