Construct-bugs icon indicating copy to clipboard operation
Construct-bugs copied to clipboard

Can't move several Groups at the same time if they have 1 local variable with the same name

Open OverboyDev opened this issue 2 years ago • 15 comments

Problem description

We can't move several Groups at the same time if those group have 1 local variable with the same name.

Attach a .c3p

Bug_CantMoveSeveralFoldersWithSameLocalVariable.zip

Steps to reproduce

  1. Select both CHILD1 and CHILD2 Groups
  2. Move them (drag them) anywhere, for example, under the "Parent_MoveChildrenHere" Group
  3. It doesn't work

Observed result

chrome_wN4LSn6iO2

Expected result

chrome_L4dWNeHVEs

More details

It happens any time you want to move several groups that share 1 local variable with the same name. No matter where you move them.

Affected browsers/platforms:

First affected release:

System details

View details

PASTE HERE

OverboyDev avatar Mar 13 '23 10:03 OverboyDev

Note to self: also check variants in #6762 and #7985.

AshleyScirra avatar Mar 13 '23 18:03 AshleyScirra

@OverboyDev - the code behind this is extremely complicated, and also very risky to change (if Construct assigns the wrong variable names, it can corrupt projects, and this has happened in the past). Would you say this is important, or just nice-to-have? I would rather not change it, not least to avoid the risk of more project corruption bugs.

AshleyScirra avatar Mar 13 '23 18:03 AshleyScirra

I would say this is important as it happens to me almost each time I try to drag and drop folders in my projects. It's maybe not the top priority but this issue definitely needs to stay open until it's fixed. (even if it's in several weeks/months) Same for the other issues I filled today that you closed IMO.

OverboyDev avatar Mar 13 '23 18:03 OverboyDev

I would also note this as important - it's a near-daily issue when refactoring events or following best practices using standardized variable names in general.

NickR-Git avatar Mar 13 '23 20:03 NickR-Git

Looks like this issues https://github.com/Scirra/Construct-bugs/issues/5803

XHXIAIEIN avatar Mar 15 '23 10:03 XHXIAIEIN

I have been trying to replicate this bug for months! Thank you for posting it.

Alaadel avatar Mar 22 '23 11:03 Alaadel

@OverboyDev - the code behind this is extremely complicated, and also very risky to change (if Construct assigns the wrong variable names, it can corrupt projects, and this has happened in the past). Would you say this is important, or just nice-to-have? I would rather not change it, not least to avoid the risk of more project corruption bugs.

Until a final solution is found, maybe C3 can help the user solve it manually by offering a more useful tip? For example, when the user tries to drag the group and it fails, C3 would highlight the variable in question and tell the user to rename this variable to solve the issue.

Alaadel avatar Mar 22 '23 11:03 Alaadel

ah yes this has been happening in recent months! I couldn't figure out what the issue actually was! yeah it seems like its a pasting scope issue. The code that evaluates variables and if there's a violation happens before the variables are put into scope context. but it's strange it tells you it "can't find it"

c3_editorbug

jobel0092 avatar Apr 25 '23 19:04 jobel0092

This might be a larger ask, but one of the things that would VERY much help and could potentially solve this issue. If there was a 3rd state to Events/Actions. Currently the states are "active" and "disabled". But I think a 3rd state of "invalid" would be really nice. Sort of how Else turns red if you do something wrong to the event before it.

It would be nice to paste a bunch of events from other projects where object names don't exist, variable names don't exist etc... Allow the user to paste it, turn it all red and "disabled"/"invalid" meaning it is ignored as Events. And allow the user to edit it and fix it.

jobel0092 avatar May 11 '23 03:05 jobel0092

That would be an extraordinarily complicated change given that there's already a large amount of highly complex code in this area that's been refined over a period of years. I'm afraid that may mean a change of that extent is infeasible for now.

AshleyScirra avatar May 11 '23 14:05 AshleyScirra

could you perhaps paste events as "comments" and allow a user to edit them? Although I suppose there are dependencies with changing variable names and "replace object", but that is the crux of what I think would be extremely helpful like you do with line coding; cut&paste a bunch of "invalid" code then fix it up before compiling.

but I understand its much bigger issue to tackle.

jobel0092 avatar May 11 '23 16:05 jobel0092

I'm afraid when there is a large amount of highly complex code that has been refined over a period of years, there are no simple changes.

AshleyScirra avatar May 12 '23 10:05 AshleyScirra

yes, I can imagine!

I suppose what I really want is an easy way to edit what is on the clipboard before pasting it. Which would probably be a feature request. this stuff: {"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"x","comparison":0,"second-value":"0"}}],"actions":[{"id":"set-boolean-eventvar","objectClass":"System","parameters":{"variable":"abilityReleased","value":"false"}},{"id":"set-boolean-eventvar","objectClass":"System","parameters":{"variable":"abilityPressed","value":"false"}}]}]}

jobel0092 avatar May 12 '23 15:05 jobel0092

current saimple solution is move group one by one then it works.

luckyrawatfreax avatar Nov 22 '24 12:11 luckyrawatfreax