Skip to Main Content
Construct 3 suggestions 21H2 - ARCHIVED

This suggestions platform is now closed and will no longer be monitored.

Please refer to this forum post for details on the latest suggestion platform.

Categories Scripting
Created by Antti Perälä
Created on Jul 7, 2021

Find and replace feature for strings in the event sheet

Almost all programming tools allow us to find and replace text.

Construct has a nice search feature with the shortcut ctrl+f, but it could benefit from the possibility to find and replace strings. Maybe the shortcut for find and replace could be ctrl+r.

The way it could work is that the user hits the keyboard shortcut and types in the text to be replaced and the text to replace with. Then the system scrolls to the first match in the event sheet. There is a button that the user hits to perform the replace.

Why would this be important? It can be really tedious to make changes to your games without it. For example, I have a game in which I first decided to tween item animations to player.X and player.Y. Then I realized that it's actually better to tween them to shopkeeper.X and shopkeeper.Y. Changing the tween coordinates for several items is very tedious. It would be nice if I could just do a find and replace for "player.x" and replace it with "shopkeeper.x".

  • Attach files
  • Wilson Percival
    Sep 28, 2021

    You can use a third-party text editor, like Notepad++. Just copy your code there and use Find & Replace then get it back to Construct.

  • Antti Perälä
    Jul 7, 2021

    Thanks for a swift reply Ashley! The replace object functionality is indeed very handy and I use it all the time. I understand the need to evaluate the expressions. Couldn't Construct evaluate the expression at the time when the user hits the "replace" button for a particular block in the code? If the expression is invalid, then replacement is not allowed.

  • Admin
    Ashley Gullen
    Jul 7, 2021

    A text-based find/replace won't work as it could result in invalid expressions, which Construct does not allow. You can already select a block of events and use 'Replace object' to swap object references in the selection, including updating expressions, though - maybe that already does what you want?

  • +4