MasterNedyah's Forum Posts

  • I have a text object with the text: Hello World!

    This is aligned left and the object is set to bbcode.

    I have a sprite that when clicked should align the text center.

    EVENT

    Touch--> Sprite

    ACTION

    TextObject.style.textAlign = 'center';

    I also found this example but could not seem to get it to work. Do I need the line with const and the EventListener?

    const TextObject = document.queryselection('.text p');

    const Sprite = document.queryselection('.align-center');

    Sprite.addEventListener('click', function() {

    TextObject.style.textAlign = 'center';

    })

  • I have a few applications, but one of them is if the user chooses wrong then the sentence becomes all caps. When they make changes and get it right then it goes back to sentence case.

  • Update, Result needed: I was on a walk at the beach when I saw David and Sarah.

  • Text object named BBCodeText

    Sprite named Button with a variable named Click

    Text object has text: I was on a walk at the beach when I saw David and Sarah.

    CONDITION (Add Capitalize)

    On tap gesture Button

    Button variable Click=0

    ACTION

    Set text to uppercase(BBCodeText.Text)

    Button set Click=1

    Result: Text is all caps

    I WAS ON A WALK AT THE BEACH WHEN I SAW DAVID AND SARAH.

    At this point, I have other conditions that would give options to underline. So the text could look like this.

    I WAS ON A WALK AT THE BEACH WHEN I SAW DAVID AND SARAH.

    CONDITION (Remove Capitalize)

    On tap gesture Button

    Button variable Click=1

    ACTION

    Set text to ?????? Is there an option to remove the uppercase. I know there is a lowercase

    option but I need sentence case.

    Button set Click=0

    Result needed: I was on a walk at the beach when I saw David and Sarah.

    I thought about saving the original text in a variable and replacing the text but it removes any bbcode I might have added.

  • Thanks oosyrag!! You reply helped me again. Much appreciated!!:)

  • I have a variable named gFindWord = dog

    So the initial text would look something like: mouse rabbit dog elephant

    The text is separated into an array. I want to find the word dog and then insert cat before and after dog.

    The goal is after clicking the button the text would look like: mouse rabbit cat dog cat elephant

    Unfortunately, I am getting something like this: cat cat mouse rabbit dog elephant

    I added a variable called gWordX in hopes to identify the CurX and then use CurX to insert cat. Still not working. Do I even need to identify CurX? Can't I just use CurValue?

  • Fabulous!! Thank you:)

  • Original text in text object: Cat Fish Bunny Turtle Goat Horse Pig Eagle Dolphin Elephant Lion Tiger Bear Bird Worm

    The text is separated by spaces and placed into an array. Then I have a button that inserts a word (in this case "dog") into the array.

    Array now looks something like this: Cat Fish Bunny Turtle dog Goat Horse Pig Eagle Dolphin Elephant Lion Tiger Bear Bird Worm

    I need to take the information from the array and update the text in the text object. I used JSON to get the text. Unfortunately, the text includes brackets, quotes, commas, etc.

    How can I get the text inside the quotations, without commas but keeping the spaces?

  • I apologize for the delayed response. Thank you so much! Adding the compare Touch.Y resolved the issue. Yeah!!!

  • How do I make unseen part of objects not clickable in a specific area? Note: the object set is set to visible. The object passes behind another object before the viewer can see it.

    Everything inside the green box represents the viewport size. Objects move using a scroll bar and travel on/off screen.

  • Works:) Thank you so much!!!

  • Thanks for your suggestion.

    When I do this it gives a number for the whole string.

    For instance: Was your day better today or yesterday? I get 39 because it is including the whole string.

    I just want the identify the longest word in the string. In this example "yesterday" should come out to 9.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How do I identify the longest word or "group" of characters/textwidth in a string?

    For instance: Was your day better today or yesterday? The longest word would be "yesterday" = 9

    OR: Is there traffic in downtown? The longest word would be "downtown". = 8

    I don't need to know the word just how many "characters" so that I can determine width.

  • I added a delay and it fixed the error. Thanks you!!!!

  • Thanks for the help with posting my image! Could you take a look the code? For some reason the set height works but the width does not.