JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 49 of 171 View original ↗
  1. @jack2396, here's what your regex should probably look like:

    Code:
    var match = notedata.match( /<Help Description>([\s\S]*?)<\/Help Description>/ );
    if( match ) {
        text2 += match[ 1 ] + '\n';
    }
  2. Bex said:
    Thank you very much that Scriptline is working.
    This Helps making it easier building a passage with Flame Balls to avoid.Without worrying to much about all the position Settings.

    I have Win10 when i click the rpg_core.js Folder, i just get an error message and cant open it.
    Is that normal? Do i need a special Program to open it?

    @Bex, you can open that file in any text editor, like Notepad (although Notepad is really not the best for opening up so many lines of code). Double-clicking on it probably causes Windows to try to execute the file instead of opening it for editing. If you right-click on it, you should see an option to edit it.
  3. @scanime Thank you very much i will do that.
  4. Edit: Deleted, because of Human Error....
  5. scanime said:
    @jack2396, here's what your regex should probably look like:

    Code:
    var match = notedata.match( /<Help Description>([\s\S]*?)<\/Help Description>/ );
    if( match ) {
        text2 += match[ 1 ] + '\n';
    }

    Thank you!
    I'll study this code right away.
  6. Hi everyone,
    I'm in need of some advanced objects for my project, and my question is :
    Is it ok to put an object (or array of objects) in a game variable ?
    like this :
    Code:
    $gameVariables.setValue(51,
    [new TW_trade_counter("xx"),
    new TW_trade_counter("yy"),
    new TW_trade_counter("zz"),
    new TW_trade_counter("ww")]);
    I know it works from my tests, but could it potentially be game breaking at some point ?
  7. Hey, all. BRAND new to programming and RMMV. I know some people recommend starting with fewer plugins, and some recommend starting to learn with all the tools you plan to work with in the future... I'm trying to load 50+ Yanfly plugins, but there are only so many plugins that I can load in the plugin manager. Is there a way around this or will I have to be more selective in the plugins I use? Thanks for the help. Trying to get started on learning my way around MV today :)
  8. @MakerNoob A few ways to approach that I think.
    If you would like to create, finish, and share a game, then the recommendation is to limit the amount of plugins you include. It's hard enough to learn the RPG Maker engine itself, and then you'll have to learn the Yanfly engine on top of that. The more plugins you include, the more time it will take to finish the game (generally) because you'll keep thinking about 'cool features' instead of actually making the game.

    If you would just like to learn and have fun (essentially 'messing around' with the engine), then feel free and go wild. There is no limit to how many plugins you can install.
    Be careful, if you install a lot of plugins from different sources you can run into compatibility issues. And for Yanfly plugins, make sure they are in the exact order as on their website otherwise you'll get errors.

    @TWings There's no danger in doing that. The only things I can think of is it will look strange in the F9 debug window, and if you use a normal Event Command to "add 1", for example, it would soft-error and set the value to zero. But you wouldn't be "adding 1" anyways if it's an object or array.
  9. MakerNoob said:
    Hey, all. BRAND new to programming and RMMV. I know some people recommend starting with fewer plugins, and some recommend starting to learn with all the tools you plan to work with in the future... I'm trying to load 50+ Yanfly plugins, but there are only so many plugins that I can load in the plugin manager. Is there a way around this or will I have to be more selective in the plugins I use? Thanks for the help. Trying to get started on learning my way around MV today :)
    If you're new to prgramming and RM, It would probably be easier to learn slowly starting with the basics. Plugins tend to add some complexity to the process as you also need to learn how each plugin works.
    In any case, rather than loading 50+ Yanfly plugins, try to take a step back and think about what you want to do with your project.
    Do you really need all those 50+ plugins ? In my opinion, you should build your project and take plugins as you need them, not the other way around.
    I, myself use dozens of plugins in my current project, but I always select them carefully and test them to check if they do what I want.

    Aloe Guvner said:
    @TWings There's no danger in doing that. The only things I can think of is it will look strange in the F9 debug window, and if you use a normal Event Command to "add 1", for example, it would soft-error and set the value to zero. But you wouldn't be "adding 1" anyways if it's an object or array.
    Thanks for the answer. I guess I'm good to go then.
    The F9 window just display "[object]" and so on, in small characters, but obviously I use the F8 console to debug those objects, so it's not a big issue.
  10. Hello.

    I'm using Galv Event Spawner, a script call allows to spawn an event from a variable, to the position X and Y:
    Code:
    Galv.SPAWN.event($gameVariables.value(3981),19,7);
    This line works

    I tried to use this script call with variables even for the X and Y:
    Code:
    Galv.SPAWN.event($gameVariables.value(3981),($gameVariables.value(3978),($gameVariables.value(3979));
    This does not work

    Any idea what I'm doing wrong?
  11. Too many "("
    Narch said:
    Code:
    Galv.SPAWN.event($gameVariables.value(3981),$gameVariables.value(3978),$gameVariables.value(3979));
  12. Hi everyone, my question is this: I want to create a common event that gradually recovers the hp and mp of an actor, I have a little knowledge about javascript so I create an event in the first screen of my game that call a common event that recovers the hp an mp gradualy, but it doesn't run, what can I do.
  13. EDIT: Never mind.
  14. I'm trying to create an aoe ability that does x damage divided by the number of enemies on screen. Can I do this in the damage formula box? What's the code for finding the number of enemies?

    Thanks for the help.
  15. @SirRule
    In the damage formula box, "$gameTroop.aliveMembers()" will give how many alive enemies there are. So, an example damage formula could be:
    Code:
    300 / $gameTroop.aliveMembers().length;
    Note that this would only work for party members, not monsters.

    A more generalized version which would work for either party members or monsters would be:
    Code:
    300 / a.opponentsUnit().aliveMembers().length;
    This one counts how many alive members in the opponents unit (the opponent of the party is the troop, the opponent of the troop is the party).
  16. Thanks for the quick response. Testing your code, I can't make it work. It wont even work if I directly copy your code into the damage formula box.
    This is my code:
    Code:
    c=a.getStateCounter(4); a.gainTp(-100);c=c/$gameTroop.aliveMembers();c;
    The code should take the number of stacks of poison the character has then divide it by the number of enemies. It also removes all TP but that's not the problem. I've tried both gameTroop and opponentsUnit and both turn up 0 when I attack. Am I supposed to be putting something inside the brackets? after aliveMembers?
  17. My mistake, it needs to use the "length" property as well.

    Code:
    300 / $gameTroop.aliveMembers().length;
    //
    300 / a.opponentsUnit().aliveMembers().length;
    I've also edited the post above for future reference.
  18. 300 / $gameTroop.aliveMembers().length;

    Cheers mate, that works like a charm.