forums

TNT Basic Forums > Programming Q&A
error message
< Last Thread     Next Thread >
Author
Thread        Post A Reply

05-07-2008 14:33

Posted by:
Pokoleo

Location:
on my computer

Find more posts by Pokoleo

I was using tnt and I came across an error message, I was wondering if you have ever seen anything like it...:

*** Runtime exception caught ***
Line #: 1454
Code: draw text x,y,left str(String Editor Contents,String Editor Cursor)
Error: There was an error in the parameters used to initiate an operation. Unfortunately, this can happen for a number of different reasons and can only be determined on a case by case basis.

I've tried checked that:
left str(String Editor Contents,String Editor Cursor) has stuff... it does.
x,y are values... they are
x,y values when removed and replaced with numbers, still returns error
if I try a draw text with no variables included, there is an error.

if anyone has a copy of the visual text entering stuff... it was taken away from the site that it was hosted on. I've tried to design an equivalent procedure, and it has been working, but not in the case above.

please reply...


-Pokoleo

05-09-2008 03:40

Posted by:
Pokoleo

Location:
on my computer

Find more posts by Pokoleo

additional problems...

so I have built a procedure/method of having a visual text display in graphics mode in another file than the main file that I am designing. when I bring the procedure into the main file, I get an error exactly like this:
There was an error in the parameters used to initiate an operation.

*** Runtime exception caught ***
Line# : 1337
Code : draw text minMessageX+1,minMessageY+10+Text Descent*4*n,messageNum[n]
Error : There was an error in the parameters used to initiate an operation. Unfortunately, this can happen for a number of different reasons and can only be determined on a case by case basis.

any tips?

ironic that the line is 1337...

05-09-2008 07:32

Posted by:
Harbinger

Location:
Florida,USA

Click Here to Email Harbinger   Find more posts by Harbinger

I'm not sure about the first problem, but i may have an possible answer for the second. Test and make sure that the data you're reading from the external file is EXACTLY byte-for-byte what you want. I've come up with a data viewer for reading external .bmps and learned a lot along the way about how TNT handles file reading. If you're not reading text-type files, then use FILE READ INT(). However, keep in mind that when TNT reads data files in integers, it reads it 4 bytes at a time.

05-09-2008 12:05

Posted by:
Pokoleo

Location:
on my computer

Find more posts by Pokoleo

but...

I'm not reading a data file, i set the variable earlier inside the loop. here is the associated procedure:

i've allready tried running it in a file by itself...

usually: makeMessageLog() is called first, then updateMessageLog()

procedure updateMessageLog(str newMessage)
int n 'counter
int DX=maxMessageX-minMessageX, DY=maxMessageY-minMessageY 'delta X
int yValue=0 'to prevent an "unexplainable" error
str temp=""
int temp2=0

makeMessageLog()

for n=4 to 1 step -1 'shift the text up...
messageNum[n]=messagenum[n-1]
next n
messageNum[0]=newMessage 'adds the new message...

set pen colour messageTextColour
for n=0 to 4

yValue=minMessageY+Text Descent*n
temp=messageNum[n]
temp2=minMessageX+1


draw text minMessageX, minMessageY+Text Descent*4*n, messageNum[n]
next n


draw frame
wait mouse click
end proc

procedure makeMessageLog()
int n'counter

set pen colour messageBGColour
fill rect minMessageX,minMessageY to maxMessageX,maxMessageY
set pen colour messageTextColour
frame rect minMessageX,minMessageY to maxMessageX,maxMessageY
draw frame

for n=0 to 4
messageNum[n]=""
next n
end proc

05-10-2008 03:54

Posted by:
Harbinger

Location:
Florida,USA

Click Here to Email Harbinger   Find more posts by Harbinger

Hmm...


Doesn't the Text Descent need a param to work?

I've had trouble using negative step in for-next loops;check that out....

05-11-2008 04:14

Posted by:
Pokoleo

Location:
on my computer

Find more posts by Pokoleo

parameter...

the negative for loop works for me, but I don't know what a parameter is.

If it is a canvas, I have only one identified
If it is that there is x,y,"string" after the draw text command, it has the right number of "data fields"

What is a parameter?

-Pokoleo

05-11-2008 18:44

Posted by:
Pokoleo

Location:
on my computer

Find more posts by Pokoleo

more on parameters...

I've just read up on parameters, and it seems that the text descent command doesn't need a parameter.

the error seems to be with the string in this case, when replaced with "hello" (instead of a variable), it works

05-11-2008 18:48

Posted by:
Pokoleo

Location:
on my computer

Find more posts by Pokoleo

I got it.... I think...

it was because I had not defined the strings (as stringName=" "). you have to define their value

you cannot define them as "", because it won't work, but as " " (a space) works for me

05-11-2008 18:52

Posted by:
Pokoleo

Location:
on my computer

Find more posts by Pokoleo

never mind

it worked there for a second... I don't know why it didn't work now... Harbinger, what was the problem with your text document that you were reading. did the line have no contents?

05-11-2008 19:01

Posted by:
Pokoleo

Location:
on my computer

Find more posts by Pokoleo

i've finally got it and I know why...

It worked before for two reasons:
1. I had to set them to " " (or equivalent, but NOT "")
2. I had switched to strings that were not arrays. for some [stupid] reason, the array-strings do not work in the draw text command.

when I posted first (i've got it), I was using the non-arrays
later, when I was distraught, I had switched back to arrays

05-12-2008 02:50

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

String arrays have alot of problems... Network String Arrays don't work at all, for instance.

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.