How do I Return An Object Name

Get help using Construct 2

Post » Thu Oct 09, 2014 6:00 pm

Magistross wrote:I always wondered why there wasn't any mean to retrieve the type name at runtime. It's not like the variable isn't there...

Using the Browser object's ExecJS expression, you can easily retrieve it though, it's just unconvenient.


Thank you! That works a treat :D

Yes - it is odd that it's not included. It's a feature that I would have benefited from many times before now. Feature request?
AVA ROWELL - simplisto.com - @avarowell - add me (simplisto) on Steam!
B
8
S
2
Posts: 23
Reputation: 1,138

Post » Thu Oct 09, 2014 6:55 pm

@simplisto @ramones I just tried creating a simple plugin to retrieve the type name and it seems I was wrong. Type names get aliased on publish (with or without minifying), to something like "t0", "t1", "t2"... It seems using your own instance variable is the only way. Guess it's back to the drawing board for you simplisto. :(
B
76
S
31
G
27
Posts: 1,015
Reputation: 20,790

Post » Fri Oct 10, 2014 10:47 am

Yeah - I just tried it once published and all I get is zeros. What a pain :(

I'd love to hear from @ashley on this one.
AVA ROWELL - simplisto.com - @avarowell - add me (simplisto) on Steam!
B
8
S
2
Posts: 23
Reputation: 1,138

Post » Fri Oct 10, 2014 1:22 pm

That's why it's not included, it's obfuscated at export-time to help prevent reverse engineering of your projects.

Just use an instance variable with the object name.
Scirra Founder
B
402
S
238
G
89
Posts: 24,637
Reputation: 196,071

Post » Fri Oct 10, 2014 1:42 pm

Ashley wrote:That's why it's not included, it's obfuscated at export-time to help prevent reverse engineering of your projects.

Just use an instance variable with the object name.


That's what I do, also makes it easier to use one sprite, multiple image frames and name them multiple things...
Blue, red, green, etc etc and can do it via array or start of layout... much more flexible.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,728

Previous

Return to How do I....?

Who is online

Users browsing this forum: dop2000, Yahoo [Bot] and 8 guests