Gravity17's Recent Forum Activity

  • Tested it myself with c2 and c3 and it's sorting correct with that data you're using.

    https://www.dropbox.com/s/dz762jh9t0myg9a/array_sort_test.capx?dl=1

    You'll have to show your project or events.

    Thank you so much, I looked at your example and replicated it in my project, it failed on the first line, which demonstrated the issue was with the order in which I built my array.

    When I went back to look I could see I had added the first line outside of the main function call, so it was getting updated after the sort had happened.

    Thanks for the pointer as it also taught me a neat way to output the contents of an array really cleanly!

  • Hi,

    So I have built an array, and populated it with the data I require, I then want to sort the array, however when I do this the second record in the array is removed. It is the same row every time.

    See screenshot for details. As you will see the unsorted array has a value of "1-06" in row 1, once the array is sorted this value is dropped, and the rest of the array sorts correctly.

    As above this issue consistently happens with the exact same behaviour each time.

    I am using arrayname Sort X Axis as the action.

    If I reverse the array, then the data is retained, but row 0 is then not sorted - what am I doing wrong?:-

    Thanks in advance again! :)

    Tagged:

  • Pick by Evaluate Object.yourinstancevariable=loopindex

    Perfect - thank you!!!

  • Hi,

    Is it possible to reference an instance of an object by one of its variables?

    Say I have Text fields called text1, to text9, each with an instance variable of ID that I manually enter, and a number of other instance variables called segment1, segment2, segment3, ..., segment9

    I have a 'for' loop, and within the loop I want to be able to say:-

    iCtr = 0

    For 0 to 9

    Carry out a task to calculate result

    'Update text(n) field with result

    set text & (ictr).Segment1 = result

    'or even

    set text.Segment(ictr) = result

    iCtr = iCtr+1

    Next

    or failing that, could I do similar with a Global constants, e.g global1, global2, global3, ..., global9:-

    iCtr = 0

    For 0 to 9

    Carry out a task to calculate result

    'Update global with result

    set global & (ictr) = result

    iCtr = iCtr+1

    Next

    Basically I am trying reference fields/objects programmatically using their name/id. I know I could loop through object instances, but I already have a number of loops so I am trying to avoid that if at all possible.

    Thanks in advance!

  • You do not have permission to view this post

  • You do not have permission to view this post

  • You do not have permission to view this post

  • For the record, SSL is easy to get on websites nowadays via LetsEncrypt - there's no real excuse for HTTP in 2019

    Hi Elliot, I tried LetsEncrypt but my hosting provider doesn't allow 3rd party SSL certs and want to charge me £50 for the privilege of using theirs. Unfortunately I paid in advance for the hosting so don't want to move to a new hosting company until this ends - so that's the excuse for me. :)

    As I mentioned this is a service used solely by me, there is no sensitive data, so for me it works - that said as soon as my current contract expires I will be moving to one of the LetsEncrypt preferred hosting partners.

    Thanks guys!

  • Thanks Ashley, it WAS the platform (Android 9) blocking HTTP.

    As this is only an app/website I use personally I decided to fix it by adding the following line to the AndroidManifest.xml file:-

    android:usesCleartextTraffic="true"

    This allows HTTP requests, not ideal for everyone but works for me so including here as a possible solution.

    Thanks for your help though as it pointed me in the right direction,

    Cheers,

    Jason.

  • Hi guys,

    As the title says, I have built an app in Construct2 and part of the functionality sends an email via javascript and the AJAX object.

    This works perfectly on my phone when I export it as an HTML5 website, but when I export it as a debug APK (using Cordova) the email sending does not work, but the rest of the app does - any ideas, am I missing something obvious?

    I have used code snippets that people have posted as examples and as I say it works when running as a site.

    This used to work when building the APK via Cocoon.io but since they are no longer providing that service I have switched to Cordova and it no longer works.

    The javascript that gathers the data from controls in the app is as follows:-

    "document.getElementById(""myText2"").select();document.execCommand('copy');"

    and the AJAX commands are:-

    Send

    Tag: "Email"

    URL: "http://www.myurl.com/c2mail.php"

    Data: "subject="&Subject&"&message="&message&"&email_to="&email_to

    Method: "post"

    Request

    Tag: "sent"

    URL: "http://www.myurl.com/c2mail.php"

    Contents of c2mail.php

    <?php

    $to = $_POST['email_to'];

    $subject = $_POST['subject'];

    $message = $_POST['message'];

    $headers ='From: fromkal@email.com' . "\r\n" .

    'Reply-To: fromkal@email.com' . "\r\n" .

    'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message, $headers);

    echo "Message sent at ";

    echo date ("h:i:s");

    ?>

    My device is Android 9 - I am wondering if this is something to do with it, I wonder if it requires an SSL cert on the URL domain?

    Does anyone have any ideas?

    Thanks in advance!

    Tagged:

  • but if I use cordova does not transform into apk

    Check out this tutorial below. It worked perfectly for me. On the Gradle step you need to manually download the binary version as the instructions link you to the ALL version.

    This has allowed me to create a debug APK which I can sideload on to my own mobile. In order to get it on an app store you will need some kind of certificate (as mentioned elsewhere) but I don't know how to do that.

    construct.net/en/tutorials/how-to-build-games-from-c2-with-cordova-for-every-platform-1440

    Hope this helps!

  • Hi saiyadjin,

    Just wanted to say thanks for your excellent guide! I was using Cocoon.io before and just game to update my app when I noticed they were no longer providing the service!

    The process worked really well for me, the only slight hiccup was that the link to Gradle actually downloads the ALL version and not the binary - other than that it was spot on, thanks!

    Jason.

Gravity17's avatar

Gravity17

Member since 28 Apr, 2017

None one is following Gravity17 yet!

Trophy Case

  • 7-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • RTFM Read the fabulous manual
  • Email Verified

Progress

10/44
How to earn trophies