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
44,078
Reaction score
15,497
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
34,256
Reaction score
8,711
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
44,078
Reaction score
15,497
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
3,910
Reaction score
3,133
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
44,078
Reaction score
15,497
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

TFW you get a plugin working correctly with your other plugins ♡\( ̄▽ ̄)/♡

(CW for minor gore - Einar's Y incision is gone for his test portrait)

Cs5kAbZ.png
Doing some winter related edits for a cozy cottage!
I think it's the third time I am changing my skill info plugin, but as I get better at programming, I want to fix the trash I made earlier :p

Streaming while I am programming the plugin. Join in if you wish :)
Currently working on a side game for the One Map Game Challenge. :kaoblush:
3H2mUEI.png

As you can see, the game will be called "Welcome To November". Hopefully, I'll finish it before November ends. :dizzy:
In two days we already have the first advent sunday :eek: Time flies...

Forum statistics

Threads
116,977
Messages
1,103,474
Members
152,843
Latest member
ZarkArk
Top