MasterNedyah's Recent Forum Activity

  • On function FUNCTION 1

    subevent: Array -- For each X element

    subevent: System -- Array.CurValue > 0 Action: Add Array.CurValue to globalvariable

    subevent: Empty Action: Call FUNCTION 2

    The for each X element event is not completely finishing before calling Function 2. I am not sure what condition to use to prevent this from happening.

    I have tried an else event but that did not work.

    Note: the values in the array are unpredictable.

  • I have an Array with different numbers. I need to search the array for the highest number without reordering. I also need to know which cell has the highest number. For some reason, the global variables remain at 0 when I use this code. What am I doing wrong?

    globalvariableValue=0

    Event: Array For each X element

    Sub-Event: Array Current value > globalvariableValue

    Action: Set globalvariableCell to Array.CurX

    Action: Set globalvariableValue to Array.CurValue

    I have tried Array Value at Array.X > globalvariableValue.

    I have also tried System compare values Array.CurValue > globalvariableValue

  • Thank you for the information! I think I have it almost working except I can't seem to get this line to work.

    set w to text.textWidth(tokenat(line, loopindex, “ “))

    When I type this it says does not take parameters.

    I am new to some concepts so I may be doing something wrong. This is what I am trying to do.

    CONDITION:SYSTEM Repeat tokencount(line, “ “) times THIS WORKS

    ACTION:SYSTEM set w to text.textWidth(tokenat(line, loopindex, “ “)) THIS DOES NOT WORK

  • Starts off with:

    Everything works up to the point. What I need a line count based on the text wrap or line break.

    Using tokencount(TextObject.Text,newline) won't work.

    Instead of counting the breaks it returns how many lines in the .txt file.

    Result

    Example1 variable = 2

    Example2 variable = 2

    Example3 variable = 2

    The result I am looking for is

    Example1 variable = 5

    Example2 variable = 2

    Example3 variable = 3

    Is there javascript I could use to recognize when a word is wrapped to the next line? I have read other forums with examples using Mutations to observe a change in the text but I am a beginner with Javascript so I don't fully understand the script.

    Note: I just need to count the number of wraps. I have a workaround for text height, width, etc.

  • I tried using this but Construct says: 'return' outside of function. I have the script placed inside a function.

    {var gTextLines = bbcodetext1.split("\n")

    return split.length}

    I have tried it without the brackets.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do you by chance have any suggestions for javascript? I tried using this but it didn't work.

    var globalvariable = TextObject.split("\n")

    Note: I just need to count the number of wraps. I have a workaround for text height, width, etc.

  • Starts off with:

    Everything works up to the point. What I need a line count based on the text wrap or line break.

    I have used set globalvariable to tokencount(TextObject.Text,newline)

    Instead of counting the breaks it returns how many lines in the .txt file.

    Result

    Example1 = 2

    Example2 = 2

    Example3 = 2

    The result I am looking for is

    Example1 = 5

    Example2 = 2

    Example3 = 3

    How do a line count based on text wrap/line break?

  • Thank you for the clarification. It worked:) Thank you so much!!

    Sprite is just the Construct default name. I plan to change it.

  • For some reason it is not working. I used the latest beta version (r162.2). I used the code below.

    const Sprite = runtime.objects.Text;

    const TextObject = Sprite.getFirstPickedInstance();

    TextObject.horizontalAlign="center";

    Any suggestions?

  • 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.

MasterNedyah's avatar

MasterNedyah

Early Adopter

Member since 10 Aug, 2017

None one is following MasterNedyah yet!

Trophy Case

  • 7-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • RTFM Read the fabulous manual
  • Email Verified

Progress

10/44
How to earn trophies