How do I load a text list inside the dropbox list

Get help using Construct 2

Post » Sun Dec 14, 2014 6:16 pm

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
B
41
S
16
G
7
Posts: 1,750
Reputation: 9,963

Post » Sun Dec 14, 2014 7:00 pm

can someone help with this?
B
41
S
16
G
7
Posts: 1,750
Reputation: 9,963

Post » Sun Dec 14, 2014 8:08 pm

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.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Sun Dec 14, 2014 8:33 pm

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
B
41
S
16
G
7
Posts: 1,750
Reputation: 9,963

Post » Sun Dec 14, 2014 10:02 pm

i still need help on this unsolved problem with the list object.
B
41
S
16
G
7
Posts: 1,750
Reputation: 9,963

Post » Sun Dec 14, 2014 11:26 pm

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.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Mon Dec 15, 2014 11:19 am

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
B
41
S
16
G
7
Posts: 1,750
Reputation: 9,963

Post » Mon Dec 15, 2014 3:16 pm

no solution for this?
B
41
S
16
G
7
Posts: 1,750
Reputation: 9,963

Post » Mon Dec 15, 2014 6:09 pm

What does your AJAX.LastData look like ?
B
76
S
31
G
27
Posts: 1,015
Reputation: 20,790

Post » Mon Dec 15, 2014 6:23 pm

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
Last edited by imothep85 on Mon Dec 15, 2014 6:29 pm, edited 1 time in total.
B
41
S
16
G
7
Posts: 1,750
Reputation: 9,963

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests