Global Variable Question. Please help

nova

Client
Регистрация
09.10.2011
Сообщения
88
Благодарностей
7
Баллы
8
Hello.

I am trying to make a simple example where I want to have a global variable and +1 to it. So when each thread runs that global variable will increase by 1. I tried to do this but every time the value is reset to 1. So if i make it run 5 times on 1 thread and the browser closes and opens a new one i want it to keep doing +1 to the value so it should equal 5.

Can anyone please tell me how i can do this? I am using ZennoPoster 5.0.7.0

Thanks
 
  • Спасибо
Реакции: mikakojonkowski

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
Honestly, the best way to handle it is to write to a file. You can take a value from a file add one to it and write it back for the next thread to use. If you insist on using the global you will need to have a check in the beginning of the template to see what the value is and then add 1 to it or set it. Ever since they took out the ability to set the value externally, hasn't been much use for counters to me.
 
  • Спасибо
Реакции: mikakojonkowski и nova
Регистрация
16.05.2014
Сообщения
145
Благодарностей
23
Баллы
18
Post from 2013, maybe something has changed? I need the same thing, to keep increasing global variable +1.
One template, many threads working on database, ideas?

Maybe i am doing something wrong, but writing and reading from file isnt working well, when using 100 threads without browser in a loop numbers are repeated?


EDIT: Yes, of course, you have to bind file to list, and work on a list - then it works very well.
 
Последнее редактирование:

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