jsutton's Forum Posts

  • Curious if there is another option to using a massive number of sub-events.

    Import 150 items into an array via AJAX, then want to order them. (this is for a chat screen that allows for sprites etc to be inserted/created in chat log)

    Currently:

    Event...Function - On "X"

    Sub-Event...Array - value.at(0)=xyz then create textbox at (1,1)

    Action...set textbox width 500, set textbox height to textbox.height (allows grow/shrink textbox height to match text)

    Sub-Sub Event...Array - value.at(1)=abc then create textbox at (1,textbox.height+10) (allows next textbox to be created just below the first textbox)

    The problem is the last sub-sub event will be 148 recessed (bad wording probably, indented?).

    Just curious if anyone has a thought on a better solution...if not no worries, this does work it just looks ugly and is hard to follow.

    Thanks

  • Posting this since I spend 3 hours on this silliness and thought I'd help someone else if it ever comes up again.

    #1 Have .php file, works fine in browsers.

    #2 Have AJAX on send...tag, data, post...updates the database.

    ***Everything works and yet...still triggers Error*** (error in construct and not triggering next events*)

    Could find nothing on C2 forums that helped figure it out...(didn't know what the problem was, so hard to find a solution)

    Finally I went to the browser developer tools to see if anything was there.

    On Mozilla: Developer, Console

    Scrolled down to see:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.***etc., etc.com?call=1234 (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

    After 5 minutes...the "L"s in Allow were "1"s... (no clue how that happened on a copy/paste), hope this might help others to self identify AJAX issues.

  • Call this one closed. I'm using sprites in multiple families and loading data from arrays and hard code. I tried to recreate the issue to no avail, so it's in my code (seems the most obvious reason anyway).

    I changed family variable from one family to another and it works fine...don't know why, atm it works fine so don't really care. Moving on lol.

  • Formula (var.a/var.b)*var.c

    All are instance variables are from different sprites.

    All show to have no decimals in debugger.

    var.a =5

    var.b=375

    var.c=100

    (5/375)*100=1.333333333

    *** In debugger the number returned is 1 *** Should be 1.333333333 ***

    I do not have a floor or a round used on any of these numbers and the value returned makes zero sense to me.

    Any thoughts?

  • gumshoe, thanks for your response!...turns out I'm just a moron!!!!!! sigh...

    I just happened to test a blank user name on the database to see if i could pass all the data and only half passed...turns out that when I switched layers it was deleting my sprite and creating a new one with empty variables (needed to update the database). Fixed that and it works fine.

    Basically I learned, if the php is working on URL it should work fine with construct.

    Case closed.

  • To begin i have watched Arcade Ed's videos (thanks Ed!). I can INSERT INTO without issue, echo, and pull info into an array without issue.

    my issue, and I've been stumped for the past 2 days...

    on the php side:

    $a = strip_tags(mysql_real_escape_string($_GET['a']));

    $b= strip_tags(mysql_real_escape_string($_GET['b']));

    $sql = mysql_query("UPDATE table SET a = '$a' WHERE b = '$b'");

    if i go to the browser and change a or b it loads into the database fine, for example:

    http://localhost:8080/doa/bc.php?a=6kala8sh9aaahdhf163s;76;h9dkf1kjkakfdffjj9jafk677f144&b=Bob

    (easily changes by:

    http://localhost:8080/doa/bc.php?a=fjkdlssdlkfslk&b=Tim

    REPEATING: BC.PHP WORKS FINE FROM CHROME BROWSER

    however, when i use construct to send an ajax "POST"...

    "http://localhost:8080/doa/bc.php?a="&Account.ID&"&b="&Account.Username

    nothing happens. It's the exact same code, so I have no clue why this isn't working.

    Oddly enough, I can easily change bc.php to INSERT INTO and it works fine from construct but it creates a new row [due to auto increment] or overwrites my existing fields (which I don't want to happen)...any thoughts?

  • I have the same issue...can pass text all day, but not global variable set to text.

  • Not anything I've messed withthis , but if I understand your problem...defining the other sprite as an obstacle and refreshing around each every x seconds should work...or so I would think. Both sprites much be obstacles respectively. I've been running multiple copies of the same sprite and defining hits on overlap...works fine and kinda the same issue. Just havta be careful not to refresh the whole thing each time or you'll run at negative fps lol

  • Couldn't u define the obstacles for each sprite?

  • Turns out this I'd doable....but the "associate with" jacks it up an for some reason restricts copies to 2. A msg substited works fine for condition and presto one object synced as copies. I was trying to not have multiple copies of a single troop type, its clunky but works. Since each two player battle is in a separate room I eliminated the message from host as a trigger and just left it blank...helped the speed and who cares if the peer can't see the host ID...its 2 player. Any who just thought I would update...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just an update...works peachy.

  • I'm messing with a diff messaging issue and think I figured this out but havn't tested it...

    PEER: on peer message "" "tag" "/"&multiplayer.peeralias (or ID)&"|"&"Hello, this is the message"

    HOST: on peer message set a variable to tokenat(multiplayer.message,0,"|")

    and a variable to tokenat(multiplayer.message,1,"|")

    (I'd use global variable set to text)

    then just forward the message to peer

    HOST: send msg "variable 1" tag"PM" msg variable 2

    then just have it display in a diff color or some such but normal paste into text area

    Hope that makes sense, seems like that would work fine (again havn't tested it).

  • I'm not an expert, just trying to help...that said, when you double click a sprite it shows frame speed and repeat counts...hope that helps.

  • After fiddling for a week, I still can't get the "for each" to work on multiplayer (info relays) so I just made separate sprites and did it long hand, works fine. Someone figures that out share the wealth

  • Look up Rex rainbow "moveto" plugin. Or the behavior Line of sight. (moveto is a nice plugin if you don't already have it installed)