plopping the lights

Blitz3D Forums/Blitz3D Programming/plopping the lights

Rook Zimbabwe(Posted 2004) [#1]
I thought I would get fancy. I told my engine to make a file and record the number of my current X,Y,and Z loaction when I pressed the Lshift.

Well it does that.

But I was going to use the info in that file to put my braziers (and later my torches) as types...

You know... read the file and assign the values into type statements.

PROB: I open the file and nothing is in HUMAN!!!

I have tried writebyte and writefloat. All I get is:
" @·D ·6C ÍC?ˆËDäYCºì)DH7ÊDݶZCè.DâÊDhB[C.Æ1DÚ.ÊDß4[C¼ƒ5D"

This should be somethig near: 1618 218 731

It doesn't look like that to me. Does the computer see it this way???

-RZ

Oh the code to write the data:

If KeyHit(42) = True Then
	WriteFloat (fileout,x#)
	WriteFloat (fileout,y#)
	WriteFloat (fileout,z#)
EndIf



where x#,y# and z# are the current location of the camera/player. and fileout is the writefile name!


Ion-Storm(Posted 2004) [#2]
Post the code to how u are reading it.


Rook Zimbabwe(Posted 2004) [#3]
not reading it yet... looking at it in notepad.

When I changed writefloat to writestring I got numbers I could recognize... but I got too many of them... something like 6 numbers for every keyhit.

Thats just because of Blitz polling the keyboard??? Right???

what I get for ONE LOCATION... not touching the mouse to move or nothing... letting everything go and quickly depressing the button on the keyboard I get this:
(one location)
" 1629.21 206.367 601.912
 1623.96 216.742 669.778
 1619.73 218.463 688.857
 1616.15 219.171 708.069
 1616.23 219.284 727.676
 1620.53 219.014 728.664
 1619.65 218.665 738.322"

weirdness...


Zenith(Posted 2004) [#4]
That's because writefloat, writebyte, writeint, and writeshort do just that, write down a byte*

When you open the file, you're seeing the ascii representation of the characters in the bytes. Try out writeline. That will write out a string of text + a line break character.

Each one of the letters in this reply are bytes, the value being set by the keyboard output.

*- short = 2 bytes, int = 4 bytes, float = 4 bytes


Rook Zimbabwe(Posted 2004) [#5]
Ahhhh.... OK! :) Yepper... that has the trick of it... still getting characters that I did not tell the program to write bbbbbbbut... I can make sense of it. : )


Zethrax(Posted 2004) [#6]
Use WriteLine and ReadLine if you want values you can read in a text editor.