Zerei's Forum Posts

  • A little bump again :) (Hope it's not agains the forum's rules)

  • Well, I worked a bit on it. Got some help with some students here in my University.

    This is what I got:

    <?php

    $username = $_GET['name'];

    $score = $_GET['score'];

    $acerto = $_GET['Hit'];

    $tempoReacao = $_GET['reactionTime'];

    if (!isset($username) || $username == "") {

        echo "failure";

        exit;

    }

    if (!isset($score) || !is_numeric($score)) {

        echo "failure";

        exit;

    }

    if(!isset($acerto) || !is_numeric($acerto)){

    echo "failure";

        exit;

    }

    if(!isset($tempoReacao)){

    echo "failure";

        exit;

    }

    $entry = $username . "," . $score .";".$acerto.";".$tempoReacao."\n";

    if (!file_put_contents("scores.csv", $entry, FILE_APPEND)) {

        echo "failure";

        exit;

    }

    echo "success";

    ?>

    But I have a question now, a very important hone.

    How do I use it with AJAX?

    Like, I think that I must go this way:

    Keyboard -> On Spacebar Pressed -> Ajax -> Request (request what and how?)

    Thanks!

  • Best explanation that I've found so far. Thanks a lot!! Really.

  • No problem. I'm ashame of my ignorance, hahaha.

    Here, I've read some threads before, and I have some question about this:

    "post.php?name=" & Vname & "&score=" & Vscore

    Vname is my variable and "name" is my field in PHP, right? Same thing to score.

    Then if I write this on construct using the AJAX, it will post my Variables called "vName" and "vScore"?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • twdead

    I'll take your advice. But in order to explain my problems properly, could you please tell me how I can make it interact with constrcut? Just a small example.

  • Sure Thing... But I didn't understand a thing that you just said. Sorry, I'm that incopetent ;

    Could someone just tell me how do I write those variables, in a way that I can understand?

  • A Little bump :)

  • Hello! :)

    Here is a Link to my capx: dl.dropbox.com/u/30036346/Dragon.capx

    This is a game for research propourses. It's not even close to the final stage. The aim here is to press spacebar when the timer reaches 0. That way, you can damage the dragon. If you press it on the wrong time (when the dragon is protected by a Dark Aura) you'll get hit by it's fireball.

    I've been learning about PHP and AJAX. I read the tutorials avaliable in the FAQ Thread. But I'm not a good programmer and I can't do it properly.

    Question: I need to save this CSV file, which must register the time when the player pressed spacebar. Then it goes to another line in the CSV , and when Spacebar is pressed, the timer is registered again. This Way, I can keep track if the player improved his peformance or not.

    The data needed are:

    Name:

    Age:

    DragonTimer(which is a variable)

    Trial: (how many times the player pressed spacebar so far)

    Just like that.

    I'm trying to use this code:

    <?php

    /** Read in a username and score and save them to a file. */

    // read variables from POST data.

    $username = $HTTP_GET_VARS[name];

    $score = $HTTP_GET_VARS[score];

    // verify the username is set and not empty

    if (!isset($username) || $username == "") {

        echo "failure";

        exit;

    }

    // verify the score is set and a number

    if (!isset($score) || !is_numeric($score)) {

        echo "failure";

        exit;

    }

    // format the username and score as a comma delimited row

    $entry = $username . "," . $score . $ DragonTimer "," . "Attempts""\n";

    // append entry to the score file

    if (!file_put_contents("scores.csv", $entry, FILE_APPEND)) {

        echo "failure"; // failed to write to file

        exit;

    }

    echo "success";

    ?>

    Any help is really appreciated. But keep in mind that i'm not a programmer, i'm just a newbie in a adventure which is far beyond my professional field!

  • I Forgot to explain. I need the text to be saved inside my server. Or data be sent to me by e-mail, because people will play this game on their computer.

    Anyway, i'll check this Plugin and see if I can work with it! But I think that this isn't exactly what I need =

  • Hello everybody.

    I posted this same issue a few weeks agom but I wasn't Experienced in construct 2 as I'm now, so I couldn't explain my problem properly.

    I looked everywhere, but couldn't find info about this. Maybe I didn't search well enough, but I think it's better to open another thread for it.

    Here is my problem:

    I have, let's say, this reaction time game for research propourses. Time doesn't need to be quite precise as most reaction time need to be.

    Then, this is how i'm registering time:

    Every 0.1 Seconds > Add 1 to "TimeScore" (which is a Global Variable)

    When Spacebar is pressed, the time stops, that value is registered to another variable (Called TimeScore1, or TimeScore2, depending on the stage) and then the player is taken to another stage, there, "TimeScore" is set to 0, and the trial repeats. I need that values to be registered into a TXT or any text file inside my server, so I can later read and analyze it.

    Player Name = (name inputed by the player)

    TimeScore1 = 34

    TimeScore2 = 21

    TimeScore3 = 12

    Any ideas?

  • Thanks Dalek. It worked perfectly.

  • Up? xD

  • Hello all :D

    Anyone can help me to make this object (lets call it Guardian) who moves up and down on the screen, but randomly? Like he is trying to avoid arrows.

    For example: move up to point Y = 600 and then move down to Y = 100, then to up again to Y = 600, and this time, he goes down to Y = 250 and then to Y = 550.

    I'd like to make this behavior kinda "random". But the guardian should not pass the Y = 600 point (let's say it's the wall) and Y = 100 (the floor)

    I don't know if I explained this clearly. Please comment :)

  • Excellent answer, Arima. Thanks a lot. Is it possible that construct 2 will get a plugin wich does the same thing that construct classic does?

  • I made a post about it. So that we may not pollute your post with this discussion :)

    Edit: it's in the general section.