Help identifying correct Script call

J-G

Veteran
Member
Joined
Oct 4, 2019
Messages
556
Reaction score
128
First Language
English
Primarily Uses
RMMV
Im making an event that checks if X picture is displayed, if yes then it runs event, that works great, the issue is in the else statement.
What would be the correct script to use to check if picture X has been erased or is no longer shown?
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
493
Reaction score
216
First Language
English
Primarily Uses
RMMV
I believe this will work (in a conditional branch script call):

JavaScript:
$gameScreen.picture(3).name()
From what I can tell, that should return true if picture 3 is currently displayed.

(If you want to be a little more pedantic, you can add two exclamation marks to the beginning, or != '' to the end - just one of those, not both.)
 

J-G

Veteran
Member
Joined
Oct 4, 2019
Messages
556
Reaction score
128
First Language
English
Primarily Uses
RMMV
so then if picture 3 is no longer shown it will return false correct?
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
493
Reaction score
216
First Language
English
Primarily Uses
RMMV
It should return false if picture 3 is not currently shown, yes.
 

J-G

Veteran
Member
Joined
Oct 4, 2019
Messages
556
Reaction score
128
First Language
English
Primarily Uses
RMMV
okay let me do a quick test. thanks
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,419
Reaction score
673
First Language
Portuguese - Br
Primarily Uses
RMMV
$gameScreen.picture(3).name()
Using that will return true in an if statement, but also will return an error on the else statement(if picture is not on the screen -erased-) Cannot read property 'name' of null
1593993319229.png

The correct is using only this:
JavaScript:
$gameScreen.picture(3)
1593993404048.png
Because if it is erased, the code ($gameScreen.picture(3)) will return null.
 
  • Like
Reactions: Bex

J-G

Veteran
Member
Joined
Oct 4, 2019
Messages
556
Reaction score
128
First Language
English
Primarily Uses
RMMV
ooohhhh okay, i kinda ended up using something completely different to make the event work, but now i've learned a little more, thanks.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
493
Reaction score
216
First Language
English
Primarily Uses
RMMV
Yeah, I was a little uncertain about whether erased pictures still exist (just with no picture) or are destroyed entirely.
 
  • Like
Reactions: J-G

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,482
Reaction score
397
First Language
German
Primarily Uses
RMMV
If you want to execute something one time every time the Picture gets shown or deleted, you could do this:
(I copy pasted the Eventcode as Text)
Code:
◆If:Script:$gameScreen.picture(3)
  ◆If:Switch19 is OFF
    ◆Control Switches:#0019 Switch19 = ON
    ◆Text:None, Window, Bottom
    :    :Some Event somewhere made that Picture 3 is shown.
    ◆
  :End
  ◆
:Else
  ◆If:Switch19 is ON
    ◆Control Switches:#0019 Switch19 = OFF
    ◆Text:None, Window, Bottom
    :    :Some Event somewhere made that Picture 3 got Erased.
    ◆
  :End
  ◆
:End
 

J-G

Veteran
Member
Joined
Oct 4, 2019
Messages
556
Reaction score
128
First Language
English
Primarily Uses
RMMV
Thanks for that Info. I actually found a very usual edit of a plugin that made the whole process way more simply and made it touch or mouse click like I wanted.
Since yeps pic common event wouldn't work in this case and galvs screen buttons didn't play well with umapi.
 

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

Latest Threads

Latest Profile Posts

And back. Trying to work online with no internet for 1.5 days was...interesting. I felt like a character in a old Sierra game trying to find internet due to all the hoops I had to jump through just to get online for work.
grief... if MV didn't have certain plugins already, I think I'd upgrade to MZ. seeing like 10 MV plugins in 1 MZ one is hilariously convenient lol.
Have you already checkes out my mapping tutorial on the blog? I would love to hear your feedback and things you'd like to see in the future!

one of character for my upcoming game idk how to design o_O

Designing patches that can 'augmented' to clothing based armor. Such good fun. A bit time consuming due to the need to create image displays, but the patches are limited so it's not too tiring.
Note: lol, posting this made me find a couple mistakes.

Forum statistics

Threads
100,737
Messages
978,945
Members
132,359
Latest member
PhilKeepItReal
Top