Trying to create a jigsaw puzzle, designation with variable causes HUGE lag

Hello,

So I'm trying to create a jigsaw puzzle. You talk to someone and then a picture of a canvas gets shown, a bunch of puzzle pieces and a selection frame which you can move around. With the selection frame you can pick up pieces and drop them. All of that is pictures. I've been trying to control the selection frame with the show picture command and designation with variable. I have two variables, one for x and one for y of the selection frame. Then a conditional branch if (e.g.) button right is pressed down, add 96 to the variable. Now the problem is that once the puzzle starts the fps of the game drop to 2. I've tried different things and it just won't work properly. I can move around the frame just as intended. But the lag is absolutely unacceptable. What am I doing wrong?

Help would be highly appreciated.
Screenshots of your events would be more useful than a description - you're saying WHAT you've done, but to figure out lag, we need to know HOW you've done it.

My first guess would be that you have a parallel process, maybe with a loop inside (which might not be needed), and you don't have any wait command within the loop, so it's trying to process the whole thing 60 times a second. That'd do it.
@Shaz I'm sorry I wrote this late at night after going to bed, thought it might be a common problem with this way of showing a picture. It's true that there was a parallel event looping which had a conditional branch going if x button is pressed down. I got rid of that and tried using Yanfly's Button Common Events which I'm already using for a jump and run minigame. Unfortunately, that's not working either. The common event is not being played, I saw in the debug that the variable isn't even getting changed.

SaXDLME.png


6nRaYq4.png


I'm successfully using the button common events plugin for the jump and run so I have no idea why this is not working.
I found the issue for anyone wondering: By the d button cant be a button by default, I didn't know that. I'm just going to use the arrow keys for the puzzle.
Unfortunately I'll have to bump this because I ran into a major problem with using Yanfly's Button Common events.
C2bqrvm.png

The player can control the selection frame with the arrow keys. The problem now is that I can't get them to properly work outside of the puzzle. Yes, there's a plugin command to revert them but it resets all the time and even if I used that command on every single map, it resets after using the menu. It would be so good to have a way to just completely turn off that plugin some way. Like if there was a way to make it so that it only works when there's a certain switch activated. I'm afraid even that method would be a problem in the next chapter when smart jump is being used...
I'm thinking you might have a parallel process event somewhere (on the maps or in a menu) that's causing it to revert.

Or you've made the mistake that nearly everyone makes when using plugins - the plugin uses a switch or a variable, and you haven't checked that and reserved that switch or variable, and you're using it for something else.

If you need help with a plugin, you should provide a link so we don't have to go searching for it, and screenshots showing how you've got the plugin set up (plugin parameters via plugin manager) and how you're triggering it (could be notes, plugin command, etc). Otherwise you just leave us guessing at what might be causing the problem, and we have to ask you heaps of questions because we've got nothing to go on.
Sorry, here is the plugin
http://yanfly.moe/2016/01/23/yep-061-button-common-events/

iHgtAld.png


The plugin does this automatically and intentionally but it's not helping. When you open the menu it reverts the buttons to default automatically so that the player can use the menu properly. But after leaving the menu the common event buttons get switched on even if they were switched off beforehand. Can't even playtest like this because it's not possible to save. The plugin command for switching them on is only being used once - when you talk to the npc where you start the puzzle.
How about kicking that Plugin out of your Project and do it with standard Editor Eventing?
Button Press could be done with a Common Event, if you need certain things just exaplain them and we maybe can show Editor Eventing ways to achieve it.
@Bex I would love to not have to use that plugin honestly. Trying to make it work with normal eventing hasn't worked unfortunately because the conditional branches for player input in the parallel processes made the games performance crash to 2 fps.

What I need is a way to assign the arrow keys to move the puzzle's selection frames (by changing the variables assigned of the frame + respective piece if one is chosen). The puzzle itself works fine right now but it this isn't really working with the Button Common Events plugin for the reason explained above.
Trying to make it work with normal eventing hasn't worked unfortunately because the conditional branches for player input in the parallel processes made the games performance crash to 2 fps.

Which is the original issue you were asking for help with, but you didn't give us a chance to help you. I suggested it might have something to do with parallel processes and loops and not waiting, and asked for screenshots. But you decided to do something different instead and never even explored "fixing" the way you originally had it.

If we go back to the second post in this thread, forget everything after, and remove the plugin, we might be able to work it out. There are plenty of games that have puzzles where the "actor" is a "cursor" and it works without scripts/plugins, so I'm sure it's just the way you have it set up.
If you have a Paralell Event it can repeat 30 or more Times per second, and in your constellation you are executing the "show/move picture command" that often, that could be a reason for performance loss.

I would suggest to post Picture of the Paralell Event which you tryed first, which made your 2fps problem.
@Shaz @Bex Unfortunately by now the event with the parallel process doesn't exist anymore but all there was to it was if button right is pressed down -> do a bunch of stuff, no else branch and nothing else in the event. So yes it was repeating 30 or more times per second. I was neither using loop, nor wait. I assumed that with wait it could be that the player presses the button and nothing happens.

It's by far not the first time I use conditional branches in a parallel process and everything has worked fine so far.

It was similar to this just parallel:
Spoiler
xumRyAw.png

Maybe I should add that what comes after the if, so if the condition is met, is absolutely huge. This is what would happen if the if condition was met:

Spoiler
Bb6Hhj3.png

And here's a video of the puzzle operating properly but with the issue of the common event buttons getting activated everytime the map is changed or a menu opens:

That sadly doesnt help to fix your code, because the error is often in the smal detail.

If you want to solve the 30times per second and dont want to use wait commands, because they could make the gameplay less fluid, than one could use this:
Pseudocode Brainstorming:

Conditional Branch X Button pressed?
if yes do your stuff and Loop Command, Conditional Branch X Button Pressed? if yes than Wait 1 Frame and repeat Loop, if no than Break Loop.

Thatway its only executed once per button press, but you can repeat it as fast as you can push the button.
We could also implement that if you continue to hold the button that after a certain time (half a second for example) the cursor continues to move even without new button press.

Would that be something of interest?
@Bex I just went back to the eventing approach and now it - for whatever reason - finally works. Not using any common events this time. I don't know why this is. The event is absolutely massive but it works perfectly fine now. Thank you for pointing me to the right direction! I'm so glad this is finally fixed. Now I can go and get a headache from the next problem 😅

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-create-a-jigsaw-puzzle-designation-with-variable-causes-huge-lag.103981/