Creating a shop system via events...

So I'm trying to create an OoT-like shop system where the items are displayed on-screen and you select them with a cursor, but I'm having some issues.

The gist of it is that I have one event which uses GALV's plugin to draw the cursor to the correct coordinates based on active switches, another event which turns those switches on or off depending on the directional button (<-/->) that is being triggered, another event which checks to see if the OK button is being triggered (which then starts the transaction process), and another which checks for the Cancel button to exit the entire thing:

1673796364379.png

1673796459215.png


The end result works somewhat as intended, but is laggy (drops from 60fps to 4fps?) and glitchy. Certain things happen simultaneously that shouldn't (e.g., you can still move the cursor or even exit the whole process at inappropriate times) and I'm having issues getting the cursor to disappear once the player has selected an item.

Does anyone know of a better way I could accomplish this?
Maybe a shelf where you can pick up things by "talking" to the items? Or you can event it by using common events and show picture event commands. Scripts aren't necessery for this.
You might find this tutorial helpful:
It certainly shouldn't tank your framerate so badly if done correctly. Maybe you have a Loop with no Wait commands inside, or something like that.
You might find this tutorial helpful:
It certainly shouldn't tank your framerate so badly if done correctly. Maybe you have a Loop with no Wait commands inside, or something like that.
LOL you're right. I had accidentally set a 'Wait' command outside of the loop in one of the parallel events that checked for button input. The FPS issue is resolved now, at least. Thank you!

Edit: So another problem I'm having is that 'Wait' apparently creates a time window in which the button has to be pressed, meaning you have to keep tapping the button to get it to move:

◆Loop ◆If:Button [Right] is being triggered ◆Wait:1 frame ◆Control Switches:#0008 Shop_4 = OFF ◆Control Switches:#0005 Shop_1 = ON ◆ :Else ◆Wait:1 frame ◆ :End ◆If:Button [Left] is being triggered ◆Wait:1 frame ◆Control Switches:#0008 Shop_4 = OFF ◆Control Switches:#0007 Shop_3 = ON ◆ :Else ◆Wait:1 frame ◆ :End ◆ :Repeat Above
OK, so which one is causing the issue? I'm guessing your issue is probably because you have it in an else condition. The way you have it for the bottom one is correct: directly underneath where you check for input.
Strangely that doesn't work either. I finally got it working properly by omitting all 'Wait' commands and adding a 'Break Loop' after 'End'.
Parallel/Autorun events automatically trigger every frame they are not already active. So in that case, as you've discovered, you don't need a Loop command if you want the entire event to repeat.

"Button triggered" is only true if the button was not pressed last frame but is pressed now. "Button pressed" checks if the button is pressed this frame, regardless of what happened last frame.

It's more typical with these sorts of things to track which item is selected using a variable, rather than switches. E.g. variable is 1 if first item is selected, 2 for the second, etc: +1 when you move right (if not at max), and -1 when you move left (if not at min).
It's more typical with these sorts of things to track which item is selected using a variable, rather than switches. E.g. variable is 1 if first item is selected, 2 for the second, etc: +1 when you move right (if not at max), and -1 when you move left (if not at min).
Oof, yeah. After familiarizing myself with variables and remaking the shop with variables, it runs flawlessly and isn't structured so messily. Thank you for your comment!

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-shop-system-via-events.154129/