deathangel1479's Forum Posts

  • Only a hint. (event, auto every tick if in front) Its an event, that will be triggered by tick automaticly, no "every tick" need before.

    May be the uid`s are an array, an array should not have gaps, may be if you del an object, that they will reorginized, I never had tried this out.

    But I dont think so. If you add something manual to plattform and another, and then remove the first the uid stay same...

    If you want to bypass UID, make a global variable myID=0, use this for your instances. After a create make myID=myID+1, so you have your own UID. But never forget to add!

    I would suggest you to use a conainer, then everything falls away.

    Is one object of a container is created, all will be created. If you call a instance object in a container, you have access to all instance objects in. https://www.scirra.com/manual/150/containers

    I think Defender, DefenderMover and Detector can be in a container.

  • If no mysql error happens, result is set. if ($result) //->true

    No entry found is no error, its a 0 row result. if (mysqli_num_rows($result)) //->false

    This is not best and shortest version but easy to understand:

    $qz = "SELECT IsMember FROM UserAuthData WHERE email='".$email."' AND password='".$password."'"; 
    $result = mysqli_query($con,$qz);
    
    if ($result) {
          if (mysqli_num_rows($result)) {
                while($row = mysqli_fetch_array($result))
                {
                     echo $row['IsMember'];        //success
                }
          }
          else
          {
                 echo "-2";       //no entry found
          }
    }
    else
    {
            echo "";      //mysql error
    }
    [/code:zd8jxqii]
    
    Write mysql condition uppercase!
    If you do more with this futher, look for "or die()" and "sprintf()".
  • These elseif's are useless, but not a problem. They are only usefull if same values compared in more than one if or with a complete else on end.

    If lastData is correct, there must be something wrong with int - string use, is the global int and you int(AJAX.LastData) or int(isMember) on compare?

    You also can change the second compare value to string...

  • I cant say you what happens, but I can say you how you can try:

    --AJAX On "yourTag" completed

    -->Browser Log in console AJAX.LastData

    You have to experiment a bit.

  • 2.:

    -Foreach Defender (event, auto every tick if in front, get first )

    -Pick Defendermover by id compare Defender id (get second)

    ->Defender set position to DefenderMover (work with both)

    3.:

    -Detector is overl. Enemy (event, auto every tick if in front)

    -Pick Defendermover by id compare Detector id (pick first)

    -Enemy pick nearest to DefenderMover(?Detector?) (pick second)

    ->Defender set angle towards Enemy (work with both)

    There is no need to "foreach defenders" and then "pick defenders".

    You pick first and then an other, you pick second and then an other, ...., this makes no sence.

    Another problem is you access for example: defendermover.ID before you pick a defendermover instance.

    Or are defenders and defendermover bundled by container?

    But then you can access directly, without pick.

    Hope I understand right what you want...

    Will be easier with project file.

    How UIDs work is simple.

    Every object on plattform has a unique number, always continuously.

    You use it from first to bundle objects by instance varibale, yes this is one possible.

    I am a fan of equality, so then i would give Defenders also instance var id...

  • If construct project is in cache, its real fast +- some ms between "onCreate" and "onLayoutStart", and I only say that it can be, in especially if you have a fast system and slow internet. I would not count on it, to much unknown!

    I had much errors with unloaded stuff, but was also a big script... 128KB

    Yes, sync is much better.

    I think .append() is also async, not?

  • I find mine most simple and flexible, but I think because I know every function.

    It's just not completly done yet and I adjust to my project if needed.

    I cant explain it, because Im not good in and my bad english... But that you see in description.

    Actually, we do almost the same.

    The only difference, my server is Smartfox.

    I have to work with quite large json, with 10+ entrys and deep of 5+, like "params.characters[0].look.hair.color" as one entry.

    Exactly for this I build my plugin.

    With the other json plugins I have found, I had problems.

    If you find a good one to handle json in/output, let me know...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hey , in your plugin runtime.js , in the function "onCreate"

    add this

    $.getScript( "YOUR SCRIPT URL", function( data, textStatus, jqxhr )

    {

    // when the script is loaded here you can use it

    });

    Have fun making plugins

    Thats not a good idea. I have tried this in x versions.

    Thats a async load, it much times comes to late!

    You can try it with sync load, but best to be sure its loaded correctly, is to have it in your addons and load it in edittime!

    jQuery.ajax({
        async:false,
        type:'GET',
        url:script,
        data:null,
        success:callback,
        dataType:'script',
        error: function(xhr, textStatus, errorThrown) {
            // Look at the `textStatus` and/or `errorThrown` properties.
        }
    });[/code:32lxcnd3]
  • WTF When I watch this, it dizzy me.

    But it seems to work and will make it more simple.

    So "" is like \".

    Thank you much, for this information!

    And with my new sprintf, status is now:

    Tools.sprintf("{""name"":""{0}"",""password"":""{1}"",""mail"":""{2}""}",Reg_NameIN.Text,SmartFoxServer.EncryptPassword(Reg_PassIN.Text),Reg_MailIN.Text)

    Much better, now it is readable and no .replace needed!

    But I think furthermore, would be nice to be able to use. 'He said: "Hello".'

  • Thanks for reply, but for me it was actually about Constructs->AddStringParam with 'string', not about json.

    I know my english is not very well...

    Conversely, this will work for json, but construct dont accept:

    str('{"name"":"'&Reg_NameIN.Text&'","password":"'&SmartFoxServer.EncryptPassword(Reg_PassIN.Text)&'","mail":"'&Reg_MailIN.Text&'"}')

    Other example for same situation:

    str('He said:"Hello".')

    str("He said:\"Hello\".")

    This wont work in Construct. Is working in JavaScript. Would be nice if Construct accept this.

    Or do you mean something like:

    "{%22name%22%22:%22"&Reg_NameIN.Text&"%22,%22password%22:%22"&

    SmartFoxServer.EncryptPassword(Reg_PassIN.Text)&"%22,%22mail%22:%22"&Reg_MailIN.Text&"%22}"

    I think that's even worse.

  • I dont worked with ajax like this, but I would try it like one of these examples. Not tested!

    Problem with this examples, my Tools plugin is also very experimental.

    But I think there are other stable plugins for json... Search...

  • Oh I forgot to confirm.

    Yes, it works.

  • It would be nice to be able to use ' " ' and/or " \" " at "AddStringParam" and other.

    At moment i have to use for example:

    str("{'name':'"&Reg_NameIN.Text&"','password':'"&SmartFoxServer.EncryptPassword(Reg_PassIN.Text)&"','mail':'"&Reg_MailIN.Text&"'}")

    That's a little crazy to write.

    And in plugin I need to String.replace() ' with " to make a valid json.

    I also can String.replace() ' in construct directly, but that makes it not better...

    I think this also help for other things as json.

    Or did I miss other options?

  • I do not know whether there is already a Converter.

    But I created it for my project, so why not upload it.

    May be someone can use is, too.

    Download

    (.net 3.5 and C++ 2012 Redistributable needed)

    Single Layer File:

    (Construct default)

    Tiled2ConstructConverter converts the Tiled map JSON export to a Construct 2 map(run-length encoded).

    If you have added a tilemap object, with same tileimage like in Tiled, to Construct 2, you can go on like this:

    Tiled JSON export. (For example: "Map1.json")

    Load it in T2CC.

    Select/Deselect layers.

    Select "File per Layer" checkbox.

    Save it to your new Construct 2 json map files.

    It will create:

    Filename_layer*.json

    Filename_layer*.json

    Filename_layer*.json

    ...

    Import it in Construct 2.

    Create a sheet to load maps, for example:

    That was all, now your map will be loaded.

    Multi Layer File:

    (My default)

    Tiled2ConstructConverter converts the Tiled map JSON export to a Construct 2 map(run-length encoded).

    The only difference between my and Construct 2 JSON is, that my Map contains more than one layer.

    For this you need a addon that can handle JSON objects.

    If you have added a tilemap object, with same tileimage like in Tiled, to Construct 2, you can go on like this:

    Tiled JSON export. (For example: "Map1.json")

    Load it in T2CC.

    Select/Deselect layers.

    Save it to your new Construct 2 json map file.

    Import it in Construct 2.

    Assure you that you have same layer in Construct 2 like in Tiled.

    Create a sheet to load maps, for example:

    Tools is one addon to handle with Objects. (JSON)

    That was all, now your maps will be loaded.

    14.06.2015-12:06 New: "File per Layer" option

  • Depends on the situation.

    There are several ways.

    Can you do something with this samples ?