NEED QUICK HELP

Blitz3D Forums/Blitz3D Programming/NEED QUICK HELP

Oiduts Studios(Posted 2009) [#1]
Please help me i have a test and this is a great way to study, this code does not work please tell me why.


Graphics 800,600,32,3

selq()

Function qs1() : answer$="allocate" : Print "To set apart" : q1$=Input$("") : If q1$=answer$ Then Print "Right" Else Print "WRONG" : selq() :End Function
Function qs2() : answer$="ardent" : Print "very enthusiastic,impassioned" : q2$=Input$("") : If q2$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs3() : answer$="assiduous" : Print "persistent,attentive,diligent" : q3$=Input$("") : If q3$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs4() : answer$="brash" : Print "prone To act in a hasty manner" : q4$=Input$("") : If q1$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs5() : answer$="capricious" : Print "subject To whims Or passing fancies" : q5$=Input$("") : If q5$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs6() : answer$="chastise" : Print "To inflict physical punishment" : q6$=Input$("") : If q6$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs7() : answer$="copious" : Print "abudent:plentiful" : q7$=Input$("") : If q7$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs8() : answer$="deviate" : Print "To turn aside:To stray from a norm" : q8$=Input$("") : If q8$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs9() : answer$="emaciated" : Print "unnaturally thin" : q9$=Input$("") : If q9$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs10() : answer$="exult" : Print "To rejoice greatly" : q10$=Input$("") : If q10$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs11() : answer$="gnarled" : Print "knotted,twisted,lumpy" : q11$=Input$("") : If q11$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs12() : answer$="indemnity" : Print "a payment For damage Or loss" : q12$=Input$("") : If q12$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs13() : answer$="inkling" : Print "a hint: a vague notion" : q13$=Input$("") : If q13$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs14() : answer$="limpid" : Print "clear, transparent: readily understood" : q14$=Input$("") : If q14$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs15() : answer$="omnipotent" : Print "almighty, having unlimited power Or authority": q15$=Input$("") : If q15$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs16() : answer$="palatable" : Print "agreeable To taste Or one's sensibilities" : q16$=Input$("") : If q16$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs17() : answer$="poignant" : Print "deeply affecting" : q17$=Input$("") : If q17$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs18() : answer$="rancor" : Print "bitter resentment Or ill-will" : q18$=Input$("") : If q18$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs19() : answer$="sophomoric" : Print "immature And overconfident" : q19$=Input$("") : If q19$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function
Function qs20() : answer$="spontaneous" : Print "arising naturally, Not planned" : q20$=Input$("") : If q20$=answer$ Then Print "Right" Else Print "WRONG":selq():End Function

Function selq()
For x=1 To 20
rndq=Rnd(20)

If rndq=1 Then qs1()
If rndq=2 Then qs2()
If rndq=3 Then qs3()
If rndq=4 Then qs4()
If rndq=5 Then qs5()
If rndq=6 Then qs6()
If rndq=7 Then qs7()
If rndq=8 Then qs8()
If rndq=9 Then qs9()
If rndq=10 Then qs10()
If rndq=11 Then qs11()
If rndq=12 Then qs12()
If rndq=13 Then qs13()
If rndq=14 Then qs14()
If rndq=15 Then qs15()
If rndq=16 Then qs16()
If rndq=17 Then qs17()
If rndq=18 Then qs18()
If rndq=19 Then qs19()
If rndq=20 Then qs20()

Next
End Function


GIB3D(Posted 2009) [#2]
Gave me the error
'End Function' without 'Function'

I wouldn't try to create functions like that anyways...

This is what this would look like the right way, but it just looks like you need an EndIf
Function qs1()
	answer$="allocate"
	Print "To set apart"
	q1$=Input$("")
	If q1$=answer$ Then
		Print "Right" Else Print "WRONG"
		selq()
End Function



Oiduts Studios(Posted 2009) [#3]
Thanks a lot green fire! I need help!


Oiduts Studios(Posted 2009) [#4]
its still giving me the same error


Oiduts Studios(Posted 2009) [#5]
Never mine i fixed it


Stevie G(Posted 2009) [#6]
Using so many functions it really bad practice. This can be really simplified.

Graphics 800,600,32,3

While Not KeyHit(1)
	AskQuestion()
Wend

Function AskQuestion()

	q = Rand(1,20)
	Restore Questions
	For l = 1 To q
		Read Answer$, Question$
	Next
	
	Print Question$
	Guess$ = Input$("")
	If Guess$ = Answer$
		Print "Right"
	Else
		Print "Wrong"
	EndIf
	
End Function		

.Questions
Data "allocate","To set apart"
Data "ardent" , "very enthusiastic,impassioned" 
Data "assiduous" , "persistent,attentive,diligent" 
Data "brash" , "prone To act in a hasty manner"
Data "capricious" , "subject To whims Or passing fancies"
Data "chastise" , "To inflict physical punishment" 
Data "copious" , "abudent:plentiful" 
Data "deviate" , "To turn aside:To stray from a norm" 
Data "emaciated" , "unnaturally thin" 
Data "exult" , "To rejoice greatly" 
Data "gnarled" , "knotted,twisted,lumpy" 
Data "indemnity" , "a payment For damage Or loss" 
Data "inkling" , "a hint: a vague notion" 
Data "limpid" , "clear, transparent: readily understood" 
Data "omnipotent" , "almighty, having unlimited power Or authority"
Data "palatable" , "agreeable To taste Or one's sensibilities"
Data "poignant" , "deeply affecting"
Data "rancor" , "bitter resentment Or ill-will"
Data "sophomoric" , "immature And overconfident"
Data "spontaneous" , "arising naturally, Not planned"



Stevie


Oiduts Studios(Posted 2009) [#7]
wow thanks! i was just trying to make it shorter but not like that, this really taught me a lot!