GAH!! MY BRAIN HURTS!

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

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

My brain hurts!! I need help lol. I'm trying to create a program that can generate conversation functions. I'm trying to use types (for the first time I might add) and I've got a TON of questions.

This code is text-based and asks you what you want the filename, and function name are to be. It then asks you what you want the NPC to say, and what you list of responses are (tree-style). Using the code below, how can I be able to insert a type system where the user can type "(/end)" (which can be achieved with Instr()) to make that particular response end the conversation, and when that isn't done, continue asking for what the NPC says, and your responses (I'm thinking of developing a graphical tree system to make things easier). The big question is how to do this with types.

Here's the code:
AppTitle "SW:WRH Conversation creator"
Global filename$=""
Global launcher$=""
Global funcname$=""
Global npc1$=""
Global r1$=""
Global r2$=""
Global r3$=""
Global npc2$=""
Global quit=0
Global check$=""
 
Graphics 1280,1024,32,2



While quit=0


;createconversation
;create the conversation
Text 1, 1, "WELCOME TO THE SW:WRH CONVERSATION CREATOR. FOLLOW GIVEN INSTRUCTIONS. TYPE 'quit' AT ANY TIME TO QUIT WITHOUT SAVING YOUR CONVERSATION. HIT ANY KEY TO CONTINUE"
WaitKey()
Cls 

filename$=Input$("What should the filename of this conversation be (if the file already exhists, put its name here too, extensions are unnecesary)? ") + ".bb"
check(filename$)
If quit=1 Then Goto quitlabel


funcname$=Input$("What would you like the Function name For this conversation To be?   ")
check(funcname$)
If quit=1 Then Goto quitlabel

npc1$=Input$("What would the first thing the NPC says be?   ")
Text 1000,15,"npc1= " + npc1
check(npc1$)
If quit=1 Then Goto quitlabel

r1$=Input$("What do you want response1 to be?   ")
Text 1000, 30,"r1= " + r1
check(r1$)
If quit=1 Then Goto quitlabel

r2$=Input$("What do you want response2 to be?   ")
Text 1000, 45,"r2= " + r2
check(r2$)
If quit=1 Then Goto quitlabel

r3$=Input$("What do you want response3 to be?   ")
Text 1000, 60,"r3= " + r3
check(r3$)
If quit=1 Then Goto quitlabel

writetofile 


Cls 

Wend 
.quitlabel
End 

Function check(check$)
If check$="quit" Then quit=1
;Goto quitlabel
;EndIf 
End Function 

Function writetofile()


test = FileType(filename$)

;if it doesn't
If Not test Then
		
	;createfile
	file = WriteFile(filename$)


;if it does		
Else
	
	;open file
	file = OpenFile(filename$)
	;seek to end of file
	SeekFile file, FileSize(filename$)
	
End If

WriteLine file, ""

WriteLine file, "Function " + funcname$ + "()"

WriteLine file, "npc1$ = " + Chr(34) + npc1$ + Chr(34)
WriteLine file, "r1$ = " + Chr(34) + r1$ + Chr(34)

WriteLine file, "Repeat"


WriteLine file, "Flip()"

WriteLine file, "If (MouseY() < ((displayheight/4)*3)+((displayheight/4)*.3) + 12) And MouseY() > ((displayheight/4)*3)+((displayheight/4)*.3) Then"
WriteLine file, "Color 50, 50, 245"
WriteLine file, "Rect 0, ((displayheight/4)*3)+((displayheight/4)*.3), displaywidth, 12, 1"
WriteLine file, "Color 255, 255, 255"
WriteLine file, "EndIf"

WriteLine file, "Color 0,0,0"
WriteLine file, "Rect 0,0,displaywidth,displayheight/4,1"
WriteLine file, "Color 0,0,0"
WriteLine file, "Rect 0,(displayheight/4)*3,displaywidth,displayheight/4,1"
WriteLine file, "Color 255, 255, 255"

;HIGHLIGHTS========================

WriteLine file, "If (MouseY() < ((displayheight/4)*3)+((displayheight/4)*.3) + 12) And MouseY() > ((displayheight/4)*3)+((displayheight/4)*.3) Then"
WriteLine file, "Color 50, 50, 245"
WriteLine file, "Rect 0, ((displayheight/4)*3)+((displayheight/4)*.3), displaywidth, 12, 1"
WriteLine file, "Color 255, 255, 255"
WriteLine file, "EndIf"

WriteLine file, "If (MouseY() < ((displayheight/4)*3)+((displayheight/4)*.3) + 12 +50) And MouseY() > ((displayheight/4)*3)+((displayheight/4)*.3)+50 Then"
WriteLine file, "Color 50, 50, 245"
WriteLine file, "Rect 0, ((displayheight/4)*3)+((displayheight/4)*.3)+50, displaywidth, 12, 1"
WriteLine file, "Color 255, 255, 255"
WriteLine file, "EndIf"

WriteLine file, "If (MouseY() < ((displayheight/4)*3)+((displayheight/4)*.3)+12+100) And MouseY() > ((displayheight/4)*3)+((displayheight/4)*.3)+100 Then"
WriteLine file, "Color 50, 50, 245"
WriteLine file, "Rect 0, ((displayheight/4)*3)+((displayheight/4)*.3)+100, displaywidth, 12, 1"
WriteLine file, "Color 255, 255, 255"
WriteLine file, "EndIf"
;====================================

WriteLine file, "Text 250,100, " + Chr(34) + npc1$ + Chr(34) 
WriteLine file, "Text 250,((displayheight/4)*3)+((displayheight/4)*.3), " + Chr(34) + r1$ + Chr(34)
WriteLine file, "Text 250,((displayheight/4)*3)+((displayheight/4)*.3)+50, " + Chr(34) + r2$ + Chr(34)
WriteLine file, "Text 250,((displayheight/4)*3)+((displayheight/4)*.3)+100, " + Chr(34) + r3$ + Chr(34)

WriteLine file, "Until KeyHit(1)"

WriteLine file, "End Function"

CloseFile file



End Function 


Sorry about the questions...I wasn't very clear...I'm tired :) Ask for clarifications if need be.

Thanks for any help!

PS: is there a way to have 3d animations played with my models during the Repeat ... Until loop for the conversation?