JavaScript questions that don't deserve their own thread

Hendrik

Villager
Member
Joined
Mar 14, 2012
Messages
38
Reaction score
1
First Language
German
How can i access the instance i pushed to the SceneManager?

SceneManager.push(Scene_toD);
Code:
    function Scene_toD() {        this.initialize.apply(this, arguments);    }    Scene_toD.prototype = Object.create(Scene_MenuBase.prototype);
How can i display a window at the screen without freezing and filtering?
 

totlmstr

Warper
Member
Joined
Aug 20, 2015
Messages
4
Reaction score
0
First Language
English
Primarily Uses
This is more of a technical question than a regular help question: what version of JavaScript/ECMAScript does the game come with?
 

Hendrik

Villager
Member
Joined
Mar 14, 2012
Messages
38
Reaction score
1
First Language
German
Version 5.

I am now at the point where i can display a messagebox in a scene. 

var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function(command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'toD') { switch (args[0]) { case 'show': SceneManager.push(Scene_toD); break; case 'config': SceneManager._scene.toDShowDialog(Number(args[1]),String(args[2])); break; case 'hide': SceneManager._scene.hideDialog(); break; } } }; function Scene_toD() { this.initialize.apply(this, arguments); } Scene_toD.prototype = Object.create(Scene_MenuBase.prototype); Scene_toD.prototype.constructor = Scene_toD; Scene_toD.prototype.initialize = function() { Scene_MenuBase.prototype.initialize.call(this); }; Scene_toD.prototype.create = function() { Scene_MenuBase.prototype.create.call(this); this.todWindow = new Window_Base(20,20,500,100); this.todWindow.activate(); this.addWindow(this.todWindow); console.log(this) }; Scene_toD.prototype.showDialog = function(id, title) { this.todWindow.drawTextEx(title,5,5); this.todWindow.update(); } Scene_toD.prototype.hideDialog = function() { this.todWindow.close(); this.todWindow = null; };But i dont know how to tell the scene that it should not block the game or removing the blur filter.

Also somehow the text gets not displayed if the "config" case gets call ingame.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,200
Reaction score
14,240
First Language
English
Primarily Uses
RMMV
This is probably a question that needs its own thread.
 

tati light

Veteran
Veteran
Joined
Aug 15, 2015
Messages
160
Reaction score
110
First Language
English
Primarily Uses
How can I make any text appear in the screen at x,y position with font size? (in a script call)

Let's say for example: I want the string "Hello" to appear in the screen at 350x 160y in font size 36p, how can I do this?

(It's not like our message text from the editor, it's just a simple text appearing in the screen, I want to build my own way to show text on screen).

In AIR I would do something like this:

var myText:TextField = createCustomTextField(0, 20, 200, 20);myText.text = "This is a Text";I tried to do this (without luck):

this.bitmap.outlineColor = 'black';this.bitmap.outlineWidth = 8;this.bitmap.fontSize = 72;this.bitmap.drawText("Example", 15, 15, 100, 48, 'center');
Furthermore, I tried other approaches but still having crashes:

I was trying to display text in the screen with a script call inside an event, tried some solutions around but nothing seems to work.

I tried this code snippet took from Khan Academy:

textSize(46);fill(8, 142, 204);text("Sophia", 114, 120);But my game crashes saying: textSize is not defined.
If I use only the line with text("Sophia", 114, 120); => then I got "text is not defined".

I tried to use this, taken from other plugins:

this.drawText("example", 50, 50, 120, 'center');But then I get a crash "undefined is not a function".

Is there any way to do this? I wanted to learn how to display a text with exact position in the screen with a certain font size.
 
Last edited by a moderator:

laaghisce

Veteran
Veteran
Joined
Apr 18, 2015
Messages
33
Reaction score
24
First Language
English
Primarily Uses
RMMV
Yeah, fitting_height was also used in Ace, and maybe even VX.

So we're saying the number of lines by the height of each line, which will give the height of all the items combined. Adding standardPadding * 2 gives enough room for some spacing at the top and bottom of the contents.

@laaghisce, what you are asking for is a detailed walkthrough of a plugin. First I have to ask why you want to look at the script, if you have no scripting experience? Are you trying to use it, or to learn how to make one yourself? To use a plugin, you should not have to go into the script at all. If you want to learn how to make one, this is not the thread for it to happen in.

If you want your detailed walkthrough, could you please post a new thread in the Learning Javascript forum, state what plugin you're going to look at, ask what questions you would like answered, and someone will help you out :)
Yes, what I would like a detailed walkthrough of how to use the plugin but thank you for clarifying where I should begin the topic! I'll go start one soon. :)
 

