RPG Maker MV Script Call List

Discussion in 'RPG Maker MV' started by Archeia, Oct 24, 2015.

  1. metronome

    metronome Veteran Veteran

    Messages:
    347
    Likes Received:
    141
    First Language:
    English (Sure!)
    Ah....I think these codes are wrong:

    $gameParty.numItems($dataItems[n])$gameParty.numItems($dataWeapons[n])$gameParty.numItems($dataArmors[n])// or$gameParty._items[n]$gameParty._weapons[n]$gameParty._armors[n]I tried script calling:

    $gameVariables.setValue(100, $gameParty._items[1]) or $gameVariables.setValue(100, $gameParty.numItems($dataItems[1]))where item 01 is 10 in my party possession

    when I call the \V[100] it returns 0 instead of 0......
     
    Last edited by a moderator: Nov 6, 2015
  2. NoInkling

    NoInkling Veteran Veteran

    Messages:
    39
    Likes Received:
    9
    First Language:
    English
    It's giving you 0 because it's outside your max variable number (20 by default). Increase it and it should work.

    I retested everything I posted and didn't get errors. Sometimes copy/pasting can introduce an "unexpected token" error, I don't know why, be careful that you're not selecting anything extra (other people have been having this issue with other scripts). It may just be to do with the way the forums format things.

    Yeah, you can't pass that function to .numItems, it's only for use with .filter.

    $gameParty._items is available, but it's an object, not an array, so filter/reduce aren't directly usable. I'd probably do this:

    $gameVariables.setValue(101, Object.keys($gameParty._items).filter(function(itemId){return itemId>=1 && itemId<=100}).reduce(function(sum,itemId){return sum+$gameParty._items[itemId]},0))I gotta warn you that at this point you're beyond specific engine stuff and well into general JavaScript, which I think is outside the purpose of this topic. Your questions would probably be better posted in one of the JS subforums.
     
    Last edited by a moderator: Nov 6, 2015
    metronome likes this.
  3. metronome

    metronome Veteran Veteran

    Messages:
    347
    Likes Received:
    141
    First Language:
    English (Sure!)
    Hi,

    after checking, I found out what the problem is.

    the codes are not wrong.

    I had yanfly item core plugin installed. And then after I turn the plugin off, it works.

    I think there is something in his plugin that always returns 0 for every item possession check.

    I have reported the problem to him.

    agreed. I think by now, my question has turned into something closer to Javascript than to RMMV itself lol

    I really missed the days where you could easily do SUM function script call easily back in RPGVXA....

    and btw you are right about the token error.

    checked it by typing them directly without copy paste and it works too

    You are awesome!~~

    Thanks a lot

    I feel bad annoying you >.<~~
     
    Last edited by a moderator: Nov 6, 2015
  4. krizmn

    krizmn Occultist Veteran

    Messages:
    114
    Likes Received:
    8
    Location:
    Maine, USA
    First Language:
    english
    ($gameVariables.value(16) != 43 && $gameVariables.value(17) != 33)

    Ok, so I am using these two variables to check the players coordinates.  As long as they are not standing on that tile.  For some reason it is reading the &&

    like it is an or symbol.  Am I missing something?
     
  5. NoInkling

    NoInkling Veteran Veteran

    Messages:
    39
    Likes Received:
    9
    First Language:
    English
    Let's call V[16] "x" and V[17] "y".

    If x = 40 and y = 30, the statement evaluates to true, so far so good.

    However if x = 43 and y = 30, the JS is gonna come along and evaluate the first part as 43 != 43 which is obviously false. After that, "false && anything" will always be false, because && specifies that both expressions have to be true for the whole condition to be true.

    To put it simply, you actually want an OR (||) in there when the conditions are exclusionary (!==). It's kind of the opposite to when you're doing inclusionary/positive conditions (===), in which you'd use AND. So yeah, it isn't very intuitive sometimes, but it can make sense if you work through the logic.
     
    Archeia likes this.
  6. krizmn

    krizmn Occultist Veteran

    Messages:
    114
    Likes Received:
    8
    Location:
    Maine, USA
    First Language:
    english
    Ok wait.  Is it != or !== or either?  You don't have to answer, I can just google it.  I am just being lazy and not spending time going through a quick day of brushing up on learning JS.  
     
  7. KisaiTenshi

    KisaiTenshi Veteran Veteran

    Messages:
    310
    Likes Received:
    121
    != means "Not Equal"

    !== means "Not Equal value or Not Equal type"

    That means it must be the same "type" , it's mostly useful in cases where you might be checking if something is an Object, String, or null itself. When comparing two objects of the same type, both do the same thing. 

    === itself is described here.
     
    Last edited by a moderator: Nov 7, 2015
  8. metronome

    metronome Veteran Veteran

    Messages:
    347
    Likes Received:
    141
    First Language:
    English (Sure!)
    Have another question:

    Is there any script call in RMMV that's similar to this?

    SceneManager.call(Scene_Item)useful to call item menu when you want to show player what they have now in his/her inventory without going all the way from menu screen >.<~~

    is it:

    SceneManager.push(Scene_Item)
    not in front of my working computer right now sadly
     
    Last edited by a moderator: Nov 8, 2015
  9. NoInkling

    NoInkling Veteran Veteran

    Messages:
    39
    Likes Received:
    9
    First Language:
    English
    To add to what KisaiTenshi said, it's recommended you always use the === and !== versions in order to prevent unexpected behavior due to dumb JS quirks around type coercion. Basically any reliable source will recommend this as a best practice. That's not to say that the == and != versions don't have legitimate uses in some contexts, but those are a very very small minority and until you know where they would be useful it's best to avoid them.

    http://stackoverflow.com/a/359509/2277117
     
  10. KisaiTenshi

    KisaiTenshi Veteran Veteran

    Messages:
    310
    Likes Received:
    121
    Technically... all you need to do is invoke SceneManager.push(Scene_Item); because that's what rpg_scenes.js does.
     
  11. skyshadow235

    skyshadow235 Villager Member

    Messages:
    21
    Likes Received:
    1
    First Language:
    English
    Oh ... thank you o.o I guess the script list isn't complete then because I copied it off the RMMV Script Calls as best as I could. Thank you and I'll just use the regular message boxes then since I'm still not good at making my own or understanding the different languages yet ^-^
     
  12. Ratty524

    Ratty524 Veteran Veteran

    Messages:
    607
    Likes Received:
    144
    First Language:
    English
    Bookmarked this. This is awesome!
     
  13. bkblplus

    bkblplus Warper Member

    Messages:
    3
    Likes Received:
    1
    First Language:
    Español
    Good I come to see if I can lend a hand with a question "grademente small" ...

    What is the call script to close the game in rpg maker MV?

    I am creating my own title and just do not give this code as do I need ...

    I've gotten the "SceneManager.exit" but this is not working.

    Help me plz: 3
     
  14. krizmn

    krizmn Occultist Veteran

    Messages:
    114
    Likes Received:
    8
    Location:
    Maine, USA
    First Language:
    english
    $gameSelfSwitches.setValue($gameVariables.value(7), 13, "A", true)

    Am I missing something?  I am trying to set another event's self switch.  

    Edit:  Just for additional information, variable 7 is the Map Id.  13 is the event.
     
    Last edited by a moderator: Nov 13, 2015
  15. Shaz

    Shaz Veteran Veteran

    Messages:
    37,710
    Likes Received:
    11,419
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    This is how a self switch is set by the Game_Interpreter (good to look at if you want to see how the engine does things by default):

    Code:
    Game_Interpreter.prototype.command123 = function() {    if (this._eventId > 0) {        var key = [this._mapId, this._eventId, this._params[0]];        $gameSelfSwitches.setValue(key, this._params[1] === 0);    }    return true;};
     
  16. krizmn

    krizmn Occultist Veteran

    Messages:
    114
    Likes Received:
    8
    Location:
    Maine, USA
    First Language:
    english
    Yeah I found that before.  I am not getting any errors, but I can't seem to switch an event's self switch on or off.....

    I must be missing something.  I'll keep trying.

    Edit:

    var key = [$gameVariables.value(7), 13, 'A'];

    $gameSelfSwitches.setValue(key, 1);

    Ok that works.  Thanks for making me look at that script more.  I thought I could just replace "key" with the variables all on one line.  I didn't think I needed to set it up like this.  Still getting used to JS.
     
    Last edited by a moderator: Nov 13, 2015
  17. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,581
    Likes Received:
    14,277
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    I updated the script call list with Call event :)
     
    Richard Dragon likes this.
  18. Richard Dragon

    Richard Dragon Blavkm Member

    Messages:
    21
    Likes Received:
    3
    Location:
    A place on my mind
    First Language:
    SPANISH
    Primarily Uses:
    RMMV
    Thanks Archeia :)
     
  19. krizmn

    krizmn Occultist Veteran

    Messages:
    114
    Likes Received:
    8
    Location:
    Maine, USA
    First Language:
    english
    I'm trying to do a self switch in the movement aspect of an event.  The only time I need to do this is when I need the self triggers to wait a few seconds.  If I place it after the movement section it triggers to quick.  If I set a wait command in between the set of movement and the trigger, it causes my the character to wait  unless I set it as a parallel.  

    So anyways, does anyone know off hand how to self switch through script?  I could make an extra switch and do that, but I am trying to cut down on as many extra switches as possible to keep it organized and clean.  
     
  20. Zitrone

    Zitrone Villager Member

    Messages:
    7
    Likes Received:
    3
    First Language:
    german
    Hey guys,

    how do i use the

    AudioManager.playSe();I have     AudioManager.playSe('Fire2', 100,100, 0  )    but nothing happens :/

    Sound Object: { name: filename, volume: n, pitch: n, pan: n }

    pls help, I'm lost when my menu doesn't make sounds.
     

Share This Page