It does not work if I do this:
const OpenAI = require('openai'); const openai = new OpenAI({ apiKey: [[CHATGPTAPIKEY]] }); async function main() { const completion = await openai.chat.completions.create({ model: [[MODEL]], messages: [ {"role": "system", "content": "You are a "+[[COMMENTSTYLE]]+" assistant."}, {"role": "user", "content": [[SAVED_TEXT]]} ], temperature: [[TEMPERATURE2]], max_tokens: 150, stop: ["\n", "User:"], n: 1 }); [[OUTPUT]] = completion.choices[0]; } main();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?


and this is the end of Create_New_Account function

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!