![]() |
specific adding in a text file
well, as the title says, I'm trying to change something inside a text file (.arc)
my arc files are like this: HTML Code:
arcnames=I usually have to do it manually, but, I haven't found a method to edit one member of the file, I made a thread about this, but didn't get what I really wanted (I got confused, in a other way), I got told I could use obj.add(); but how do I use it with loadvars and savelines and such? I just want to add a string to arcnames, without rewriting the whole script with savelines.. so.. any thoughts? |
PHP Code:
And do player.addArc( arcname); (eventually add an ammount param) |
Quote:
|
Yes right now you have to read and write the whole file if you want to change something in the file. If you just want to append a line then you can use 1 instead of 0 for the second parameter to savelines/savevars/savestring
|
Quote:
btw, obj.remove(obj2) do that also work? (Removing of items :)) |
Quote:
1 = create (a) new line(s) (simply a copy of the old stuff, + some added stuff (in this case)) _ obj.remove( obj2) would work, just don't fill in an index number for obj2, but the actual text to remove, and it will search for it's position in the string, and remove it. |
Quote:
One last question: can I set a member directly? Since when I load a member by using obj.loadvars() it appears as an array, like if I did echo( arcnames[ 0]) it would return the first member, so.. Can I set it directly? PHP Code:
|
Quote:
and then: PHP Code:
|
| All times are GMT +2. The time now is 09:24 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.