forums

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

01-29-2003 23:34

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Hi, is there anyway I could read a file larger than a string? Is there any way I could open a file without knowing its 4 characters code? ( I don't want a way to know the 4 but some kind of ANYTHING function. )

Hey, good idea this ANYTHING function! Then you could say < if pressed ( ANYTHING ) > and maybe more...

01-30-2003 12:39

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

What?

Hi,
Not quite sure what you're trying to do, but I think what you need is the ask open file command where the user selects the file themselves.
About your second point you can't currently have an anything function so instead of:

if presseed (ANYTHING)
try
if pressed (0-129)

which should include all the keyboard keys, as 129 is the highest poll value I can find, there is also help on this in the TNT User guide under the input/output section.

hope this helps,
Mark_667

01-31-2003 00:05

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Yeah, I knew about AskOpenFile, I just hoped there was something else. But what about large files? They just can't be read by my code, I believe they are larger than a string!

02-02-2003 22:44

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

Large Files

What file format is it? If it's not a text file TNT Basic might have trouble. Our strings aren't limited to a particular length, they should only be constrained by memory.

There's currently no way to open a file without knowing it's creator code. This is because the file access commands were written to allow a TNT Basic program to work with files it produced.

As for the is pressed (anything) example, we don't have a way of doing this at the moment either. You can only test for 1 key at a time with the is pressed function. The example that mark_667 gave of going 'is pressed(0-129)' would not work, it would just evaluate whether key -129 was pressed.

Let me know what additional functionality you want from the files/keyboard access commands.

Cheers,

Mark

02-03-2003 10:56

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Ranges

HI,
At the risk of losing all crediblity on these forums, why can the pressed (0-129) work as an inclusive range? This would make it much easier and tricks like this work in languages such as VB. Is there any other way round it, or do you have to test every key individually to do what Matthew was originally sugesting?

02-03-2003 12:28

Posted by:
matteo

Location:
Venice, ITALY!

Click Here to Email matteo   Find more posts by matteo

somethingpressed=false
for i=0 to 129
if pressed(i) then somethingpressed=true
next
if somethingpressed then...

not so long...

02-05-2003 22:15

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

Ranges

There's no reason why we couldn't do ranges, but it's not that useful because the keys that you want to test for might not be numerically next to each other. I guess what you want is a function that returns true if any of the keys on the keyboard are pressed?

We can add that easy enough, but the for loop suggested by matteo is functionally equivalent.

Mark

02-05-2003 23:14

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Well, if you want to write a function, it's OK, but don't do it just for me cause I can use the loop.

As for the files, the problems is that I've written them from TNT! I don't see why they don't read, as it's not the first time I use TNT files.

02-06-2003 20:48

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

That's odd, if it's a text file, try opening it in a text editor and checking it looks alright. If you continue to have problems, email be your file and program, as it might be a bug in TNT Basic's file handling.

Cheers,

Mark

02-12-2003 15:21

Posted by:
adholm

Click Here to Email adholm   Find more posts by adholm

Press Any Key

Hi
Is it possible to add a function for telling if "ANY KEY" is pressed, for the next release?

e.g. WAIT Key, WHILE NOT Key, REPEAT....UNTIL Key,
IF Key..........END IF----------

TNT Basic is Great, I have been looking for something like this for a looong time.

Cheers


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.