[Solved]...do some advanced typewriter effects

Get help using Construct 2

Post » Fri Feb 14, 2014 2:09 pm

Hi there,

I was inquiring yesterday about how to do a basic typewriter effect and I found some great previous solutions on the forum but now as i'm getting into this a little deeper I'm wondering about some deeper stuff.

I want to have a typewriter sound to go with it. I can trigger a sound with each tick sure, but I can't figure out a way to know when the text typing is complete and thus create a condition to say "this is no longer looping", stop. It seems like there might be some kind of "upon completion" parameter that I could use.

I could imagine some kind of "typing active" variable that flips off when the last word in the source text is done.

a more manual (but less efficient) idea would be to actually count how many letters a given source text object has and track it that way.. but that's really tedious with this project which has many pages of varying text. Maybe there is a way to "get letter count" and pass that to a counter var?

I just don't know how I might be able to set it up so that C2 knows the text is complete and act upon that knowledge.

Thanks!
Calebpart12studios2014-02-14 18:25:01
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Fri Feb 14, 2014 4:58 pm

It sounds from the way you're describing it, the best way would just to just make a comparison between what's in the text object and the source text, and don't play the sound when they equal. Don't get why loops are getting involved though, are you running the typewriter more than once per tick?
B
52
S
10
G
7
Posts: 184
Reputation: 6,850

Post » Fri Feb 14, 2014 5:18 pm

hmmm wow yea that's a great suggestion. I will try that and report back. i've never done a comparison like that before.
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Fri Feb 14, 2014 5:35 pm

I'm interested in your solution if it ends up working. Good luck!
B
45
S
11
G
7
Posts: 144
Reputation: 6,419

Post » Fri Feb 14, 2014 5:41 pm

[QUOTE=part12studios]   Maybe there is a way to "get letter count" and pass that to a counter var?
[/QUOTE]

len(text)
Return the number of characters in text.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Fri Feb 14, 2014 5:45 pm

len(source.text) < len(destintation.text)
play sound
add to destination.text
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Fri Feb 14, 2014 5:49 pm

typewriter_audio.capx

Can't remember who made that typewriter example (think it was @Ashley)... I just added sound to it.
ImageImageImageImage
B
157
S
64
G
41
Posts: 2,590
Reputation: 34,640

Post » Fri Feb 14, 2014 6:06 pm

i'm having some trouble getting the value over to where i think it go. i'll explain how i'm doing it:

I have two global vars

LetterCount
LetterTotal

I have a source text (that works) called S1P1 so i did a global var "set value"

len(S1P1.Text)

i have a test text field to display this number.. and i always get 0. what i believe i should be seeing is the number of letters in the S1P1 text.

i have more stuff after this, but as long as that value reads 0, nothing else will work. Len tells me it wants a string not a number, which is why i am using .Text) in the code above.

Thanks!
Caleb
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Fri Feb 14, 2014 6:10 pm

@shinkan, that does seem to be a good approach.. let me see if i can mimic that logic.
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Fri Feb 14, 2014 6:15 pm

@shinkan how are you inserting the audio below the other event? my audio fires off beside the set text to left.. so the loop never stops so i just end up with infinite ticking.
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Next

Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 4 guests