Eliminating last string of a file gets rid of the entire file!?

jp1

Client
Регистрация
23.01.2011
Сообщения
234
Благодарностей
2
Баллы
0
Hi guys,what's the most elegant workaround you can think for this?

This is a problem because the next time the template is activated, it'll get stuck because it can't see that file. I'm surprised it doesn't keep the file as having a file of this name is necessary especially if you're doing some step branches that add strings to the file and then later on extract those strings from the same file. I want the .txt file to survive even if there are no strings left.

The only workaround to this I can think of is substitute the random in

{-File.GetString-|-\Resources\-|-random-|-true-}

with whatever the number of files are, selected only from line 2. And entering a blank space always at the beginning of the file, so that the blank space is string number 1 and it prevents the file from disappearing. Right now, I don't know how to. If there were 10 strings appended to the file we want to extract, would it be:

{-File.GetString-|-\Resources\-|-2;11-|-true-}


Please correct me if I'm wrong.

The real issue is when we appended varying numbers of strings, and then we later on want to extract them. This is the real weakness of the file getting eaten up when all the strings are eaten. But maybe I'm doing something wrong and this can be avoided? If no perhaps this is a bug that can be fixed at the next update? thanks
 

Stereomike

Client
Регистрация
29.03.2011
Сообщения
221
Благодарностей
30
Баллы
0
Just take line 1 instead of 0.

{-File.GetString-|-\Resources\-|-1-|-true-}
When reading and deleting line 1 all the time, line 0 will be left over (you could put a description in it). Since writing to file appends it to the end of the file, your line 0 will stay untouched from now.
If you need the randomness, you could look up the number of lines in your file, generate a random number between '1-number of lines' and do {-File.GetString-|-\Resources\-|-FROM_RANDOM_NODE-|-true-}
 

jp1

Client
Регистрация
23.01.2011
Сообщения
234
Благодарностей
2
Баллы
0
Just take line 1 instead of 0.

{-File.GetString-|-\Resources\-|-1-|-true-}
When reading and deleting line 1 all the time, line 0 will be left over (you could put a description in it). Since writing to file appends it to the end of the file, your line 0 will stay untouched from now.
If you need the randomness, you could look up the number of lines in your file, generate a random number between '1-number of lines' and do {-File.GetString-|-\Resources\-|-FROM_RANDOM_NODE-|-true-}
Ahh ok gotcha thanks.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)