twdead's Forum Posts

  • my mistake, sorry.

    I wasn't trying to correct Ashley, it looked like helenDarkAvenger was using the wrong type in the string they posted (trying to send the string with variables), which is what I was referring to.

  • also the string delimiter for javascript is + not &

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the basic process as I see it:

    • save the canvas image as a data uri
    • upload that to a server and save it as an image file with php
    • add the url of that image to the open graph tags in an html page
    • post that page to facebook

    I've done the first two, but not through construct2, so that at least is possible.

  • I don't know if Kongregate would allow it or not, but it is possible to emulate a click event with jquery $.click, also it has $.focus which might work.

    So something like

    $(window).on('load',function(){

    $('iframe').click();

    })

    or

    $(window).on('load', function(){

    $('iframe').focus();

    })

    might work, but i'm just guessing here.

  • Why wouldn't you monetize access to the game itself instead of the source code?

  • Construct 2 games are essentially websites. Server-side scripting is probably going to remain the most stable and secure way to save and load data for a long time.

    so php is really the best way for the moment to write and read files,

    you can write new files and overwrite existing ones, without dialogs,

    what i would want to do is when you execute, it instantly loads up te last file you worked on, so you adjust something in construct then execute and you continue working on the level, saving would overwrite current level by shortcut, and loading different level could be textbox + enterkey

  • Yeah, that's more or less it.

    Queries are separated as name=value pairs (like variables), with the pairs themselves separated by ampersands, so with "post.php?name=vname&score=vscore" The variable names would be 'name' and 'score' and their values would be 'vname' and 'vscore', respectively.

    In php, this would be recieved in the $_GET array as

    $_GET['name'] = vname

    $_GET['score'] = vscore

  • I haven't used the ajax functions in construct 2 so I couldn't tell you specifically how, sorry.

  • Spend some time on php.net and stackoverflow and find out what the best practices are for SQL queries (and find a lot of good code for doing exactly this sort of thing - the community for PHP is pretty good because the language itself is so haphazard.) This is definitely not something you want to jump into without doing the research first.

    Oh and I just realized I didn't mention the part of the code I posted above that sets the max range for the filter is '(?)' because I didn't know what to set it to. That's not actually part of the code, just a placeholder.

  • Please tell me that isn't production code.

    You HAVE TO typecheck, validate and escape EVERYTHING before sending it to SQL.

    Getting the information just takes another query to the database. You could theoretically just make this another php file or set up your original one to either send or recieve based on a query parameter, and it could format that information as JSON for an ajax call to that file.

    something like this should work (assuming typos because i'm sleep deprived):

    $uname = null;

    $score = null;

    if(isset($_GET['fname'], $_GET['testy'])){

    ... connect to the db

    $uname = trim(strip_tags($_GET['fname'])); // remove malicious code

    $uname = str_replace("\0", "", $uname); // remove poison bytes

    // verify int and min/max values

    if(filter_var($_GET['testy'], FILTER_VALIDATE_INT, array('options'=>array('min_range'=>0, 'max_range' => (?) ))){

    $score = str_replace("\0", "", $_GET['testy']); // just because you're paranoid don't mean they're not after you

    }

    if(isset($score, $uname)){

    mysql_query("INSERT INTO chat (playerid, text) VALUES ('".mysql_real_escape_string($username)."',".intval($score).")");

    }

    }

  • you don't need php to read a textfile with ajax.

  • You can read a file in with ajax and do whatever you want with it in the success callback.

    I don't know what limitations the c2 ajax plugin places on this but with regular jquery it's a nonissue as long as the file you're loading is in the same domain.

  • Angelfire is still around?!

  • If you want to integrate your games into the posts themselves or something you'd need to edit the templates to allow for that.

    Or I suppose you could just upload the games to their own directory and add the html directly into the posts, that might work.