Don't copy that floppy/events.

Discussion and feedback on Construct 2

Post » Wed Jan 25, 2012 3:15 am

Just to give everybody a heads up in case you want to copy some event sheet code between different projects, it might not show a warning message, BUT trust me, DON'T DO IT.

If you attempt to copy over an event sheet that contains references to objects which don't exist in the current project, Construct will warn you about that. When that happened, I tried to create the objects which were referenced and give them the same names, and then copy over the event sheet. At that point, Construct didn't throw any warnings or errors, everything looked just fine, the entire sheet copied over, and it looked like I was going to be saving some serious time, since I've got a lot of projects where certain event sheets (which I essentially use as containers for each respective sprite's logic) were nearly identical.

Fast forward to almost two hours later, where some of my scripts just weren't executing properly, and I finally narrowed it down some pick events were not matching known UID values, meaning that even though they appeared to be doing a pick on the same object as the last project with the same name, they obviously contained some address references that were different. Both the Pick operation code and the Create Object code was stuff I had copied from the aforementioned project's event sheet.

After re-creating the aforementioned picking and associated create object commands from scratch, the code worked. Anyways, this is just a heads-up to anyone thinking of trying to open up multiple projects in the project tab and trying to copy over event code. As it stands now, unless you really ENJOY putting tons and tons of Append Text statements in your code, I wouldn't recommend trying it.

-- cacotigon
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Wed Jan 25, 2012 1:39 pm

How did you get the UID you were picking with? If you hard code some precise UID before runtime it's definitely not a good practice (:
Because UID are affected on start of layout and on creation of object. Depending on some orders it might change.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Jan 25, 2012 2:28 pm

Oh I know that, I create objects on layout start and then save there UID values into associated global vars.
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Wed Jan 25, 2012 4:35 pm

I can't think of any reason re-picking the same events would fix anything. When you click export, if it's the same events, you should get exactly the same output. Are you sure you did not change anything else?

Also, if you can reproduce this in a new project could you post it to the bugs forum?
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,574

Post » Wed Jan 25, 2012 5:17 pm

@Ashley: I don't think that this is an event code copy problem, I think it's related to my prior misunderstanding of the Construct pick inheritance as in forum post:
Pick inheritance post

Thanks!
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Wed Jan 25, 2012 8:53 pm

I have copied events across a few times, without any trouble...
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400


Return to Construct 2 General

Who is online

Users browsing this forum: Yahoo [Bot] and 13 guests