GAH!! MY BRAIN HURTS!

Blitz3D Forums/Blitz3D Beginners Area/GAH!! MY BRAIN HURTS!

That looks nice. It can be a good method to write a program that generates code. However, with this method, you generate a separate function for each conversation. It might be better to create a single function that can handle all conversations.

For checking the input for (/end), in the function check, use:
Function check(check$)
  ;look for (/end)
  cc = Instr(check$, "(/end)")
  If cc > 0 Then
        ;remove (/end) from input
	check$ = Left$(check$, cc - 1) + Mid$(check$, cc + 6)
	quit = 1
  End If
End Function 

Then, to complete the entire input sequence before quitting, only check if quit = 1 after asking for response3.

You could make a type for the questions.
The type should look sort of like this:
Type TQuestion
 field question$
 field answer1$
 field answer2$
 field answer3$
End Type


After completing a question (when npc$, r1$, r2$ and r3$ are filled in), create a new instance of this type by using:
q.TQuestion = new TQuestion

Then fill in the fields:
q\question$ = npc1$
q\answer1$ = r1$
q\answer2$ = r2$
q\answer3$ = r3$


When all questions are entered, you could write the data to a file like this:
ff = WriteFile("questiondata.txt")
For q.TQuestion = each TQuestion
WriteLine ff, q\question$
WriteLine ff, q\answer1$
WriteLine ff, q\answer2$
WriteLine ff, q\answer3$
Next
CloseFile ff


And load it back using:
ff = ReadFile("questiondata.txt")
Delete Each TQuestion
while not(eof(ff))
   q.TQuestion = new TQuestion
   q\question$ = ReadLine(ff)
   q\answer1$ = REadLine(ff)
   q\answer2$ = REadLine(ff)
   q\answer3$ = REadLine(ff)
wend
CloseFile ff


However, you could also intergrate the type with the system you made allready.

3D Animations can be played back using the Animate Command.
The models have to be loaded with the LoadAnimMesh command.

In the generated function, the first lines of the loop are:
Repeat
Flip()


These should be changed to
Repeat
UpdateWorld
RenderWorld
Flip

For an example, look for the LoadAnimMesh example in the Blitz3D help section.