jsutton's Forum Posts

  • Does anyone fully understand "pick" and "for each"

    Just an example: 10 instances of text1, 5 of them have text1.var=1 and 5 have text1.var=2

    "pick all" does just that, easy enough.

    "pick by comparison" picks 1 instance based on criteria

    The question I have is: Other than using "pick all" AND "pick by comparison" is there a way to select all 5 of the text1.var=1 ?

    One would think "for each" with "pick by comparison", or "for each" and "compare 2 values", or "pick all" and "pick by comparison" would work, but only the latter will select all 5 of the text1.var=1.

  • Addendum: I was just doing a mixed GET/Post and realized you're doing a GET only.

    On your ajax the send "" is where your POST should go. I'd bet if you change nothing, run your code in the browser, open the Developer tools and find the error url. Copy and past that into the address bar, 99.9% chance you're getting an error 414.

  • Hopefully I can help, and should probably do a tutorial on this.

    If some of this is too basic, sorry just covering the bases.

    1. The picture must be sent on the data line of the ajax request (in C3) to be a POST *thus avoiding error 414 issues* (the URL line in C3 is actually a GET line and you can mix GET/POST as needed). (servers usually limit GET since it goes in the browser URL, this helps avoid DDOS issues)

    2. Urlencode(your data) handles your *.php str_replace items making that unnecessary.

    3. No need to send the "data:image...." to the server unless you just want to, *wasted data*.

    4. You might do a test TextInput box to show your base64 data just to double check it's formatting.

    5. Post to server, check and see that it made your data make it (in phpmyadmin, you might want that cell to be longtext

    6. On retrieval, laod from "data:image...." and ajax.lastdata .

    On a side note you can "compress" the image by using drawingcanvas (it can be dramatic, especially if there are a lot of images).

    ***I just went through this the other day and have it working without issue. You might look at this post and read about the errors I made in the discovery process.

    construct.net/en/forum/construct-3/how-do-i-8/loading-image-binary-157901

  • Do you have a hosted website?

    Asking because in the past I tried using some of the plugins (what can I say, I'm cheap!), but I found that having access to phpmyadmin makes everything much easier.

  • RBuster Sorry no, I don't have the plugin or dropbox.

    Based on what Eren stated, the find replace method looks like it should work.

    "As all Firebase Realtime Database data is stored as JSON objects, when you create your own keys, they must be UTF-8 encoded, can be a maximum of 768 bytes, and cannot contain ., $, #, [, ], /, or ASCII control characters 0-31 or 127."

    xspdf.com/resolution/59563609.html

    A find and replace looks like your easiest option since you can do everything on your side before sending. Then just reverse it when you pull the information back.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley

    You improved function performance for long loops by a huge (understatement of 2021) amount compared to c2.

    Nice (expiative) job! It really is impressive. Thanks

  • Likely, nobody knows your issue since it's an addon (ie, outside the norm).

    But, I'll venture to guess at a couple of things you might try (and I'm assuming a lot here).

    My guess is that Rex is using an ajax call and there is a php file somewhere on the back side passing info to a firebase database.

    Sounds like the "." is being read in a way you aren't intending.

    1. I'd try sending the email address as encode(email) first. Just to see if that solves it as an easy fix.

    2. On your side (c3), you might try a find and replace the "." with a "+" sign.

    condition: compare 2 variables - find(email,".") not equal to -1

    Action: set text to - replace(email,".","+") (doesn't have to be a "+", just the something that will pass via the ajax call without breaking the code. Reverse when you pull back the info from firebase.)

    Past that I pretty clueless.

  • Awesome, ty ever so much! Bookmarked this page.

    On a side note: I assume most people would use function.params to handle things like this and just have 1 really long function with many conditions?

    Other than length of code (mine way will be more lines of code and more functions, but all copy/paste) is there any real advantage in speed, functionality? ie, recursive vs multiple functions*

  • Makes sense, ty.

  • In C2 we could just "call function("name"&str(var)) and it would call the function.

    I see the static functions in the "add function" section, no way to set a variable in the name.

    c3_callFunction("Populate_Feed_1"); as a js way of calling it (is it possible to add a variable here?

    I've tried every combination surrounding what I think should work to no avail.

    expample: c3_callFunction("Populate_Feed_"&str(localVars.feed_message_number));

    The only thing I've found that works it to mimic the static call

    c3_callFunction("Populate_Feed_1");

    Not sure if this is just a syntax issue, or if it's not possible anymore.

    Thanks in advance.

  • Post a snip of the character collision polygon please.

  • I'm at a loss on this one. For whatever reason this loop leaves 1 empty element.

    I can reverse/sort and just pop it manually. But, would like to understand what the heck I am doing wrong.

    (I also did this using loopindex and for each X, ... same results, it leaves 1 empty element.)

    Any clue?

  • Not sure the exact cause, but a couple suggestion.

    1. Check your collision polygons (sometimes they start with bizarre shapes).

    If that doesn't help

    2. Check your "condition" (on collision, is overlapping, etc.) you might need to add a distance if the collisions are not happening as you like (or use an offset, etc.)

  • Line of sight would allow your enemy ai to acquire it's target (your player). Pathfinding could be used to have ai move towards the player (which you could update occasionally to see if the player or any obstacles have moved). Then once the player and ai are within your specified fire distance have the ai shoot. You might look at the turret tutorial as well for the ai fire angles, spawning bullets, etc.

    It's all about what you want. If there are no obstacles, or if you just want it simple, you could move towards player x,y. There are about 50m combinations you could use for what you want to do, it's personal preference.

    In your case, I would pull up the "Ghost shooter tutorial" and save it as a new file. Then test different ideas using it as your base-code.