Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Martin_HH, TipmyPip), 1,279 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Writing return lines to a notepad file? #67026
03/18/06 19:29
03/18/06 19:29
Joined: Sep 2003
Posts: 281
Arkansas\USA
raiden Offline OP
Member
raiden  Offline OP
Member

Joined: Sep 2003
Posts: 281
Arkansas\USA
I cannot seperate data written to a notepad txt file with the "\n". When I open the txt file after I have written to it, it shows all on 1 line and has a little square in place of "\n".

I can however write the file as a wdl file, and when i open it, it will seperate the data on a newline.

Anybody know why notepad puts little sqaures in place of "\n", but wdl writes the return correctly?

Code:

var fHandle;
action testCar {
while(key_g == 0) { wait(1); }
fHandle = file_open_write("Car1.txt");
file_var_write(fHandle,int(my.x));
file_str_write(fHandle,"\n");
file_var_write(fhandle,int(my.y));
file_str_write(fHandle,"\n");
file_var_write(fHandle,int(my.z));
file_close(fHandle);
}



It displays in notepad like:
58 [] -3000 [] 64,
except the barckets are little squares, i don't know how to type them on my keyboard. If I write to "Car1.wdl" it displays in the script as:
58
-3000
64

I don't know whats wrong with notepad?

Thanks

-raiden


"It doesn't matter if we win or lose, it's how we make the game."
--------------------
Links: 3DGS for Dummies
Re: Writing return lines to a notepad file? [Re: raiden] #67027
03/18/06 20:05
03/18/06 20:05
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
maybe try it with "file_asc_write(number)" for "\n":
Code:

//replace these lines "file_str_write(fHandle,"\n");"
//by the following:
file_asc_write(fhandle,92); //writes "\"
file_asc_write(fhandle,110); //writes "n"



Dunno if this helps, but it might be worth a try, oh and by the way:
notepad won't interpreted "\n" like a return (line break or whatever), as far as I know.

Re: Writing return lines to a notepad file? [Re: raiden] #67028
03/19/06 03:37
03/19/06 03:37
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
Quote:

It displays in notepad like:
58 [] -3000 [] 64,
except the barckets are little squares, i don't know how to type them on my keyboard.




Two things. Notepad in XP, with word wrap enabled has a bug in it, of which I reported to Microsoft. To reproduce the bug, type some text so it wraps along another line, enable word wrap, save the file, then, in the middle of the first line of the file, type something so it causes the text to wrap along and there's the bug, a strange return. Disabling and reenabling wordwrap causes it to be fixed, but the moment you save it again, it happens again. To more thoroughly fix it, use Wordpad.

If you mean to get the  character, which, strangely, doesn't show up in Firefox when I copy it from the character map. There are 5 characters that cause the boxes, , of which don't show up in my browser text input field.... Another case are the characters before 20, such as the return or tab (characters 1F and before). There are two ways to get these special characters. One, and the best way, is to click start > run, then type "charmap.exe" without the quote and okay it. This is the character map. Make sure "Windows Western" or something is chosen rather than unicode as all unicode characters will not show up in the forums. The radical (for square roots) or infinity symbols, for example, comes out like this, √ ∞, even though I didn't type it like that. The other way, which is faster, provided you know what the character is, is to hold the alt key, type four digits, then release the alt key. For example Alt+0247 would give a character you should recognize as well as Alt+0169.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: Writing return lines to a notepad file? [Re: ulillillia] #67029
03/19/06 09:54
03/19/06 09:54
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Hey raiden,
its me again
I just wrote a txt file with notepad with two lines:
Quote:


Text
Text2




Then I opened it with HexEdit and looked up the hex codes of the return sign.
Its: "0D 0A"
Now converted to decimal numbers (ascii) its: "13 10"
So I tested it with 3DGS and it works.
The line break is visible in notepad.
So you simply have to replace your
"file_str_write(fhandle,"\n");" with the following two lines:
Code:

//.. your code before \n
file_asc_write(fhandle,13);
file_asc_write(fhandle,10);
//.. your code after \n



So your complete code would look like this:
Code:

var fHandle;
action testCar
{
while(key_g == 0) { wait(1); }
fHandle = file_open_write("Car1.txt");

file_var_write(fHandle,int(my.x));

//add a new line here:
file_asc_write(fhandle,13);
file_asc_write(fhandle,10);

file_var_write(fhandle,int(my.y));

//add a new line here:
file_asc_write(fhandle,13);
file_asc_write(fhandle,10);

file_var_write(fHandle,int(my.z));
file_close(fHandle);
}



Last edited by Thunder; 03/19/06 10:26.

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1