babykgar

Villager
Member
Joined
Oct 19, 2015
Messages
14
Reaction score
1
First Language
English
Thanks, @Shaz!

Ok, in rpg_managers.js, for the SceneManager class, what is the difference between the properties

SceneManager._screenWidthSceneManager._screenHeightand

Code:
SceneManager._boxWidthSceneManager._boxHeight
I've been searching through the various js files to find their usages, and it really seems like they're virtually interchangeable.  :unsure:
 

GibzFGC

20+ Year RPG Maker Veteran
Veteran
Joined
Apr 26, 2012
Messages
46
Reaction score
17
First Language
English
Primarily Uses
RMMV
I need a little help. Is there a way of grabbing the selected index or symbol from Window_TitleCommand?  I've been through the code numerous times over the last three hours and there doesn't seem to be a way.

Any help would be greatly appreciated.
 

Firgof

Artist / Designer
Veteran
Joined
Jul 29, 2012
Messages
236
Reaction score
214
First Language
English
Primarily Uses
Is there a way to search the help file, specifically in the JS Library section?  I'm not seeing a button for it and I can't imagine that they'd put out a non-searchable help file.  I'm having to skip around a lot just to figure out how things work due to the lack of examples in the manual so a search feature would be divine right about now.

Also, am attempting to get a sprite to display but so far haven't had any success.  Anyone see a fault in what I'm doing?  It should be displaying an image, right?

Code:
crt_effect = function(){	console.log("I was run!");	var source = ImageManager.loadPicture("crt_linedcolor")	if (source != typeof null){		console.log("I grabbed an image file!");		if (source.isReady()){			var out = new Bitmap(source.width, source.height);			var spr = new Sprite(out);			spr.visible = true;			spr.opacity = 255;			spr.x = 120;			spr.y = 120;		}	}}
 
Last edited by a moderator:

Roguedeus

It's never too late to procrastinate...
Veteran
Joined
Mar 19, 2013
Messages
543
Reaction score
111
First Language
English
Primarily Uses
N/A
Is there an easy way to determine the current target of an applied item?

Such that a common event might call a script command that applies something like a class change, to the target of the item? (Rather than requiring a unique item for each potential actor)

I could do it without much effort in VXAce, using Ruby, but I've never touched JavaScript and would appreciate any direction I can get.

Thanks!
 
Joined
Oct 19, 2015
Messages
3
Reaction score
0
First Language
English
I know quite a few of the newer phones keep track of total daily steps to make it easier for pedometer apps to function without too much battery drainage. Is there an easy way to grab this variable using javascript?  Or will it require a more involved script?
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
I'm back about the same question as before, hopefully this doesn't sound too spammy...


Basically, I've re-implemented my game's special title menu that unlocks options based on switches/variables, previously made persistent through Fomar's VXAce script. I expected none of the locked options to work when testing, but somehow the switches from the most recent playthrough don't seem to reset until the game is closed or a new game is started. So even without persistent switches, an option requiring switch #004 to be set to true (which happens at the end of the first segment of my game) would be unlocked from completing that segment, as usual for the VXAce version. So those switches not being reset right away might end up being important in figuring out how to use the global data save... (or be unrelated. I think Fomar's script saved the persistent data as soon as a switch/variable was changed.)


At any rate, I'm mostly here to ask "can the switches/variables set in event code be made persistent" like in Fomar's VXCAce script, with the added request that I get shown the code/script/plugin that does this so I can make my game fully playable again. (Aside from cosmetic features, everything else has been updated now.)
 

Nelderson

Coding *****
Veteran
Joined
Mar 17, 2012
Messages
165
Reaction score
170
First Language
English
Primarily Uses
RMMV
So....I was messing around with MV and seeing how Node NPM and MV are related, and I found out quite a bit!

For starters I was able to to run npm install socket.io-client --save from my terminal, and I was able to require it easily to my project. 

I even made a quick a dirty client/server socket connection, and it all works great :D

More informational than problem related...but I hope someone gets use out of this post!
 

MikeMakes

Veteran
Veteran
Joined
Sep 30, 2015
Messages
187
Reaction score
46
First Language
English
Primarily Uses
I want the animations of the Sideview Weapons and Battlers holding them to be played a little faster through the frames.

Which plugin and where in it would I edit this?  I'll be using Yanfly's Battle Core and Action Packs, but I think I need to edit one of the main 1st party plugins.
 
