JavaScript questions that don't deserve their own thread

sleepy_sealion

Need to work harder!
Veteran
Joined
Jan 4, 2018
Messages
241
Reaction score
364
First Language
English
Primarily Uses
RMVXA
Sorry if I'm butchering the language. I meant that on top of the value, I could get other things like the targets/items name and stuff like that. But it's really fine if it doesn't work out like that - since I can just think up a generic message for what I'm trying to do.

Thanks for the help/explanation though.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,695
Reaction score
5,364
First Language
Indonesian
Primarily Uses
RMVXA
Okay, you made me look into the actual js file. In your case specifically, you get the variable item by calling this.item() so, yes, you can do that. I'm not sure what else you need.
 

BlueBomber000

Villager
Member
Joined
Dec 23, 2018
Messages
26
Reaction score
14
First Language
English
Primarily Uses
RMMV
Oh, just checked the code of Yanfly's Skill Core; looks like you should replace skill with item, i.e.
JavaScript:
if (!user.isLearnedSkill(item.id)) {
  user.learnSkill(item.id);
  var text = user.name() + ' discovered the formula for ';
  text += item.name + '!';
  $gameMessage.add(text);
}
Worked like a charm! Thanks so much!
 
Last edited:

AtheonX

Warper
Member
Joined
Jan 2, 2020
Messages
1
Reaction score
0
First Language
Norwegian
Primarily Uses
RMMV
Hi, in Yanfly's YEP_X_AftermathLevelUp.js there is a variable called TextManager.exp, which prints the text from the database field "EXP:" (Terms / Basic Statuses). I would love for it to fetch from the field "EXP (abbr.):" instead. Is there a way I can make that happen?

Edit: TextManager.expA worked
 
Last edited:

Zion

Veteran
Veteran
Joined
Mar 12, 2018
Messages
50
Reaction score
13
First Language
German
Primarily Uses
RMMV
Hi, simple question (I hope^^). It's about the Yanfly Core Engine Plugin. You can use "digit grouping" for numbers to group with a comma.
Because my game is german, I want to change the comma "," to a dot "."
Someone knows where in the code I can find this?
 

BlueBomber000

Villager
Member
Joined
Dec 23, 2018
Messages
26
Reaction score
14
First Language
English
Primarily Uses
RMMV
This ought to be a simple question but I am having a devil of a time trying to figure it out.

All I want to do is a straight up conditional branch that checks if the party leader is Actor 1. That should look like
JavaScript:
 $gameParty.leader().actorId == 1
... right? No plugin, nothing crazy. Literally just a simple conditional statement in an event that shows green text if Actor 1 is the leader, and purple if he's not. BUT, I'm getting purple text all around. I feel like this should be easy but it's driving me up the wall and making me feel really stupid.

EDIT 1: I also thought maybe I was missing some syntax, so I did $gameParty.leader().actorId == '1'. Same result.

EDIT 2: I tried $gameParty._battleMembers(0) == 1 and got a game-crashing error. I want to cry.
 
Last edited:

Zion

Veteran
Veteran
Joined
Mar 12, 2018
Messages
50
Reaction score
13
First Language
German
Primarily Uses
RMMV
All I want to do is a straight up conditional branch that checks if the party leader is Actor 1. That should look like
JavaScript:
 $gameParty.leader().actorId == 1
... right?
I am not familar with JS and I don't know if it makes any difference, but according to the RMMV Script Call List it should be:

JavaScript:
$gameParty.leader().actorId() == ID
 

BlueBomber000

Villager
Member
Joined
Dec 23, 2018
Messages
26
Reaction score
14
First Language
English
Primarily Uses
RMMV
I am not familar with JS and I don't know if it makes any difference, but according to the RMMV Script Call List it should be:

JavaScript:
$gameParty.leader().actorId() == ID
OMG, I feel SO dumb. Thank you so much, Zion! Great googly moogly, I don't know HOW I missed that. What RMMV Script Call List are you referring to, because I didn't catch it in the one I have?

EDIT: Given that you literally just schooled me on something simple, I'm probably the last person you want to take an answer from :confused: (haha), but regarding your question on where in to find the digit grouping code in YEP Core Engine, I saw this near the very bottom of the script:

JavaScript:
//=============================================================================
// New Function
//=============================================================================

Yanfly.Util = Yanfly.Util || {};

