CLEO Help Creating a file, automatically.

CLEO related
Status
Not open for further replies.

Crayder

Active member
Joined
Mar 6, 2014
Messages
148
Reaction score
0
Well so far the only file opcodes I know of are the move, copy, delete, write, and open opcodes... None of them actually create a file (well except the move/copy opcodes, but a file must exist before the new one is created).

Am I missing something? I tried the using the openfile opcode, but ofc it doesn't make the file...

Who can help me out here...?
 

Crayder

Active member
Joined
Mar 6, 2014
Messages
148
Reaction score
0
We'll, I thought it was going to work... The game crashes as soon as the cleo mods start loading when I use the create modes (gtasa.exe has stopped working...). Why does this happen?
 

Crayder

Active member
Joined
Mar 6, 2014
Messages
148
Reaction score
0
When I have this line, the game crashes directly after the loading screens...
Code:
$file = File.Open("CLEO\filename.txt", "at+")
What is wrong with it? I also tried opening using the following line...
Code:
0A9A: $file = openfile "CLEO\filename.ini" mode "at+"
Same problem as above...
EDIT: I found that no matter what string modifier is at the end (CLEO4), it crashes, but anytime there is a hex modifier (CLEO3), it works but the hex modifiers do not offer the option to create... I have CLEO 4.3 (although I hear that 4.1 is better) installed so that shouldn't the problem...


Even the line you in your post crashes my game...
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
Code:
{$CLEO .cs}
0000:

IF 8AAB: file_exist "CLEO\filename.txt"
THEN
    0@ = File.Open("CLEO\filename.txt", "at+")
    File.Close(0@)
END
0A93:

Tested with CLEO 4.3/4.1.
 

Crayder

Active member
Joined
Mar 6, 2014
Messages
148
Reaction score
0
springfield link said:
Code:
{$CLEO .cs}
0000:

IF 8AAB: file_exist "CLEO\filename.txt"
THEN
    0@ = File.Open("CLEO\filename.txt", "at+")
    File.Close(0@)
END
0A93:

Tested with CLEO 4.3/4.1.

So basically the only thing I don't have of what you just posted is the NOP and the End-Custom-Script opcodes, with or without (tested both), the script still crashes with these lines... I've tested on CLEO 4.3 and 4.1, neither show different outcomes...

When I use this:
Code:
0000:
$tmp = File.Open("CLEO\firespeed.ini", "at+")
File.Close($tmp)
0A93:
The script crashes as soon as it loads... But when those lines are commented, the script continues (but the file doesn't exist and all of my value are 0, obviously)...

If you'd like I could send you the rest of my script to show you how it works, but I'm %150 sure it's right.
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
Try using local vars(@) not globals($)
Also make sure your game folder is not read only and you have the 'FileSystemOperation.cleo' file in your CLEO folder.
More so, if you use vista/win7 or higher and UAC is on the file might be created in your virtualStore folder.

I attached the compiled .cs, try it out.
 

Attachments

  • createfile.cs
    70 bytes · Views: 65

Crayder

Active member
Joined
Mar 6, 2014
Messages
148
Reaction score
0
springfield link said:
Try using local vars(@) not globals($)
Also make sure your game folder is not read only and you have the 'FileSystemOperation.cleo' file in your CLEO folder.
More so, if you use vista/win7 or higher and UAC is on the file might be created in your virtualStore folder.

I attached the compiled .cs, try it out.
I have all of your requirements, same result... Can I send you my script so you can test on your computer, then we'll know if its the script or my computer... (Also, it was local vars before, I just thought I could change it up to see if it made any difference for the crashes)
 

Crayder

Active member
Joined
Mar 6, 2014
Messages
148
Reaction score
0
Opcode.eXe link said:
This also creates a file:

0AF1: write_int 0 to_ini_file "cleo\file.txt" section " " key " "
Oddly, this works! Only downside (but who cares,) is that the contents of the file created contains the blank data:
Code:
[]
=0
This is no problem to me, so nice work... I wish I had an explanation to why using blank strings works but when I use anything else it crashes, or an explanation why everything else fails except for blank strings...
 
Status
Not open for further replies.
Top