How to change the value of a variable in the script itself.



  • there's a too long didn't read version in the end:

    My script uses an account on a website to do something but then after a while this account becomes useless and I've incorporated an if condition for this that calls a function that creates another account and continue the script.

    But the problem is, when the thread restarts everytime it first tries to login with the useless account then create a new one, and so the script creates an account everytime it runs instead of using one account until a certain condition is fulfilled then make a new one and replace the variable with the new one.

    TL;DR: how do I change the value of a variable in an action in my script?

    0_1547133666379_1.PNG
    0_1547133830730_2.PNG

    and this is the end of Create_New_Account function

    0_1547133939179_3.PNG

    So what I want is to use the old account until it becomes useless which will trigger the formation of a new account that I want to replace the "old account" value of the variable "account" with the variable "tempmail" that I create in the function "Create_New_Account"

    Basically this function changes the variable in this thread only but once a new thread is started it'll use old account again. Hope I got my point across!



  • @helmish
    if I understand you correctly

    if[[OLD_VARIABLE]]=useless
    [[OLD_VARIABLE]]=[[NEW_VARIABLE]]



  • Hello!
    I have added further explanation and screenshots to the post to elaborate more!
    Thanks for your reply!



  • you can tell bas to read account from txt file and store new account in that txt file by replacing old account so that bas uses new account everytime



  • @andy231 Thank you I got it working! But also just for knowledge is it possible to change the value of the variable in the action?