TNT Basic Forums > Bugs!
Problem with Procedures
< Last Thread     Next Thread >
Thread        Post A Reply

09-16-2002 23:15

Posted by:

Find more posts by bud

when I call for and write a procedure in my game it returns with the syntax error- "Syntax error" and "expected an end proc statement" but it only does this if i have a variable or if statement in my procedure. here is an example of my code. I think it could be a bug in TNT Basic.

Procedure DoTitleScreen()
fade up
show mouse
open canvas 1,640,480
canvas 1
set pen colour black
Paint Canvas
load images 128
paste image 70,10,0,128
draw frame
copy canvas 1 to 0
close canvas 1
load images 129
new Button 0,180,400,0,1,2,129
new button 1,460,400,3,4,5,129
draw frame
int quit=false
int value=Poll Button Click
clear buttons
new Button 0,150,400,0,1,2,129
new button 1,490,400,3,4,5,129
new button 2,251,382.5,18,19,20,129
draw frame
wait button click
if button click = 0
if button click = 1
end if
int value=Poll Button Click
wait button click
if button click = 2
clear buttons
open canvas 3,640,480
canvas 3
text size 28
copy canvas 3 to 0
close canvas 3
wait mouse click
clear buttons
open canvas 5,640,480
canvas 5
Text Size 20
Text Face 1
draw text 100,100,"How many points to win?"
text size 15
draw text 330,160,"Ten"
draw Text 330,220,"Twenty-Five"
draw text 330,280,"Fifty"
draw text 330,340,"Unlimited"
copy canvas 5 to 0
close canvas 5
new button 3,280,140,6,7,8,129
new button 4,280,200,9,10,11,129
new button 5,280,260,12,13,14,129
new button 6,280,320,15,16,17,129
wait button click
clear buttons
fade up
clear buttons
open canvas 2,640,480
canvas 2
copy canvas 2 to 0
close canvas 2
end proc

09-16-2002 23:49

Posted by:

Find more posts by Mathew

I can't read your code without color or formatting, but I still have some ideas.

Verify you have as many closure statements as opening ones.


draw text X,Y,"hello <<<I haven't closen it

I often had problems like that.

TNT error reporting lacks expressive messages. For example, I forgot to close a parenthesis. TNT said "syntaxt error" on the while instead of saying the parenthesis was not closed.

Suggestion to Mark: TNT should count the number of closure statements and opening ones and tell you when it doesn't match.

09-17-2002 21:46

Posted by:
Mark Tully

Find more posts by Mark Tully

Hi there,

The problem with this code snippet is that there are not enough 'end if's. There are two if statements without closing end ifs.

Sorry TNT Basic couldn't give you a better error message! We'll try and improve it!


All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.