How do I go about doing this?

For questions about using Classic.

Post » Fri Nov 26, 2010 3:38 pm

17 tiles? Well, you could use the alphabet as well.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Fri Nov 26, 2010 7:47 pm

It's pretty simple to read text without python. Each line separates rows and each space separates columns so each number can be any number of digits.
[url:15tfg6r0]http://dl.dropbox.com/u/5426011/examples3/textdata.cap[/url:15tfg6r0]
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Fri Nov 26, 2010 9:12 pm

[quote="Noga":25ezlxw2]Thanks for the example, I was looking for something like it.
Can you show me how to change the script to use double digit numbers?[/quote:25ezlxw2]

That's actually pretty simple. The .split() method does that nicely. Then I just convert the string values to integers.

Change this:
l.append([int(i) for i in j if not i.isspace()])

to this:
l.append([int(i) for i in j.split()])

But, as R0J0hound pointed out with his example, parsing the text in Construct can be quite simple. It works much the same way, as well.

Reading it in from a file should be pretty simple, though I've never done it. It looks as if an EditBox, or the Binary object can do it. Probably other ways, too.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

Post » Sat Nov 27, 2010 7:24 pm

Thanks guys, all that could've been done with 4 lines of code, what a shame :oops:
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests