Monkey Island questioning control

Blitz3D Forums/Blitz3D Beginners Area/Monkey Island questioning control

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.

maybe by adding a kind of header in each sentence you can get rid of the problem.

i'll use 4 digit values style to store the sentences headers
LEN NQID NBR R(1) R(2) R(3)
0000 0000 0000 0000 0000 0000 sentence

in LEN you store the length of the text
in NQID you store the question relative to this choice
in NBR you store the numlber of replys for this sentence if it's a question
in R(x) you store the number of the reply x
then you store the sentence itself

here an exemple:
of how you can store a simple dialog in a one sized array like dialog$(xx) i just show you the strings content at the start of the line in brackets i'll show the array position of each string
i use the character | in my example to separate the header parts but it's not used in the real string stored

ap len nqid nbr R(x)|sentence
[1]0017|0000|0003|0002|0003|0004|what's your name?
[2]0011|0005|0000|ford escort
[3]0022|0006|0000|it' not youre business
[4]0012|0007|0000|i don't know
[5]0024|0000|0000|nice name,ford escort!!!
[6]0015|0000|0002|0008|0009|are you fool ??
[7]0028|0000|0000|damn, another amnesic people
[8]0003|0000|0000|yes
[9]0002|0000|0000|no

now how use this ?
here a really not optimised code example!!!
you'll have to write an editor for the datas

Graphics 800,600,32,2
Dim sentence$(100)
Repeat
	z=z+1
	Read sentence$(z)
Until sentence$(z)="END"
ret=1
Repeat
	If ret
		ret=quest(ret)
	EndIf
Until ret=0
End
Function quest(id)
	curent=id
	l=unformat(sentence$(curent),1) ; get the lenght of the curent sentence
	nbc=unformat(sentence$(curent),3); get the number of choices proposed as reply
	;
	;show the questions and replys
	;
	Color $ff,0,0
	Text 0,0,Right$(sentence$(curent),l)
	If nbc<>0
	Color 0,$ff,0
		For reply=1 To nbc
			Text 5,10+reply*12,"["+reply+"] "+Right$(sentence$(unformat(sentence(curent),3+reply)),unformat(sentence$(unformat(sentence(curent),3+reply)),1))
		Next
	EndIf
	Flip
	
	;---------------------here the keyboard test (in my example) but you can do whatever mouse or keyboard test you want
	Repeat
		key=GetKey()
		choice=0
		If key>48 And key<49+nbc
			choice=key-48
		EndIf				
	Until KeyDown(1) Or choice<>0
	newq=0
	If choice
		newq=unformat(sentence$(unformat(sentence$(curent),3+choice)),2)
	EndIf
	Return newq
End Function
Function unformat(strin$,pos)
	Return Mid(strin$,((pos-1)*4)+1,4)
End Function
Data "001700000003000200030004what's your name?"
Data "001100050000ford escort"
Data "002200060000it' Not youre business"
Data "001200070000i don't know"
Data "002400000000nice name,ford escort!!!"
Data "00150000000200080009are you fool ??"
Data "002800000000damn, another amnesic people"
Data "000300000000yes"
Data "000200000000no"
Data "END"


hope this help you :)

it's just an idea but i'm sure there's other way to do this