Status
Not open for further replies.
Joined
Oct 29, 2021
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMMV
Hi, I am new to javascript and RPG maker scripting (also the forum). Currently, I am trying to convert a dating sim I made in twine, into RPG maker MV but I am rather confused. Currently, this system is supposed to check the character's (you the player are interacting with) affection, then check the random "roll" variable which is updated every time the event is accessed, to then change how the character responds to the player. This is exactly how it works in my twine version of the game, I just have no clue how to convert it, I did try some standard javascript stuff but it didn't work either.

Real.PNG
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
45,465
Reaction score
16,386
First Language
English
Primarily Uses
RMMV
Try putting all of that into a single script call, not 5 different calls.

I'm also not sure if $gameMessage.add is the only thing you need to do, to get a message to display via script. Because you just said "it didn't work" without saying what IS happening, I don't know if it's just that the wrong message is showing, or NO message is showing, or if you are getting an error. More information when something "doesn't work" is helpful.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
37,930
Reaction score
10,513
First Language
German
Primarily Uses
RMMV
just for information:
the script command is intended for small things, larger scripts should be done as plugins and called from there.
because of this the script command is basically sandboxed - any variables defined in one script box will be deleted once that script box is closed. You would need to define variables outside the script box to keep their values - either by plugin or by control variable event command.

you might want to look into using event commands anyway, because that is what they are defined for. And some features are better integrated by event command while other options are better done by script functions. But you'll need to know both to be able to see when the javascript and when the event command would be the better solution.
 
Joined
Oct 29, 2021
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMMV
Try putting all of that into a single script call, not 5 different calls.

I'm also not sure if $gameMessage.add is the only thing you need to do, to get a message to display via script. Because you just said "it didn't work" without saying what IS happening, I don't know if it's just that the wrong message is showing, or NO message is showing, or if you are getting an error. More information when something "doesn't work" is helpful.
I apologize I was actually thinking I put too much information in. So I merged all the script calls, into one. Still no message displays, the only thing that happens is the event image flashes. I was able to get an $gamemessage.add to work by itself, but not within the if statement. (Yeah the $gameMessage.add only worked when I set up the background and position. )
I didn't know that Andar thank you both, I did figure out a rather barbaric way of doing it with events/ common events/ and such. I did not know that about scripts, and temp variables but I was going to define them outside of it.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
45,465
Reaction score
16,386
First Language
English
Primarily Uses
RMMV
You could ditch the $gameMessage.add commands, and just set a variable to whatever text you want, via $gameVariables.setValue(5, "Hi") in the script. Then in your Show Text event, put \v[5] to display what's in that variable.

But yeah, I'd personally just ditch the scripts altogether and use conditional branches and show text.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
6,005
Reaction score
5,963
First Language
English
Primarily Uses
RMMZ
If you don't want to dedicate game variables to this, you can get around the block-scoped nature of the script command by using "window.whatever" as your identifiers, and they'll persist between script calls.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
45,465
Reaction score
16,386
First Language
English
Primarily Uses
RMMV

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 Profile Posts

Has it really been 50 streams? At this point it's just guilting me into pushing out a prototype. :kaoswt:



I should probably just bite the bullet and send it out, then go with my original plan to provide weekly updates.
I know it's just other small RM devs, but it still always feels legitimizing to have folks email me in private with a steam key, requesting a review of their game.:kaoluv: Look ma, I've made it to the big leagues. small edit: another email just came in. :kaoback:
time and time again I enjoy dramatic remarks on how I should find a better job.
As it stands, I go to work for 10-14 days a month. At work, I have time for my private projects. I arrive home, my mind is clear.
So yes, the pay sucks. But I have what so many lose after graduation. Freedom.
Came back cuz of the sale. Got MZ. The System 2 advanced settings for UI are so frustrating, and I see we still hate pixel fonts. Marvelous.
Did another YouTube short. This one has like 1k views (or maybe 380? Analytics is being weird). Getting them zoomer views, yo!

Forum statistics

Threads
129,720
Messages
1,204,651
Members
170,803
Latest member
JimGTz
Top