Possible to find a pictures X?

SookyLala

Veteran
Veteran
Joined
Jun 20, 2015
Messages
34
Reaction score
7
First Language
English
Primarily Uses
I'm finding myself needing to know the location of a pictures X coordinate and store it into a variable.

I had tried $gameScreen.picture(n).x;

It doesn't crash, but if I print the variable to a message box it just prints out the function.

Is what I want possible?

Edit: I.E I would like to replace a picture with a new one, however the picture is constantly moving, so I need a way to find it and replace it rather than resetting it's position
 

cyanic

Veteran
Veteran
Joined
Nov 16, 2015
Messages
106
Reaction score
71
Primarily Uses
If it's printing out a function, you should probably run it as a function. Basically a lot of the data are exposed through getters, which are functions that retrieve the values you need for you.
 

SookyLala

Veteran
Veteran
Joined
Jun 20, 2015
Messages
34
Reaction score
7
First Language
English
Primarily Uses
If it's printing out a function, you should probably run it as a function. Basically a lot of the data are exposed through getters, which are functions that retrieve the values you need for you.
In all honesty, I barely understand Javascript, this is the first time I've used it. I'm not sure how I could run it as a function and store the value.

Edit: Maybe this should go into script requests, I have no idea where to begin, I just want to find the X of this picture
 
Last edited:

Llareian

Jack of All Trades, Master of None
Veteran
Joined
Jan 26, 2017
Messages
604
Reaction score
1,421
First Language
English
Primarily Uses
RMMV
@SookyLala I'm on my phone ATM so I can't verify, but the format for the actual x coordinate is usually *._x so try instead $gameScreen.picture(n)._x
 

SookyLala

Veteran
Veteran
Joined
Jun 20, 2015
Messages
34
Reaction score
7
First Language
English
Primarily Uses
@SookyLala I'm on my phone ATM so I can't verify, but the format for the actual x coordinate is usually *._x so try instead $gameScreen.picture(n)._x
Ah dude, that worked like a charm, thank you very much, to think I was missing one simple character.
I had noticed in the JS scripts that somethings were written with '_' in front, but I am having trouble finding my around the scripts, it's definitely not as noob friendly as RGSS3.

Thanks again, man.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
You can just do $gameScreen.picture(n)._pictureName = "new picture name" instead of having to pass in all the arguments again.
 

SookyLala

Veteran
Veteran
Joined
Jun 20, 2015
Messages
34
Reaction score
7
First Language
English
Primarily Uses
You can just do $gameScreen.picture(n)._pictureName = "new picture name" instead of having to pass in all the arguments again.

Hey thanks man, but I tried that in a script call and it didn't change my image. That would be a lot faster if I could get it to work
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
There would already have to be a picture there. Do you have any plugins that modify pictures? Can you show me the script call? Don't put the extension as part of the name - if your file is NewPicture.png then just put NewPicture
 

SookyLala

Veteran
Veteran
Joined
Jun 20, 2015
Messages
34
Reaction score
7
First Language
English
Primarily Uses
Yes, I had made sure the pictures were already there. The only Plugin I use is a Cache Preloader which I doesn't edit pictures.

I literally had an event with a wait time of 500 (To make sure all pictures were ready) and put ;

$gameScreen.picture(7)._pictureName = "Blood_Moon_Ripple_1"
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,640
First Language
Czech
Primarily Uses
RMMV
It's not _pictureName, but only _name.
 

SookyLala

Veteran
Veteran
Joined
Jun 20, 2015
Messages
34
Reaction score
7
First Language
English
Primarily Uses
@Shaz & Poryg

Yeah, that works, and is a lot faster. It gives me a bit of confidence that I was actually close to these commands on my own which I found going through the js files. Thanks a lot guys, very helpful
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
If you want to learn scripting by going through the files, I would recommend starting with Game_Interpreter in rpg_objects.js. This class handles the processing behind all the event commands. Find an event command you want to "look behind the scenes" with, and search for that exact text in that file. You will see what the engine does when you tell it to execute that event command.
 

SookyLala

Veteran
Veteran
Joined
Jun 20, 2015
Messages
34
Reaction score
7
First Language
English
Primarily Uses
If you want to learn scripting by going through the files, I would recommend starting with Game_Interpreter in rpg_objects.js. This class handles the processing behind all the event commands. Find an event command you want to "look behind the scenes" with, and search for that exact text in that file. You will see what the engine does when you tell it to execute that event command.
Cool, thank you for that, I was looking in rpg_sprites.js
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top