Last edited by a moderator:

Zaibatsu

Villager
Member
Joined
Oct 24, 2015
Messages
6
Reaction score
1
First Language
English
Apparently $gameVariables[n] is not connected to the Variables you manually set through the windows. How do I get $gameVariables[n] to display in Message boxes?
 

Oshare

Fashionable Skeleton
Member
Joined
Oct 9, 2015
Messages
5
Reaction score
3
First Language
Dutch
I'm not exactly sure whether the question has been asked before (I have searched, though, but I can't dig up anything worthwhile) but trying myself has been proved too hard for me because I basically stop being able to read the moment I see code.

So I'm wondering, is there an easy way to add a Load/Continue/Whatever kids call it these days button to the in-game menu screen, or am I completely missing something? I don't want players(and myself while test playing) to completely exit the game just to load a save file. I'd rather have it in the in-game main menu.

The idea of a missing 'load' option in the main menu especially becomes frightening without a title screen at all.

Edit; never mind, im stupid. Never realized that having a load button in the in-game menu was never a default thing to begin with. Thats what happens when youve transferred the same scripts over to every project ever and never start completely fresh...
 
Last edited by a moderator:

Firgof

Artist / Designer
Veteran
Joined
Jul 29, 2012
Messages
236
Reaction score
214
First Language
English
Primarily Uses
I've simplified my above code to the following line which, if I'm reading the Sprite class's methods (and subsequent related objects' methods) properly, should automatically load, detect when it's loaded, and display.  Yet, it doesn't seem to do any of those things.

Am I calling it wrong?

var spriteT = new Sprite(ImageManager.loadPicture("digital-assist"));Edit: Oh.  JS doesn't support overloading functions.  Well, I guess I misunderstood what 'arguments' meant in Sprite_Base's initialize function.  Crap.
 
Last edited by a moderator:

Lakaroth

Veteran
Veteran
Joined
Dec 9, 2014
Messages
274
Reaction score
133
First Language
English
Primarily Uses
I'm almost ready to make my game, i have the right plugin and i can start to draw maps and characters.
I just need to solve two problems i'm not a programmer so entire game will be make by complex events, like rm2k or rm2k3 i'm old school but i know what to do.
 

My problem is:
1) I need to show some numbers stored in variables on the screen, without messages \v[1], because i need that for some custom HUD in my game, so i need to choice position by XY coordinates

2) I need to call a MAP EVENT instead common events, because i wanna order some functions in differents event pages to have more order in my maps.

This need a plugin or they are easy functions called by scripts?
Best
 

Firgof

Artist / Designer
Veteran
Joined
Jul 29, 2012
Messages
236
Reaction score
214
First Language
English
Primarily Uses
Anyone know an equivalent in MV for Graphics.snap_to_bitmap()?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,200
Reaction score
14,240
First Language
English
Primarily Uses
RMMV
Apparently $gameVariables[n] is not connected to the Variables you manually set through the windows. How do I get $gameVariables[n] to display in Message boxes?
$gameVariables.value(n)

Anyone know an equivalent in MV for Graphics.snap_to_bitmap()?
try Bitmap.snap

I'm almost ready to make my game, i have the right plugin and i can start to draw maps and characters.

I just need to solve two problems i'm not a programmer so entire game will be make by complex events, like rm2k or rm2k3 i'm old school but i know what to do.

My problem is:

1) I need to show some numbers stored in variables on the screen, without messages \v[1], because i need that for some custom HUD in my game, so i need to choice position by XY coordinates

2) I need to call a MAP EVENT instead common events, because i wanna order some functions in differents event pages to have more order in my maps.

This need a plugin or they are easy functions called by scripts?

Best
For (1) can you please make a new thread in the JS Plugin Requests forum?  In fact take a look through there first, as it sounds like one that I saw posted yesterday, so someone else may have already asked for the same thing.

For (2) use $gameMap.event(n).start() where n is the event id.
 
Last edited by a moderator:

Latest Threads

Latest Profile Posts

Tarzanthecat wrote on hiddenone's profile.
THANK YOU SO MUCH HIDDENONE ADSKFSJDFSKDF
Another unscheduled stream for Lightestone~ this time because we hit affiliate! Aaaahh- So other than the game we're also going to work on emotes/badges/etc!

www.twitch.tv/riazey
Is it necroposting if I ask for more info in my own months old thread? All the information in the thread is relevant

Forum statistics

Threads
108,977
Messages
1,040,993
Members
141,438
Latest member
QueenShadow
Top