How to set c# code to reset globvar to 0?

Harambulus

Client
Регистрация
16.09.2011
Сообщения
365
Благодарностей
10
Баллы
18
I only know how to change it myself to +1 or -1 I get errors if I simply replace with 0 in the same code.

I want a project that will reset the global variable to 0 in poster whatever number it was on.

Using the example c# global variables c code from rostonix's posted test template. This is the code for adding and substracting.

Код:
lock(SyncObject) {
    var gbVar = project.GlobalVariables["[email protected]", "globVartumbp"];
    gbVar.Value = Convert.ToInt32(gbVar.Value.ToString())+1;
    project.Variables["currentValue"].Value = gbVar.Value.ToString();
}
Actually it needs more work than jsut that as I want it so it reads a text file to get the name of the global variable i want to change in the code as well. because the variable will change. I just want it to reset whichever one i want to 0 to workaround me having to close the whole poster down to reset it.

I thought to use set value in variables processing but realised i wouldnt be able to change the variable using a text file that way since it uses the drop downs to choose.
 

LexxWork

Client
Регистрация
31.10.2013
Сообщения
1 190
Благодарностей
787
Баллы
113
for 5/7/5/3 as i remember global variables are only get to reset stage when you delete the project frm manager or restart zennoposter.
don't use global variables - they are very unhandy.
 

Harambulus

Client
Регистрация
16.09.2011
Сообщения
365
Благодарностей
10
Баллы
18
They work fine for me apart from that you have to reset the project to reset them, which is exactly why i want to make this template to reset them myself which would solve the problem. They dont have to be reset (deinitialised) just set back to 0.
 

LexxWork

Client
Регистрация
31.10.2013
Сообщения
1 190
Благодарностей
787
Баллы
113
)) use new global variable to signal threads you want to reset your global variable to 0.
set your global variable to 0 when you get last thread at the end (need account project threads)
dump global variable to file table or list and read initial data from that file o set global vars in the input settings.
 

Harambulus

Client
Регистрация
16.09.2011
Сообщения
365
Благодарностей
10
Баллы
18
didnt understand.
 

Harambulus

Client
Регистрация
16.09.2011
Сообщения
365
Благодарностей
10
Баллы
18
no1 have any other suggestions? as i said before i wasnt able to use a global variable to set it to 0 because i need the global variable to be called form text file but i couldnt do that with set variables/variables procesing since it only works thru a drop down list and not call from text file like i want so need anther way to do it
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
I'm not sure i understand what problem you have.
 

Jack77

Новичок
Регистрация
25.10.2016
Сообщения
25
Благодарностей
3
Баллы
3

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