JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 2 of 171 View original ↗
  1. 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?
  2. This is more of a technical question than a regular help question: what version of JavaScript/ECMAScript does the game come with?
  3. 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.
  4. This is probably a question that needs its own thread.
  5. 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).

    Spoiler
    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:

    Spoiler
    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.
  6. Shaz said:
    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. :)
  7. 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:
  8. 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.
  9. 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;		}	}}
  10. 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!
  11. 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?
  12. 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.)
  13. 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!
  14. 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.
  15. 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?
  16. 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...
  17. 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.
  18. 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
  19. Anyone know an equivalent in MV for Graphics.snap_to_bitmap()?
  20. Zaibatsu said:
    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)

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

    Lakaroth said:
    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.