Text Loop - How to change text

More specifically, why does this not work?
I think it’s clear what I’m trying to do here


There are no more events

Without Trigger once, the event is executed 60 times per second.

You need an extra variable, otherwise all subevents are true one after the other and change the name. (the same as e.g. toggle buttons)

1 Like

It’s simpler to just have just one event:

No need for variables or conditional subevents.

1 Like

It could be shorter but I don’t understand, though :pensive:

Yeah, it’s bit gnarly. I’ll break it down, from the inner brackets to the outer brackets:

StrAt(Player.String(), StrLength(Player.String())-1) grabs the last character of text in the player text object. Positions are zero based - the first one is 0, so the last one is the string length-1.

ToNumber(...) converts that last character into a number

mod(..., 4) effectively divides by 4 and takes the remainder so the numbers fall from 0 to 3. It keeps 1,2 & 3 as is, and just converts the 4 to a 0. The +1 at the end then increases that number by 1.

And the outer ToString() converts the incremented number to a string and appends it to the end of the string "Player "

1 Like