forums

TNT Basic Forums > Feedback
Miscellaneous Suggestions
< Last Thread     Next Thread >
Author
Thread        Post A Reply

10-27-2003 22:33

Posted by:
Miles

Location:
Australia

Click Here to Email Miles   Find more posts by Miles

Several things I think would make coding with TNT slighly easier and neater:

A "Choose" command: like result = Choose (variable, string1, string2, string3)

So that choose would output the first string on the list if that variable is equal to 0, the second string on the list if the variable is equal to 1 etc.

I don't know about other people but in my games there often seems to be quite lengthly chains of

if variable=1
string="something"
else if variable=2
string="something else", etc etc.

And having a command like that would let you do that in one line, much neater.

A second command, more like the if command:

result_int = Pick Int (condition, true int, false int)
result_str = Pick Str (condition, true str, false str)

So that if condition is true, it will output true int, and if condition is false, it will output false int. I think this would also neaten up coding somewhat. I know you can do

if condition then do something

in one line too, but having an if command as a variable command would mean a lot more flexibility. You could use it when calling a procedure, or another command, anything.

And the last thing is that I find the "result int" and "result str" things a little messy. In the future I think it would be much nicer to just be able to place the procedure as if it were a variable

ie: x = CallProc()

and the program would automatically run it and put the result into the variable. But that's a slightly less important issue.

10-27-2003 22:33

Posted by:
Miles

Location:
Australia

Click Here to Email Miles   Find more posts by Miles

Oops, forgot to close the italics somewhere there :P

10-28-2003 13:27

Posted by:
buddy

Location:
Champaign, IL

Click Here to Email buddy   Find more posts by buddy

A "Choose" command: like result = Choose ( variable, string1, string2, string3)

So that choose would output the first string on the list if that variable is equal to 0, the second string on the list if the variable is equal to 1 etc.

Buddy says...
You can just write a procedure for this yourself. The procedure would have to do the if / else thing, but then you could call your "Choose" procedure throughout the bulk of your code.


A second command, more like the if command:

result_int = Pick Int ( condition, true int, false int )
result_str = Pick Str ( condition, true str, false str )

Buddy says...
Same here... you can write your own procedure to do this.


And the last thing is that I find the "result int" and "result str" things a little messy. In the future I think it would be much nicer to just be able to place the procedure as if it were a variable

ie: x = CallProc()

Buddy says...
I agree. The "result int" thing is okay, but it would be great to be able to do something like this:
x=( CallProcA(args) * CallProcB(args) )

In this example, x is the product of the results of the calls to CallProcA and CallProcB.

10-28-2003 16:22

Posted by:
Wil Hostman

Find more posts by Wil Hostman

Very similar to the Select .... case command set.

looks like someone's been doing too much excell.... ;)

10-28-2003 21:19

Posted by:
Mark Tully

Location:
TNT HQ, England

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

We need to sort out the 'result int' command, but it's a limitation of the current TNT engine that's a bit difficult to work around... As for the 'choose' command, you can do that by using arrays.

Eg;

int x
int numChoices
str choices[]

restore arrayData
read numChoices
dim choices[numChoices]
for x = 0 to numChoices-1
read choices[x]
next x

arrayData:
data 5 ' num choices
data "string 1"
data "string 2"
data "apple"
data "pear"
data "banana"

Then use:

mystr = choices[myValue]

Granted it's not as neat, but it's pretty flexible, especially if to help duplicating the 'choose' command everywhere with the same values in it. Hope this helps,

Mark

10-28-2003 23:02

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

*gasp*

The data command will take strings?

11-01-2003 21:53

Posted by:
Mark Tully

Location:
TNT HQ, England

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

You can indeed read ints, floats and strings. This is mentioned in the documentation, but the new documentation makes it even clearer that this is the case. It will be posted soon.

Mark

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.