Yanfly.Util.toGroup = function(inVal) {
  if (typeof inVal !== 'string') { inVal = String(inVal); }
  if (!eval(Yanfly.Param.DigitGroup)) return inVal;
  return inVal.replace(/(^|[^\w.])(\d{4,})/g, function($0, $1, $2) {
    return $1 + $2.replace(/\d(?=(?:\d\d\d)+(?!\d))/g, "$&,");
  });
};
I would imagine replacing "$&," with "$&." would do what you need, but again, given my history, I'm probably not who you should be listening to :biggrin:
 
Last edited:

Zion

Veteran
Veteran
Joined
Mar 12, 2018
Messages
50
Reaction score
13
First Language
German
Primarily Uses
RMMV
OMG, I feel SO dumb. Thank you so much, Zion! Great googly moogly, I don't know HOW I missed that. What RMMV Script Call List are you referring to, because I didn't catch it in the one I have?
No problem, glad I could help you out :rhappy:
This is the script call list:

click


I would imagine replacing "$&," with "$&." would do what you need, but again, given my history, I'm probably not who you should be listening to :biggrin:
Thank you for your help, I really appreciate that :rhappy:
Unfortunately, this is the same idea I had myself - but it doesn't work.
 

Mordridakon

I am a dragon!
Veteran
Joined
Feb 6, 2019
Messages
90
Reaction score
170
First Language
English
Primarily Uses
RMMV
I don't know where to put this, so I'll put this here. I got several yanfly plugins and put them in my game early last year, but I heard he changed the TOS recently when they went paid. Can I still use them, or do I have to pay to use them now? I plan on buying the plugins if I put them in any future games.
 
Joined
Feb 18, 2015
Messages
446
Reaction score
194
First Language
English
Primarily Uses
RMMV
From Yanfly's post on Pa tre on [since the autofilter seems to think the full word is a url] (which you can see without being a Patron):

Q2. If an individual already owns the plugins before the paywall, can that individual keep them? And how can old users be distinguished from new users?

A2. Any individual that already owns the plugins prior to the paywall are free to keep and use them provided that follow the new ToS regarding redistribution. There is no way to distinguish old users from new users. All I can do is just believe in whatever honor people have left.

And this is the ToS regarding distribution:
Redistribution of the plugins and its code, outside the scope of game projects, is strictly forbidden outside of the host website, Yanfly.moe, and by the following sites/members: itch.io. However, special permission has been granted to these individuals/entities for redistribution of the plugins as long as the plugins remain in their updated form: Archeia, Visustella, Ækashics Librarium, Caz Wolf, Raim, DreamX, Fallen Angel Olivia, Atelier Irina, Aries of Sheratan, Arisu's Dollhouse, Munokura of FunGameMake. This list may be updated in the future.

So yes, you're allowed to keep and use the plugins as long as you got them before they went paid.
 

Almightypebble

Veteran
Veteran
Joined
Jan 13, 2017
Messages
73
Reaction score
3
First Language
Bulgarian
Primarily Uses
RMMV
How would i go about editing some plugins so that they add a close menu command at the end of the command window?
For example I would like to have a close menu command in my skill, item and equip scenes. I'm using yep's plugins and notice that some of the other yep plugin menus have a cancel or return command, like the status menu core plugin, but these main ones don't.
 
Joined
Feb 18, 2015
Messages
446
Reaction score
194
First Language
English
Primarily Uses
RMMV
Is there a way to do a check for "if player has been standing still for x frames"? I know there's $gamePlayer.isMoving() for checking whether they're moving or not, but I'm trying to do a check for if the player has been standing still for, say, 30 frames.
 

Zuque

Villager
Member
Joined
Dec 27, 2018
Messages
13
Reaction score
0
First Language
Bulgarian
Primarily Uses
RMMV
Hello, I am looking for a code that will allow me to gain resources based on the damage I have taken after mitigation.
my knowledge of JS is nonexistence
It is for the MV game engine.
thank you a lot for the time and help.
 
Joined
Jan 5, 2020
Messages
50
Reaction score
11
First Language
english
Primarily Uses
RMMV
Hi all, i think this is the right place to ask ^^: though its only a small question so i dont think it needs its only thread,

want to know if there is a plug in that allows for characters that are in the reserve party to appear when at camp, or in place's like a pub, or Inn? or will i have to install a autorun trigger, to empty the party and switch on any characters that have been entered into the party

