Finding the image of an event with scripting

I have a script that assigns the image of events based on an interaction. However, once I have the image transferred to the event, I want to be able to examine the image with another script and get the value of the image used by the event.

Basically, I'm able to go forwards (value -> image -> event), and now I want to be able to go backwards (event -> image -> value).

I think there should be a script that looks something along these lines, but I don't know what it is:
Ruby:
$gameMap.event(EventID).SomeFunction
Where SomeFunction would return one or both of the values used to set the event's image.

Any help is greatly appreciated!
I think it's characterName, within rpg_objects.
I know it inherits from page, and it inherits from event (object > event > page > graphic > image) but I don't remember the actual structure.

if you ping characterName, it'll return the name string, not the bitmap.
you have to use that string to find the actual image from the cache, or poke an intermediate step to grab it before passing it to the event.

it should be detailed in the help files, within the program's folder.
I think it's characterName, within rpg_objects.
I know it inherits from page, and it inherits from event (object > event > page > graphic > image) but I don't remember the actual structure.

if you ping characterName, it'll return the name string, not the bitmap.
you have to use that string to find the actual image from the cache, or poke an intermediate step to grab it before passing it to the event.

it should be detailed in the help files, within the program's folder.

Since I want to convert the image to a numerical value, a name string is perfect. Thanks for the help! I'll try this out right away and let you know if this works.
I think it's characterName, within rpg_objects.
I know it inherits from page, and it inherits from event (object > event > page > graphic > image) but I don't remember the actual structure.

if you ping characterName, it'll return the name string, not the bitmap.
you have to use that string to find the actual image from the cache, or poke an intermediate step to grab it before passing it to the event.

it should be detailed in the help files, within the program's folder.

I tried passing characterName , as gstv87 suggested, but during testing, it comes up with the error ".characterName is not a function"
OK, I finally figured it out.

I managed to stumble onto a really fantastic resource that helped me figure it out:

So anyhow, here's the script I'm using now to do the job. I just used it to define a "Control Variables" within the Script option.

Ruby:
$gameMap.event(this.eventId()).characterName()

This returns the filename the event is using. The first part just says that we're looking at an event, and the Event ID of that event is defined by "this.eventId", which states that it's the event that triggered the script. The .characterName() method returns the filename for the event we selected with the first part.

Ruby:
$gameMap.event(this.eventId()).characterIndex()

This returns the index on the spritesheet that the event is using. The first part is the same as before, the last portion returns the index. For more information on how indexes work, check out Eliaquim's answer to one of my other questions. (https://forums.rpgmakerweb.com/inde...nt-images-with-variables.117277/#post-1032094). That post also has a great explanation of how the filename/index system works in general.

This was probably what gstv87 was trying to tell me, but I evidently didn't understand it. Thanks for trying!

Anyhow, I think that's about it, so happy scripting I guess.

Original thread: https://forums.rpgmakerweb.com/threads/finding-the-image-of-an-event-with-scripting.119509/