how to compare words?

Just started using Construct 2? Post your questions here

Post » Fri Nov 06, 2015 8:54 am

i am trying to make typing game using Construct 2 and i dont know how to compare words or letters in it.
i cant set conditions for this term. can any one help me out? By the way i am not native speaker so please use simple texts
B
7
S
1
Posts: 16
Reputation: 498

Post » Fri Nov 06, 2015 1:16 pm

You can compare text like any other value in Construct. The only thing is, that comparing text is case sensitive (Hello and hello are not equal)
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Fri Nov 06, 2015 2:22 pm

Asmodean wrote:You can compare text like any other value in Construct. The only thing is, that comparing text is case sensitive (Hello and hello are not equal)


You could ofcourse convert the whole text to lowercase or uppercase before comparing if needed:

lowercase(text)
Convert the given text to all lowercase

uppercase(text)
Convert the given text to all uppercase
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 09, 2015 8:47 am

thanks for your reply! and since you are the only one i can write pm to because i am new to scirra and i dont have enough rep, can you please tell me this?
how to pick the first letter of a word and substract it from the text when i press the right letter? Can you give me a detailed answer. if i get this, i have a great game idea.
B
7
S
1
Posts: 16
Reputation: 498

Post » Mon Nov 09, 2015 10:55 am

If I understand what you are asking:

Using these two
system expressions

right(text, count)
Return the last count characters of text.

len(text)
Return the number of characters in text.

So that would become

set text to : right(text,len(text)-1)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Nov 10, 2015 1:47 am

thanks it really works. and it works too good that it wipes all letters one by one till it is all gone. i think i need to set right conditions for it. THANKS IT WAS A BIG HELP!!
B
7
S
1
Posts: 16
Reputation: 498

Post » Tue Nov 10, 2015 9:00 am

hi LittlelittleStain!. i have another thing to ask. can u plz help me plz!

first by your help now i can substract the first letter of a word and now i am trying to count mistakes when i hit the wrong key.
i thought it would be done by inverting the previous condition and adding keyboard condition that triggers when any key pressed.

Buuuuut it is not working! Aand i need your help once again.lol
B
7
S
1
Posts: 16
Reputation: 498

Post » Tue Nov 10, 2015 10:19 am

You should post a new topic with a precise explanation of what you have done (either post your capx or at least a screenshot of your code), what you are expecting this current code to do and what you are actually experiencing.

I don't understand what you mean by "Counting mistakes hitting the wrong key", it doesn't make sense to me with your previous question about subtracting letters from a word.

You should rather explain the overall idea of the mechanic you are trying to implement.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
288
S
111
G
94
Posts: 7,332
Reputation: 69,160


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests