Is it possible to perform call() on user entered text

Get help using Construct 2

Post » Sat Jan 21, 2017 1:00 am

Is it possible to check entered text and then call a function depending on the wrong or right answer? Can anyone give an example?
B
16
S
6
G
1
Posts: 83
Reputation: 1,870

Post » Sat Jan 21, 2017 10:50 am

In theory yes (never bothered to do it myself but the functionality is in place). You will need to retrieve the correct answer from somewhere and store it in a string, but I assume you will be loading new questions via events anyway so you will be doing it then. Once you have text variable [answer] stored do the following on text changed in textbox.

event
condition
User finishes entering answer and confirms (clicks a confirm button or presses enter or something, don;t use the textbox changed text condition as it triggers every time when you type inside it)
no actions

sub-event -1
condition
textbox compare text to text stored in [answer]
action
call function "correct"

sub-event -2
condition
else (system conditons)
action
call function "wrong"
B
15
S
6
Posts: 85
Reputation: 1,195

Post » Sun Jan 22, 2017 7:21 pm

Hi Pulstar, thanks for your answer. It is quite thought provoking. I have given up the idea for my game as it was really hurting my eyes to debug it. The project is now cancelled. It would be interesting to know how to act upon strings entered in C2 though...
B
16
S
6
G
1
Posts: 83
Reputation: 1,870


Return to How do I....?

Who is online

Users browsing this forum: SputnikCZ and 3 guests