Status
Not open for further replies.

Bricabrac

The Storyteller
Veteran
Joined
May 24, 2016
Messages
113
Reaction score
218
First Language
Italian
Primarily Uses
RMMV
Hello! I am fighting with a small, maddening issue.
I am using the "Select Key Item" script call ($gameMessage.setItemChoice(var, n)) in a common event. And it works well!

upload_2018-9-12_21-57-58.png
My issue: the event runs the second script before I have selected an item in my window, and therefore throws me a "hey, this is undefined" error. I can't figure out how to make RPG Maker wait before running the rest of my code.

I believe this is happening because when you use the command instead of the script call, Game_Interpreter sets a wait mode, while my code doesn't:

upload_2018-9-12_22-5-41.png

I can't, however, find a function to manually set the wait mode myself.
Any advice? Even hackey solutions are welcome. I just want this to work.

Do you really need to use the script call instead of an event command?
Yes!
I made a custom category that shows me only certain items based on a variable. Can't really do this in any other way :V
 

Attachments

  • upload_2018-9-12_22-5-12.png
    upload_2018-9-12_22-5-12.png
    31 KB · Views: 5

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,144
First Language
English
Primarily Uses
RMMV
You've pretty much answered your own question - When you execute code from the Script Event Command, the value of "this" is actually the instance of the Game_Interpreter that is interpreting the event commands. So in the same script command as $gameMessage.setItemChoice you can execute:
Code:
this.setWaitMode('message');
 

Bricabrac

The Storyteller
Veteran
Joined
May 24, 2016
Messages
113
Reaction score
218
First Language
Italian
Primarily Uses
RMMV
When you execute code from the Script Event Command, the value of "this" is actually the instance of the Game_Interpreter that is interpreting the event commands
Oh! I am still a n00b scripter and had no idea about this.
Works beautifully, thanks a lot!
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
8,938
Reaction score
5,851
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

I'm tempted to leave the Fight/Escape choice in the Boss Battle submission and make Escape pop up Nedry from Jurassic Park: "Uh uh unh!"
Is it weird that i feel overwhelmed from reading codes that i wrote few months ago? Lol.

I dont even know where to continue!:hsad:
Ami
Gosh,I want to Play this Game Again one more again!

Seeing my Own Character & Kannono Once Again!
Tales_of_the_World_Radiant_Mythology_3_JPN_PSP-Coverart.jpg
I've been a bit to depressed to get work done on the game lately. Don't worry, I'll be okay.

Forum statistics

Threads
115,306
Messages
1,088,797
Members
149,951
Latest member
abishanth
Top