jsutton's Forum Posts

  • monaca.io is the cat's meow. Makes Intel's old XDK uploads look complex by comparison. I would highly recommend it to anyone. (oh, and it also makes storekey adds/changes extremely simple)

  • monaca.io

    Took me a whopping 15 minutes from upload to pending publication.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have used Intel XDK several time, it was pretty simple. Phone gap keeps giving me a debug apk. (don't tell me to unclick debug or that my key is wrong, etc....they are correct) I've been at this for 4 days and am getting pissy lol.

    Someone should write an app that has step by step instructions (because the key issue is a huge pain in the rump).

    I mean seriously, it took 2 days to write the app and now 4 days to publish...nutty.

    Any thoughts would be great. Thanks J

  • As long as the triggering event On Completed with a tag is run, within that event, AJAX.lastdata will give you the data from that specific tag's request. It doesn't matter if it comes back before, after, or at the same time as another AJAX request.

    This addresses my question...and I'm not sure that's 100% correct and trying to verify.

  • Right, but if I call ajax 1, and ajax 2...and the data returned is ordered 2,1...and returns at the exact time.

    I'm already figuring this out a little better, and I'm 99.9% sure the answer is...

    When construct executes based on tag xyz, it does not care whether the lastdata matches the tag xyz....it just goes by what's in the lastdata.

    No biggy, but I'll have to add a column in phpadmin and use it as an criteria for

    example:

    on "xyz" completed &tokenat(AJAX.LastData,0,"|") = "xyz" then do whatever

  • I have found nothing on this and should be fairly simple.

    Say we have 2 ajax requests that trigger at the same time, does construct ajax.lastdata have an identifier tag for the lastdata or is that something that should be added/compared via the php/sql side?

    Meaning, does construct care if the data matches the request (I assume not).

    Unless someone knows, I will start planning to put identifiers into all my ajax requests.

    Thanks in advance!

  • As almost every time I ask a question, simple answer...

    I changed the echo on .php to 111 and compared to 111

    Closed

  • I have about 50 ajax requests in my game, all work fine (so no issue there).

    My question is this: When Ajax is called and returns "None" is there an easy way to compare this for a condition?

    I have tried:

    tokenat(AJAX.LastData,0,"|") not equal to "None"

    AJAX.LastData not equal to "None"

    AJAX.LastData not equal to 0

    AJAX.LastData not equal to ""

    (on a side note, null returns in ajax are squirrely, sometimes the have a space at the end, sometimes not depending...and no rhyme or reason I can tell)

  • Solved:

    The above conditions were fine (first time I've used loopindex).

    The action needed to be str(array.at(array.curx,15))...likely don't need the str()

    The rest of the issues were all me, per the norm

  • My best guess at answering my own question follows: (it doesn't work and seeking guidance)

    Array, 400 width / 30 height / 1 depth

    Text Box

    Condition -

    Array compare at XY: value at (loopindex,0) =8 and Array compare at XY: value at (loopindex,11) =Dog

    Action -

    set text to str(loopindex,15)

    I'm not sure loopindex is the right way to go...especially in the text ??str(array.curx,15)??

    Suggestions appreciated.

  • Got this down to 2 functions, variable, and a call...much happier with performance.

    1. Call function 1...add 3 to variable (allows me to set the start position for first chat post) then call function 2

    2. Call function 2 ...create next chat below first chat post, add 3 to variable, call function 2 again while the variable is below 150, else set variable to 2....ie, stop. (this is wrong I know, but it's creating a loop [manually] and I have no clue how to code that properly)

    Still if you wouldn't mind posting how the 2d array tokenat would be written and how the loopindex %3 (also the trigger events) would be written.

    Thanks for the hand holding!

  • TBH, not sure how to post a project file (also I'm 10k events into this, 2 years of work).

    Would you mind posting how you would parse the tokenat to a 2d array, I can figure it out if I know that trick.

    Same for the the loopindex %3, not sure where that would be placed.

    [As an update I did switch out to using sprite font and it is much much faster than textbox and cut down the number of sub-events to 6...still would like to know loops better, that seems like handy stuff and not much in the way of advanced tutorials on the web]

  • My game has a chat area that contains text (from the array...name/text/variable).[array.at(0), array.at(1), and array.at(2)]

    If the variable is 1...then it creates a text box, adds the text and moves to the next set from the array [array.at(3),4,5...etc.]

    However, if the variable is 2 it creates a textbox and a sprite (for example, request defensive troops from other members of the game) If the variable is 3, creates textbox and sprite for whatever else I want...

    I'll check out loopindex...not played with that.

  • I switched this up a little and used 50 functions (which is also not idea, but is way easier to follow the flow and takes about 1 second) since it allows the use of "else" statements for each array.x

    array.at(0) =1 then do abc (then run next function)

    else array.at(0)=2 then do xyz (then run next function)

    array.at(1) =1 then do abc (then run next function)

    else array.at(1)=2 then do xyz (then run next function)

    Still looking for alternatives, any thoughts are greatly appreciated.

  • I learned arrays by playing around.

    Make a new .capx and test this out.

    Add array, touch, sprite1, sprite2.

    Make your array 3,1,1

    Event Sheet

    On start of layout:

    set value of x 0 to 100 (array, set at x)

    set value of x 1 to 400

    set value of x 2 to 200

    on touch sprite1: sort array

    on touch sprite2: reverse array

    Then run this in debugger preview (that way you can see how the array changes as you click)

    Good Luck