(note that im planning to have several characters for the player to choose from as well as pets and pet like characters, and if the player does not have them or has not found them yet, i dont really want 20 odd random characters sitting on top of the other party members.)
 

FirestormNeos

Veteran
Veteran
Joined
Jul 23, 2019
Messages
59
Reaction score
25
First Language
English
Primarily Uses
RMVXA
So I've installed the yanfly freebie plugins for the sole purpose of fixing the game's stupid "only the basic attack skill gets to use the weapon motions" limitation. I fixed the problem, but now whenever my character uses the skill, it plays the powerup2 animation before playing skill motion and animation. How do I get rid of this?
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
188
Reaction score
59
First Language
English
Primarily Uses
RMMV
So I've installed the yanfly freebie plugins for the sole purpose of fixing the game's stupid "only the basic attack skill gets to use the weapon motions" limitation. I fixed the problem, but now whenever my character uses the skill, it plays the powerup2 animation before playing skill motion and animation. How do I get rid of this?
In the battle plugins settings change the animation to be played to 0.
 

DeadlyEssence01

Veteran
Veteran
Joined
Oct 19, 2019
Messages
35
Reaction score
15
First Language
English
Primarily Uses
RMMV
Hello, I am looking for a code that will allow me to gain resources based on the damage I have taken after mitigation.
my knowledge of JS is nonexistence
It is for the MV game engine.
thank you a lot for the time and help.
You may need to expand on the details. do you want it to be the type of damage taken, or the amount of damage taken? Are you using any of yanfly's plugins? I'm pretty sure one of the battle plugins will let you run some code after taking damage, so technically any code that was offered would go there.

Also, I have my own question for the other more coding oriented:

I am using SRD CharacterCreatorEx plugin, I haven't made any changes to the script yet, but I need to add scroll-ability to the command window that displays the folder list.... (categories like "Body" "Faceshape")
Actually super easy to do so if anyone else runs into this problem. The code to implement is this:

Code:
Window_CharacterCreator_FolderList.prototype.windowHeight = function() {
    return this.fittingHeight(16) + 12;
};

I added it right under.


Code:
Window_CharacterCreator_FolderList.prototype = Object.create(Window_Command.prototype);
Window_CharacterCreator_FolderList.prototype.constructor = Window_CharacterCreator_FolderList;

Window_CharacterCreator_FolderList.prototype.initialize = function(mandatories) {
    this._combines = {};
    this._mandatories = mandatories;
    Window_Command.prototype.initialize.call(this);
};
 
Last edited:

UniqueName

Veteran
Veteran
Joined
Nov 12, 2018
Messages
42
Reaction score
5
First Language
Russian
Primarily Uses
Other
Hello people!
I learned how to call number input through sript call ($gameMessage.setNumberInput(var, digits)
and I have it inside of my js file but the code just runs through it and doesnt wait for input
how do I make it so the script would pause at number input and continue after an input?
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
360
Reaction score
184
First Language
English
Primarily Uses
RMMV
The solution to your problem depends on where and how you're using the number input. The engine typically handles the waiting by stopping anything from updating if $gameMessage is busy. Take a look in rpg_objects of rpg_scenes and you'll see this frequently.

Code:
if (!$gameMessage.isBusy()) {
   //code
}
What this is saying is if $gameMessage is not busy we can execute the code, otherwise don't.

As I don't know what you're trying to achieve though, I can't say if this solution works for you. If you're creating a new object in the game that routinely updates, or adding to an existing similar object then it probably does. If you're not then you'll probably need a different solution. Potentially via aliasing the processOk method of Window_NumberInput and having it execute the rest of your code under a specific condition (again, I can't provide any specific insight without more information).
 

Users Who Are Viewing This Thread (Users: 0, Guests: 4)

Latest Threads

Latest Posts

Latest Profile Posts

There a thread out there that tells us the best way to open an RPG that isn't 'the protag gets out of bed'?
Updated my state Stacker Script on itch.io, github is down for some reason (probs just me).
Wife watching Locke and Key. This show is so bad!! You can't just acclimate to discovering magic or magical worlds in less than 60 seconds.
I think I still prefer RPG Maker over Dreams. Been playing around with it, and the controls are really the biggest flaw for me.

Forum statistics

Threads
94,332
Messages
919,999
Members
124,087
Latest member
OrdinaryOne
Top