How to block symbols

0 favourites
  • 2 posts
From the Asset Store
Physics Block Puzzle game template for Construct 3
  • How to block symbols for example:

    1)Russian letters

    2)!@#$%^&*()_+

    3)And how to make limit for simbols (like when you registering on site)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Instead of checking if it's a symbol you don't want, just check if it's a symbol you want. Do it under the "on text changed" condition, and the length can be truncated there too.

    global text allowed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    
    +-------------------------------------------+
    | textbox: on text changed                  |
    +-------------------------------------------+
        local text filtered = ""
        +---------------------------------------+
        | system: repeat 8 times                | system: add mid(TextBox.Text,loopindex,1) to filtered
        |System: find(allowed,                  |
        |  mid(TextBox.Text,loopindex,1)) <> -1 |
        +---------------------------------------+
        +---------------------------------------+
        |                                       | textbox: set text to filtered
        +---------------------------------------+[/code:20x8j9rq]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)