Help identifying correct Script call

J-G

Veteran
Member
Joined
Oct 4, 2019
Messages
606
Reaction score
143
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
533
Reaction score
235
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
606
Reaction score
143
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
533
Reaction score
235
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
606
Reaction score
143
First Language
English
Primarily Uses
RMMV
okay let me do a quick test. thanks
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,695
Reaction score
1,113
First Language
Portuguese - Br
Primarily Uses
RMMZ
$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
606
Reaction score
143
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
533
Reaction score
235
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,492
Reaction score
408
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
606
Reaction score
143
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 Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,096
Members
137,588
Latest member
_Coby_
Top