Jump to content

Recommended Posts

Posted

I'm try to get a value ($line) to increase by 1 and then write over the old value. It will read the number correctly, add 1 to it correctly but won't write it.

CODE

$line = FileReadLine("items.txt",3)

$line=$line+1

_FileWriteToLine("items.txt", 3,($a), 0)

Posted

Welcome to the forums.

$a isn't defined anywhere in your code.

If you check @error after the _FileWriteLine call, you'll see that the text is invalid. Apparently the function wants an actual string, not an integer. You can get around this by converting it.

Also, to replace the line (not insert), set the fourth parameter to 1.

Try this:

$line = FileReadLine("items.txt", 3)
        $line = $line + 1
        _FileWriteToLine("items.txt", 3, String($line), 1)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...