[suggestion] Ajax plugin without singleglobal property

0 favourites
  • 9 posts
From the Asset Store
In this template the music plays without looping in your game
  • Ashely

    Sometimes, user might want to pass values to the completed callback of ajax. User could save these values into another data structure which indexed by tag name of ajax task.

    But how to index different ajax task if they has the same tag name?

    A possible simple solution is, let each ajax task be an individual instance, save values in its private variables. Then user could get response passed values directly under completed condition.

    To reach this goal, just remove "singleglobal" flag in edittime.js, imo.

  • Or add a condition: on any tag completed, and read completed tag back by expression , this might solve the problem, problity.

  • We would be very grateful if you could change this.

  • Yes please, feels like it's very hard to differentiate AJAX instances sometimes

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • But how to index different ajax task if they has the same tag name?

    Why not give each request a different tag name? That's what tags are for.

  • Ashley

    For example, user press "S" will fire a ajax request, print a serial number of sending while completed.

    User sends request with tag to "tag-" & sn , and add this condition-

    + condition: on  "tag-" & sn completed
    [ul]
    	[li]print "tag-" & sn[/code:39ntgjat][/li]
    [/ul]"sn" is a variable set before completed.
    
    This solution can not handle the case while waiting more then 1 request completing. It only gets one completing event.
  • Yes I think the current "static" tag system is hard to work with for "dynamic" requests, like launched all at once through a loop, hence with the same tag

    And while the Request URL action can currently allow to write a tag+variable name, the On Completed can't really make sense of it?

  • I think adding "on any completed" is the easiest and most consistent way to solve this. We're due a stable release soon but I'll look at it in the next beta cycle.

  • Ashley

    Official timer behavior has similar problem, too. Add "condition:on any timer" could solve it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)