How do I load a text list inside the dropbox list

0 favourites
From the Asset Store
94 Inside buildings views - Isometric view - PNG transparent - 2048x2048
  • hello to all

    how i can load a list.txt with ajax inside the object list, i don't want the list to have names like items01,02 etc but the names from my list.txt hosted on the ftp

    how can i hange he names of the items by those inside the list.txt

  • can someone help with this?

  • I'll suggest to take a look on the Ajax object (which let's you retrieve a project file, which can be your List.txt), and the tokenat system expression to retrieve each elements of the list, separated by a specific character.

  • well i know how to use the ajax object but i don't know how to change the items, inside the list objects, and replace all the items by thoses inside the list.txt

    i tried a lot of differents stuffs, but nothing work

  • i still need help on this unsolved problem with the list object.

  • I do not have C2 rigt now, but lets try.

    first, if needed, you disable your list with the set enable action(as there is no choices until the text file is loaded)

    Then you request the file with an ajax request, I will assume the file is in this format:

    Item1|item2|item3|item4

    when the request is completed, you have access to the content of the text file with AJAX.LastData, so:

    conditions

    On Ajax Request completed

    system>repeat tokencount(AJAX.LastData, "|") times

    actions

    List>Add Item tokenAt(Ajax.LastData, loopindex, "|")

    then you enable the control, that should work.

  • well tried but i thhing i have done it wrong bcause its not working, also don't forget i use an external file from my ftp with ajax a list.txt, where i put inside " object1, object2, object3 etc" and thats what i want inside the list object

  • no solution for this?

  • What does your AJAX.LastData look like ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the ajax just look for the file "bracelets.txt" on the ftp inside the file i have a list like this:

    bracelet01

    bracelet02

    bracelet03

    bracelet04

    bracelet05

    bracelet06

    etc...

    thats what i want in the list object instead of the "items" names

  • Well if you are actually able to load the file with AJAX, populating a list with it shouldn't be hard. First clear the list if it's not empty, then loop through all "tokens" of your data using "newline" as separator.

  • its a little bit omplicated for me can you help me with a capx?

    thanks in advance

  • Sure, here's a simple example using a project file.

  • i see how its done, but the thing is, the file is external of the project, need to be loaded from an ftp not from inside the project

  • I thought you said you had that part covered? Fetching the file from FTP will probably require you to write a server side script that fetch the file and return it as a response.

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