Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / file troubles

Author
Message
Cemetery Ridge
17
Years of Service
User Offline
Joined: 23rd Mar 2007
Location:
Posted: 1st Apr 2007 02:46 Edited at: 1st Apr 2007 02:50
whats wrong with it?

zeddex2
17
Years of Service
User Offline
Joined: 4th Mar 2007
Location:
Posted: 1st Apr 2007 02:50
in the input command its a string, so obj1x$

use the $ after the vaiable

i think that the problem

If you can, I can!
Cemetery Ridge
17
Years of Service
User Offline
Joined: 23rd Mar 2007
Location:
Posted: 1st Apr 2007 02:51
i dont need it to be a string tho i need a variable
zeddex2
17
Years of Service
User Offline
Joined: 4th Mar 2007
Location:
Posted: 1st Apr 2007 06:00
but the input command ask an answer to be a string

so you can do something like that
input "x", obj1x$

obj1x# = int(obj1x$)



that your code

all the problem in your code

input ask for a string answer

you open to write a file but you read it : so open your file to read


I'm not good with file I/O becose I'm learning that now but try that


i'm not sure the code is all ok but try this

and that my post when i got proble to write to file and now i m ok i think http://forum.thegamecreators.com/?m=forum_view&t=103230&b=1

If you can, I can!
Quisco DaLuse
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 1st Apr 2007 22:45
Try this code:


You must use a string to get input from the keyboard. However, you can convert the value of the string to a variable using the VAL function, as shown in the code. Be forewarned, the code listed does not do error checking, so if the user enters anything other than a number, if will fail.

You idiots! You've captured their stunt doubles!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd Apr 2007 03:20
Quote: "in the input command its a string, so obj1x$"


Quote: "You must use a string to get input from the keyboard."


Both not true!

input "x ",obj1x

...reads in a numeric value and stores it in the numeric variable 'obj1x'.

Quisco DaLuse's code modified:



Or, you could just write the data out as a text file:



You can then open the file with Notepad and check the contents are what they should be. You load the data back in with Read String and VAL as in:

Read String 1,T$: obj1x = VAL(T$)
Read String 1,T$: obj1y = VAL(T$)
Read String 1,T$: obj1z = VAL(T$)

TDK_Man

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Cemetery Ridge
17
Years of Service
User Offline
Joined: 23rd Mar 2007
Location:
Posted: 6th Apr 2007 02:47
tnks alot that helped

Login to post a reply

Server time is: 2024-11-25 20:48:21
Your offset time is: 2024-11-25 20:48:21