#1 03-10-2010 18:02

ATP
Registered: 07-07-2009
Posts: 15
Website

Problem with 0A9A open file

Hi,
I can wirte informations to file with this:

:01
0001: wait 0 ms 
068D: get_camera_position_to $CAM_POS_X $CAM_POS_Y $CAM_POS_Z
068E: get_camera_target_point_to $CAM_TARGET_X $CAM_TARGET_Y $CAM_TARGET_Z
00D6: if 0
0AB0:  key_pressed 88
004D: jump_if_false @01
00D6: if 0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @01
00D6: if 0
0A9A:   $hFILE = openfile "cam.ini" mode 0x77 // IF and SET 
004D: jump_if_false @01
0AD9: write_formatted_text "Camera Position: %g %g %g Camera Target: %g %g %g" in_file $hFile $CAM_POS_X $CAM_POS_Y $CAM_POS_Z $CAM_TARGET_X $CAM_TARGET_Y $CAM_TARGET_Z
0A9B: closefile $hFILE
0002: jump @01

That works fine, but if I try to append the informations to the file my game crashes, I use this code:

:01
0001: wait 0 ms 
068D: get_camera_position_to $CAM_POS_X $CAM_POS_Y $CAM_POS_Z
068E: get_camera_target_point_to $CAM_TARGET_X $CAM_TARGET_Y $CAM_TARGET_Z
00D6: if 0
0AB0:  key_pressed 88
004D: jump_if_false @01
00D6: if 0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @01
00D6: if 0
0A9A:   $hFILE = openfile "cam.ini" mode "at+" // IF and SET 
004D: jump_if_false @01
0AD9: write_formatted_text "Camera Position: %g %g %g Camera Target: %g %g %g" in_file $hFile $CAM_POS_X $CAM_POS_Y $CAM_POS_Z $CAM_TARGET_X $CAM_TARGET_Y $CAM_TARGET_Z
0A9B: closefile $hFILE
0002: jump @01

Offline

#2 04-10-2010 20:26

Silent
Registered: 08-05-2010
Posts: 29

Re: Problem with 0A9A open file

Maybe you should try "wt+"? I can't understand a difference between at and wt tongue


Edit: You've selected 'As is' case converting in SB option? 'cos I've had the same problem when my case converting was set to 'uppercase' - "AT+" =/= "at+"

Last edited by SilentPL (04-10-2010 20:27)

Offline

#3 04-10-2010 22:28

ATP
Registered: 07-07-2009
Posts: 15
Website

Re: Problem with 0A9A open file

SilentPL wrote:

Edit: You've selected 'As is' case converting in SB option? 'cos I've had the same problem when my case converting was set to 'uppercase' - "AT+" =/= "at+"

Thanks man, that solved my problemgood.gif

Last edited by ATP (04-10-2010 22:29)

Offline

#4 06-10-2010 19:21

Deji
From: UK
Registered: 09-11-2008
Posts: 189
Website

Re: Problem with 0A9A open file

For the record, "at" means "append text", so it adds it to the end of the text file. + just creates the file if it doesn't exist.

Let's say we wanna write " programs are annoying" to a file.

wt

File before

Hello world

File after

 programs are annoying

at

File before

Hello world

File after

Hello world programs are annoying

Offline

Board footer

Powered by FluxBB