0 Favourites

How do I put in text strings commands or "flags"

  • Hello! First of all thanks for your time. I am doing now a visual novel and I store all storyline in an array like a text. Sometimes I use commands there for starting animations or something like thise. So I started thinking of making instead of few separate values a one. Like on x=99 value "Hello friend #FriendAppear #RightSide". So I want textbox to show text "HelloFriend" and delete everything else and a SpawnerSprite under UID 22 (right side spawner) to spawn a FRIEND sprite. Any idea how I can make TextBox at least to recognise a #FriendAppear separate from other text or may be I have to do some manipulations with array? Coz a Compare Text not working like these. Thanks fo attention.

  • tokenat(src, index, separator)

    Return the Nth token from src, splitting the string by separator. For example, tokenat("apples|oranges|bananas", 1, "|") returns oranges.

    tokenat(Hello friend #FriendAppear #RightSide,0,"#") returns "Hallo friend"

    or

    Variable1="Hello friend #FriendAppear #RightSide"

    tokenat(Variable1,0,"#")="Hallo friend"

    or

    Array.At(99)="Hello friend #FriendAppear #RightSide"

    tokenat(Array.At(99),0,"#")="Hallo friend"

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks. I will give it a try. My problem is that in that guide I didn't uderstood too much because I am non englishe native. So words I did.t understood.

  • Wow. Thanks to you I managed how its work. All commands I mark with# and better way is always to show in textbox

    IF tokenat(Storyline.At(Step),1,"#") not equal 0 than tokenat(Storyline.At(Step),0,"#")

    and execute commands with find(Storyline.At(Step), "#FriendAppear") not equal to -1 which spawns FRIEND on spawner

    after this I do comparsion find(Storyline.At(Step), "#Right") not equal -1 which identifies UID of a spawner.

    Array text looks like this : "Hello my friend! Blablabla! #FriendAppear #Right"

    The greatest that I can switch places of commands like I want, and they call functions!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)