MV Replacing script's elements using var, const, etc.

I have a long Script call with a couple of self-variables similar to:
self(this)["X"] = 48
(THIS) is a number of an event whose variables are being manipulated.
Now could I somehow replace (this) or self(this) with self(3)?

I've tried using both var X = smth and const X = smth functions, but nothing worked.
I don't understand - if you are actually using this in your script, it is the interpreter attached to that event, not a number of an event. If you are saying this = then you are going to cause problems.

Perhaps you should show a real example of what you are doing, rather than examples similar to what you're really doing.
Sorry, of course.
this means it's using the current event's ID. If I'm putting any number like 3 then I'll be referring to the event 3's self variables.
Basically a have a bunch of script calls:
self(this)["X"] = 48
self(this)["Y"] = 48
self(this)["Z"] = 48, etc.

but what I need is

self(3)["X"] = 48
self(3)["Y"] = 48
self(3)["Z"] = 48, etc.

only without manually redacting each scrip call.
It seems like you must be using some sort of plugin. It would help if we knew exactly what plugin that was.
What Solar_Flare said. Which plugin is providing you with the "self" object?
Or the "self" function, assuming that's actual code they're showing.
I assumed it didn't matter much in these situations 😀
I'm using Ozu's self variables plugin. I'm using it as a simple script call.
They work just fine if I change values manually.
self(this) can be easily converted into s
var s = self(this)

but you can't do this

◆Script:var (this) = (3)
: :self(this)["Idunno HP"] = 75
◆Si:Script:self(3)["Idunno HP"] == 75
◆Mensaje:Nada, Ventana, Inferior
: :1
◆
:Fin
◆Script:var this = 3
: :self(this)["Idunno HP"] = 75
◆Si:Script:self(3)["Idunno HP"] == 75
◆Mensaje:Nada, Ventana, Inferior
: :2
◆
:Fin
I assumed it didn't matter much in these situations 😀

It matters because you're using something that doesn't exist in the RPGMaker engine, meaning that a plugin must have added it.

If you read Ozu's documentation, it clearly says you can use self(3)… so what's the problem, exactly?

You can't/shouldn't assign to this by the way. Try something like var id = this and in the other case var id = 3, then do self(id).
Why don't you just do what you said in your first post and actually type self(3)?

If you want to get into some more advanced customizing of your game, I'd strongly suggest you do some basic JavaScript tutorials (such as w3schools). this is a pretty basic concept in the language, and it's a fundamental rule that you can never try to assign or change it (you'd never do something like this=3).

I know you're not doing anything super extensive, but guessing code is never a good idea - at best it might or might not work, but you won't know why. At worst, you break something.
I ended up fixing it through NotePad++ by redacting CommonEvents.js.
Thank you for your answers. I'm closing the thread

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/replacing-scripts-elements-using-var-const-etc.137927/