deathangel1479's Recent Forum Activity

  • Yes, billboard->returned is a string and task->returned is an array. (look at details, there are no quotes)

    Construct cant handle Arrays/Objects like this, so it shows 0. (null)

    AJAX_RESULTS.Get("id") dont exist. There is only index 0 and 1 in this array. (not a dictionary!)

    I dont know the default way to get for example the id value of for example index 0 from returned of AJAX.LastData, in this I cant help you.

    I personally would make it like this, with my plugin:

  • I already noticed, but never caused problems.

    If you import files to project, they get to lower.

    If you access for example from a plugin directly by string filename, you have a problem.

    But you can set the string in plugin toLower...

    Or use file picker.

    Or use lower case filenames.

    I guess it has a sense, that they are lower case.

  • Multible values by json:

    Multi row:

    $arr = array();
    while($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
    {
            arr[] = $row;
    }
    echo json_encode($arr);
    [/code:hfj250k1]
    AJAX.LastData -> [{"name":"Bob","secondName":"Meyer","isMember":1},{"name":"Dieter","secondName":"Miller","isMember":1}]
    [img="https://dl.dropboxusercontent.com/u/95601836/multiphp2json.png"]
    
    Single row(first result):
    [code:hfj250k1]
    $arr = array();
    while($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
    {
            arr[] = $row;
    }
    echo json_encode($row[0]);
    [/code:hfj250k1]
    AJAX.LastData -> {"name":"Bob","secondName":"Meyer","isMember":1}
    [img="https://dl.dropboxusercontent.com/u/95601836/singlephp2json.png"]
    
    Then use a json plugin to work with this strings. For example: [url=https://www.scirra.com/forum/plugin-tools-object-array-in-construct-based-on-json_t147493]Tools[/url]
    Some examples:
    [img="https://dl.dropboxusercontent.com/u/95601836/getLastData.png"]
    
    Sorry for spam, but my server is down and i am boring...
  • 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...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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...

  • 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".'

deathangel1479's avatar

deathangel1479

Member since 16 Feb, 2015

None one is following deathangel1479 yet!

Trophy Case

  • 9-Year Club

Progress

9/44
How to earn trophies