AllanR's Recent Forum Activity

  • I have been using a very old javascript Pop-up Calendar with TextInput for years. It worked fine in C2, and I thought it was working in C3, but I have a strange problem...

    when I click on the TextInput, the Calendar pops up fine, I can select a date by clicking on it, and it looks like it updates the TextInput's Text value. But C3 doesn't realise that the value has changed.

    I made a quick test file to illustrate the problem:

    - the TextInput field has a default value, click on the Button and the TextInput value is added to the Text object on the right.

    - click on the TextInput field, select a different date

    - Click on the Button again, and the TextInput value hasn't changed, even though it is displaying the new date.

    if you manually start to edit the TextInput value, it then uses the new value.

    Is this a bug in C3? or is this a problem with the old javascript?

    The TextInput value gets set in the tcal.js f_tcalUpdate function. the browser's DevTools shows the value changing, but C3 still has the old value

    https://www.rieperts.com/games/forum/PopCal.c3p

  • did you try to URLEncode the text before you send it? there is probably a character in the text that is causing trouble.

    check the end of the string that PHP gets, and then compare that to the text in C3 and see what is immediately after that point... if it is an '&' then it is telling php that the rest is a new parameter.

  • ok, after a lot of testing, there is definitely a bug. I was about to make a bug report when I saw one from yesterday that helped me further pin point what is happening...

    When the Text object has BBcode enabled, the text in the object gets shifted down. It does report the correct text height, but since the text is shifted down, it gets cut off in your case.

    So, until Ashley fixes the bug, you can turn off BBcode for your Text object and it will align the way you expect.

  • well, I played around quite a bit...

    here is my file:

    https://www.rieperts.com/games/forum/ocr.c3p

    the bad news is that the ocr.space web site does not detect any text (numbers) in your sample image. I made a test image and it worked great on mine. So, the font on the multi-meter seems to be a problem. I tried setting the language in the request to both Eng or Korean (because they said that might work better for numbers only) and neither worked.

    also, I could only get the ocr.space site to work with the GET method, which requires uploading the image first to a web site and passing the url. Converting the image to base64 and POSTing that to the site ("api.ocr.space/parse/image") only returned errors. I tried from C3 and downloading the Postman app (which gave better error messages). It seems to be a problem with their site - not C3 or me doing something wrong. Posting the base64 gave a 404 "not found error", posting a url to the file gave a filetype not detected, even if I overrode the filetype using the filetype key. The same images passed to "api.ocr.space/parse/imageurl" (which is the GET method) worked fine.

    that is all I can do...

  • I did a test and it worked fine for me... I would have to see your project to look for a problem.

  • very interesting... I am working on a project that did start in C2, but I moved it to C3 and it is using the C3 runtime. I was sure it was still requiring a tick before I could get textwidth or textheight, but I just tested it and it does work as Ashley said.

  • any canvas you create will be floating above the Construct canvas (the way dom elements do - TextInput, Buttons, etc.). So you can't have sprites above, as far as I know.

    but you can have javascript load images, process them and load that into a sprite.

    I was working on adding a javascript program that can resample/resize images a couple weeks ago - see this thread:

    https://www.construct.net/en/forum/construct-3/scripting-51/resize-image-load-sprite-154801?kws=

    and this thread helped me get image data passed between javascript and Construct too:

    https://www.construct.net/en/forum/construct-3/how-do-i-8/exportimport-image-clipboard-154984#forumPost1021592

  • to do it in C3, you may be able to add the tesseract.js scripts from the GitHub reference link given in the Rex plugin page. But that may be a lot of work.

    The ocr.space link looks like it would be fairly easy to use with AJAX calls. If you have a URL to the image, then a GET call would be easiest. Otherwise you would have to convert the image to base64 and do a POST call. The results would be in a json format in the AJAX.LastData

    where are the numbers coming from? there could be easier ways as well...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • textheight does give you the full height - from top to the bottom of those letters you mentioned.

    the problem you are having is that you can not calculate textheight with a text object in the same tick that you create it. (well, that is what my testing turned up - but I don't remember if I tried calculating textheight in the next top level event, which might work)

    what I ended up doing was placing a global, invisible text object off screen on the first layout so that there is an instance available that already exists, and use that to calculate textwidth and textheight for the buttons I make.

  • EDIT: just saw dop2000's version - I like the way he did it better than mine! :)

    OhhBaby in your first post you asked why it isn't working. I tried your file, and had it log when it created each item (the tickcount at the time it created a sprite).

    I would argue that it is doing exactly what you are asking it to do.

    in the first function it waits half a second to create each top sprite - and they are created at 30 ticks, 60, 90, 120, and 150 ticks.

    after each top sprite is created you call the bottom function and have it wait 1 second before creating each bottom sprite.

    the bottom sprites for the first top sprite are created at 90 and 150 ticks.

    the bottom sprites for the second top sprite are created at 120 and 180 ticks

    the bottom sprites for the third top sprite are created at 150 and 210 ticks

    the bottom sprites for the fourth top sprite are created at 180 and 240 ticks

    the bottom sprites for the fifth top sprite are created at 210 and 270 ticks

    so, maybe that isn't what you had in mind, but it is waiting the amount of time you ask it to. You end up with a couple sprites created at 90 and 120 ticks, 3 at 150 ticks, 2 at 180 ticks, etc.

    I am guessing you wanted it to wait until both bottom sprites were created before it went on to create the second top sprite. You added the "wait for previous actions to complete" after calling the bottom function but that would only affect actions added immediately after that point - it doesn't prevent the loop above it from continuing to run.

    I made a sample how I would probably do it... The CreateBottom function hasn't changed, but the CreateTop had to be done differently.

    https://www.rieperts.com/games/forum/asyncLoop.c3p

  • the way I made the circles was by using the paint brush tool - I set the brush size to the side of the sprite (250 or 500), put the mouse in the middle and clicked. Then set alpha to 0, made the brush smaller (about 246 and 494 I think), and clicked in the middle again.

    You could make a 1 pixel circle by reducing the brush by only 2 pixels (leaving 1 pixel on each side), but I thought the circles didn't look as solid as the grew larger... for the 500 pixel circle I reduced the opacity as it grew to see how that would look...

  • or you could start with a higher-res circle and a lower starting scale rate...

    I made a 250x250 circle and a 500x500 circle

    https://www.rieperts.com/games/forum/testGrowCircle2.c3p

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies