Kniggles's Forum Posts

  • Hi all,

    I am trying to use the data i get back from my Ajax call,

    the string i get back is

    Johnmy text goes herethere text goes here

    this should say John my text goes here there text goes here

    how do i Ajax.lastdata to split the 3 bits of data up to be able to use them?

    thank you.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Good Morning All,

    Any One know how to stream a webcam into my game thus making the player avatar face = webcam-pic.that can be seen by the rest of the internet?

    thank you.

  • Will this tutorial help?

    https://www.scirra.com/tutorials/685/making-a-jigsaw-puzzle-part-one-concept

    It also includes a full working .capx for you to study.

    this is sort of helping thank you,

    i am however trying to make 1 jigsaw peace = 1 pic so i can add another pic into a new jigsaw peace and then join the 2 pics together.

    I am not worried about the peaces snapping together as they should all have the same mask on.

    i can not seem to be about to break this code down into a way to understand the process .

    thank you.

  • Hi I am trying to make a Jigsaw type game and i have stuck on how to make the peaces over lap right.

    any pointers please ?

  • Put everything you want to be masked out on the same layer, put the mask object on top, turn "Force on texture" ON, put everything else on a layer below it.

    here is an example

    http://www.headbangames.com/mask.capx

    thank you very much <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Did you make sure the mask is on the same layer and that the layer has force own texture set to true? Please note that these blend modes do not show in the editor, the effect is only visible in preview.

    Also z-order of the mask is very important.

    Edit: set opacity to 0 the mask's. Very important!

    thank you for helping

  • >

    > I do not understand,

    > The Ajax settings in construct2 are

    > ....

    > Method

    > "POST"

    >

    > I can not see another others i can change and this is already set to POST.

    >

    > Post to URL

    > Send a request with data to a URL and retrieve the response. A tag is provided to match it up with the On completed, On progress and On error triggers. Construct 2 does not automatically URL encode the post data - use the URLEncode system expression to ensure the data is in the correct format for posting. Note post data is in the same format as a query string, e.g. "foo=1&bar=2".

    > The method can also be specified: by default it is POST, but for some APIs you may need to change this to GET,PUT, DELETE,HEAD or another HTTP method.

    >

    > [quote:1qcv5vpu]GET - Requests data from a specified resource

    > POST - Submits data to be processed to a specified resource

    >

    Thank you for helping

  • This is what you've got right?

    which is equivalent to this:

    But what I think you're wanting is this:

    of course URL encoding the message if there is any chance there is a special character in there at all. URLEncode is a system expression. So you'll probably finish with this:

    But then you need to make sure you decode within the php script so the variable assignment lines will look more like:

    > if (isset($_GET['user'])) {$user = urldecode($_GET['user']);} else {$user = urldecode($_POST["name"]);}
    [/code:14tgp1dp]
    

    These Both work Thank you very Much

  • you can mask it out with another circle shaped sprite, or use something like the 3rd party canvas plugin to redraw it to a new image (not necessary if you don't actually need the user to download the image)

    Hi Lof, thank for helping .

    For masking check out "Blend modes.capx" in your construct2\examples directory.

    I have used a mask over it however this will not let me see through to the layer behind.

    ie if the player uploads the target as a tree when hit i want to see through the tree to the forest or what ever behind.

  • Hi,

    I have go so far as being able to get a player to pick a picture, now i would like to be able to make a transparent hole in it. any ideas please ?

    thank you.

  • Kniggles The page with the button on it is using the http POST protocol to pass the form data with variable name 'name' to the php script. The second code segment is passing the variable 'name' to the php script via the http GET protocol. These are different so they are accessed differently by php. You can either change the request to a post request in Construct or change the php script to recognize the GET variable name as well as the post variable.

    I do not understand,

    The Ajax settings in construct2 are

    Tag

    ""

    URL

    ""

    Data

    ""

    Method

    "POST"

    I can not see another others i can change and this is already set to POST.

  • I'm no expert at php, so I could be horribly wrong, but I think that this

    > if (isset($_GET['user'])) {$user = $_GET['user'];} else {$user = $_POST["name"];}
    if (isset($_GET['count'])) {$count = $_GET['count'];} else {$count = 1;}
    [/code:hcyw75s0]
    
    is where your problem lies for two reasons.
    
    1. Your AJAX request is passing the variable name as a http get variable. However, you are testing whether the get variable called user is set, which it never is. Therefore, it's entering the else block which is setting the user variable to the post variable called name; which it seems would also not be present as you are passing the variable as a get. 
    
    2. This might just be a lacking of understanding of how scoping in php works, but the $user and $count variables are being created in conditional blocks. When these blocks are exited are these variables still in scope?
    

    if I use this code to send the request, From a page with just this button on,

    <form action="TheAPi.php" method="post">
    Name: <input type="text" name="name"><br>
    
    <input type="submit">
    </form>
    [/code:hcyw75s0]
    From a page the output is what i want.
    So i got it down to not sending the post from Construct to the PHP.
    This line i feel is wrong , just not sure how though 
    [code:hcyw75s0]"http://WebsiteForTestting com/Control/TheAPi.php?name="&Variable1[/code:hcyw75s0]
  • Not without more information, are you trying to load player data from your server? What does your php file look like (omitting sensitive information)?

    Hi briggybros,

    <?php
    require_once('TwitterAPIExchange.php');
    /** Set access tokens here - see: https://dev.twitter.com/apps/ **/
    include 'crystals.php';
    $url = "https://api.twitter.com/1.1/statuses/user_timeline.json";
    $requestMethod = "GET";
    if (isset($_GET['user'])) {$user = $_GET['user'];} else {$user = $_POST["name"];}
    if (isset($_GET['count'])) {$count = $_GET['count'];} else {$count = 1;}
    $getfield = "?screen_name=$user&count=$count";
    $twitter = new TwitterAPIExchange($settings);
    $string = json_decode($twitter->setGetfield($getfield)
    ->buildOauth($url, $requestMethod)
    ->performRequest(),$assoc = TRUE);
    if($string["errors"][0]["message"] != "") {echo "<h3>Sorry, there was a problem.</h3><p>Twitter returned the following error message:</p><p><em>".$string[errors][0]["message"]."</em></p>";exit();}
    foreach($string as $items)
        {
            $Alpha = $items['user']['profile_banner_url'];
            $Beta = $items['user']['profile_image_url'];
            $Ceta = $items['user']['name'];
            $Delta = $items['user']['screen_name'];
            $Ebco = $items['user']['description'];
            echo "". $Alpha."|";
            echo "". $Beta."|";
            echo "". $Ceta."|";
            echo "". $Delta."|";
            echo "". $Ebco."|";
        }
    ?>
    [/code:1na4cb9b]
  • Hi I am trying to post " name = Variable1 " to a php file on my server,

    The Php file TheAPi.php works with a simple html post it button, and it also works if I use the form as an Iframe on the layout

    the line i have been working on gos like

    AJAX

    URL=

    [code]"http://WebsiteForTestting com/Control/TheAPi.php?name="&Variable1

    [/code:3npaib2w]

    and all i get back are the default players details.

    any pointers please ?

  • I dunno all that much about hardware programming. My experience is limited to messing with pin configuration on the Arduino firmware for a Reprap, which is going to be vastly different from interfacing with a modern USB device. If you can't get documentation from the manufacturer, maybe you can find some open source audio software that is able to use your MIDI controller. Then you can read the source and maybe do some creative modification to see how it makes the MIDI controller do what you want. Then, you probably need to make or find some kind of connector library or dll so you can do stuff in Javascript. Then you finally have to tools you need to make your plugin.

    All this is a bit above my level, but I didn't want to leave you hanging.

    thanks again bladedpenguin , its way over the drag n drop stuff that i all most know a bit about as well lol, i have found they make a map for the controller in virtualdj8 and also let you make your own map settings, so will be heading there and see .