Jump to content

How to build an interactive text?


Azurues

Recommended Posts

How could I build an interactive text system?

It should work like this:

Text is displayed.

1-3 options (a situational amount of them) to answer displayed.

Example:

Are you male?

Yes

No

 

You choose yes or no and it leads you to another questions based from your previous answer.

Example: (a follow up to the 1st one)

So you're male. Do you like cars then?

Answers.

And it goes on and on.

 

The thing I need help with is the answers. I need to show them based by the previous answer but don't know how, any help?

Link to comment
Share on other sites

<div id="tut" style="background-image: url(images/chars/guide.png);"><div id="cwind">
<div id="tname">Guardian Robot</div><div id="sep"></div>
<div id="speech">
<?echo"$ttext[$ptut]";?></div></div><div id="ws"></div><form action="main.php" method="POST">
<button style="font-family: normal; font-size: 14px;" name="choice" value="1"
class="<?echo"$cl1[$ptut]";?>"><?echo"$choice1[$ptut]";?></button><div id="ws"></div>
<button style="font-family: normal; font-size: 14px;" name="choice" value="2"
class="<?echo"$cl2[$ptut]";?>"><?echo"$choice2[$ptut]";?></button><div id="ws"></div>
<button style="font-family: normal; font-size: 14px;" name="choice" value="3"
class="<?echo"$cl3[$ptut]";?>"><?echo"$choice3[$ptut]";?></button>
</form></div>

 

$ttext is a numerical array to display the text (the question). It is wrong since ptut is the number of answers taken (from a database).

$cl1,cl2,cl3 again are a numerical arrays which display a button or don't, it's wrong due to ptut being counted wrongly.

$choice1,2,3 are the choices displayed incorrectly.

 

I can't think of a better code and how to fix that. The problem is that ptut should be counted in some different way and I can't think of any.

Link to comment
Share on other sites

<div id="tut" style="background-image: url(images/chars/guide.png);"><div id="cwind">
<div id="tname">Guardian Robot</div><div id="sep"></div>
<div id="speech">
<?echo"$ttext[$ptut]";?></div></div><div id="ws"></div><form action="main.php" method="POST">
<button style="font-family: normal; font-size: 14px;" name="choice" value="1"
class="<?echo"$cl1[$ptut]";?>"><?echo"$choice1[$ptut]";?></button><div id="ws"></div>
<button style="font-family: normal; font-size: 14px;" name="choice" value="2"
class="<?echo"$cl2[$ptut]";?>"><?echo"$choice2[$ptut]";?></button><div id="ws"></div>
<button style="font-family: normal; font-size: 14px;" name="choice" value="3"
class="<?echo"$cl3[$ptut]";?>"><?echo"$choice3[$ptut]";?></button>
</form></div>

 

$ttext is a numerical array to display the text (the question). It is wrong since ptut is the number of answers taken currently working: $ptut+the value of the button.

$cl1,cl2,cl3 again are a numerical arrays which display a button or don't, it's wrong due to ptut being counted wrongly.

$choice1,2,3 are the choices displayed incorrectly.

 

I can't think of a better code and how to fix that. The problem is that ptut should be counted in some different way and I can't think of any.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.