igortyhon's example is solid.
I just wanted to emphasize what he said about not running events every tick (60 times a second on most monitors). If something isn't expected to change every tick, then it's event should not run every tick. Only run the event as needed when something needs to be changed. Try to use triggered events for everything.
In this example specifically, you don't need to update the buttons until you click to make a new button.
Also in general, you don't need to use functions for most things in an event based system like Construct. They definitely have their uses, such as setting return values for what basically amounts to a custom expression, or repeating the exact same set of actions under different conditions, but when starting out I recommend working with the basic condition-action event blocks until you run into a situation you really NEED functions. Otherwise, it is just added complexity that you can get unnecessarily stuck on while learning.