Help identifying correct Script call

J-G

Veteran
Member
Joined
Oct 4, 2019
Messages
554
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
464
Reaction score
200
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
554
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
464
Reaction score
200
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
554
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,418
Reaction score
669
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
554
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
464
Reaction score
200
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,462
Reaction score
390
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
554
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

Got inspired and started writing a simple tower defence battle system last night :o
Good news! I have located an amazing 3D website called SketchFab that has rotatable renderings of famous statues!
Picked up a physical copy of Megadimension Neptunia VII for the PS4 today. It's pretty good. I'm having a lot of fun with it.
The only upside of this remote semester was the plenty of funny photoshop material those facecams provided. Not that I would do that. Ever.

Forum statistics

Threads
100,516
Messages
976,704
Members
132,080
Latest member
nwr
Top