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

Get help using Construct 2

Post » Thu Aug 20, 2015 1:31 pm

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.
B
9
S
1
Posts: 65
Reputation: 861

Post » Thu Aug 20, 2015 1:58 pm

System expressions wrote: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"
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Thu Aug 20, 2015 2:01 pm

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.
B
9
S
1
Posts: 65
Reputation: 861

Post » Thu Aug 20, 2015 3:02 pm

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!
B
9
S
1
Posts: 65
Reputation: 861


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests