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,115
Reaction score
15,527
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,291
Reaction score
8,743
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,115
Reaction score
15,527
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,917
Reaction score
3,152
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,115
Reaction score
15,527
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 Posts

Latest Profile Posts

i missed a whole ass letter, how'm I gonna do that?
It is december, my dudes

badge_xmas.png
I love it when a plan comes together, and especially when Ruby decides to work with me when I decide to code. :kaopride:
Got sick and had to take a few days off work in order to get tested and make sure it wasn't the big one. Felt a lot better today and thought to myself, "Hey now, I can't get tested until tomorrow anyway, I can get so much character art done today!"
....I watched Youtube and browsed this site for hours instead.
>.>
But at least I'm doing the art now! Yaaaaay.......
1638314262144.png
Didn't wanna spam the feed by posting Denzel's spritelayer separae, but I'm real happy with how this concept is coming along so wanted to share it, innit :D

Forum statistics

Threads
117,092
Messages
1,104,508
Members
153,095
Latest member
cscott
Top