I'm attempting to create a Legend of Zelda-type ocarina functionality with a guitar instead of an ocarina. So I have a common event bound to the G key which will activate the guitar, and then I want to event it so it'll play corresponding notes when the player presses certain letter keys, for example, if they press Enter while holding down the "F" key, it'll play a certain note. But the built in functionality only allows for the default keys of Z, X, Enter, Shift, Esc.... etc. Do I need a script to check if the F key is being pressed?
Button _____ is pressed down for nonstandard buttons
Javascript/Plugin SupportYes, you need a script (or plugin) to detect the keys, and you'll have to do some sort of plugin/script call to see if it's being pressed, rather than use the "If Key ? is pressed" option in the conditional branch.
I have a feeling someone has already written a plugin to allow all keyboard keys. Just do a search - www.mvplugins.com is the 'master script list' of the MV Plugins world - if you can't find something in the Plugin Releases forum, head there (or maybe even head there first).
I have a feeling someone has already written a plugin to allow all keyboard keys. Just do a search - www.mvplugins.com is the 'master script list' of the MV Plugins world - if you can't find something in the Plugin Releases forum, head there (or maybe even head there first).
So then my question is, how would I code that? I'd need an if/else statement, and a script call to check if a button is being pressed.
I've just never coded in javascript before, so I don't really know where to start. I already have ZE's key mapper plugin - http://mvplugins.com/plugin/Zalerinian/ZE%20-%20Key%20Mapper.
there should be documentation in the plugin that explains how to call it. If it was just a pastebin thing I would look at it for you, but I'm not going to download a whole project just to find out. Look at the plugin documentation.
I'm attempting to create a Legend of Zelda-type ocarina functionality with a guitar instead of an ocarina. So I have a common event bound to the G key which will activate the guitar, and then I want to event it so it'll play corresponding notes when the player presses certain letter keys, for example, if they press Enter while holding down the "F" key, it'll play a certain note. But the built in functionality only allows for the default keys of Z, X, Enter, Shift, Esc.... etc. Do I need a script to check if the F key is being pressed?
So then my question is, how would I code that? I'd need an if/else statement, and a script call to check if a button is being pressed.I've just never coded in javascript before, so I don't really know where to start. I already have ZE's key mapper plugin - http://mvplugins.com/plugin/Zalerinian/ZE%20-%20Key%20Mapper.
So then my question is, how would I code that? I'd need an if/else statement, and a script call to check if a button is being pressed.I've just never coded in javascript before, so I don't really know where to start. I already have ZE's key mapper plugin - http://mvplugins.com/plugin/Zalerinian/ZE%20-%20Key%20Mapper.
You would just need to use the JS equivalent of the event command, I'm pretty sure there is a thread here with a list of the script equivalent of all those event commands... Using that, you could then check for the key press (this triggers every frame as long as that key is pressed), trigger (triggers just once per press) etc of the keys assuming you have a full keyboard script.
Back on Ace it was Input.trigger(KEY)? and Input.press(KEY)?, it won't be much different in MV.
Back on Ace it was Input.trigger(KEY)? and Input.press(KEY)?, it won't be much different in MV.
Thank you. I'm searching for that thread but not having any luck.
Edit: Still can't find it, but that sounds like the most incredibly useful thread ever. If anyone has the link, I'd super appreciate if you could share it.
Edit: Still can't find it, but that sounds like the most incredibly useful thread ever. If anyone has the link, I'd super appreciate if you could share it.
Here: https://docs.google.com/spreadsheets/d/1-Oa0cRGpjC8L5JO8vdMwOaYMKO75dtfKDOetnvh7OHs/edit#gid=0
It was on the MV Specific help sub forum instead of the JS boards. 🙂
It was on the MV Specific help sub forum instead of the JS boards. 🙂
Thanks so much! So this is what my code looks like right now.
var NoteA = { name: "00GUITAR-A", volume: 90, pitch: 100, pan: 100};
var NoteB = { name: "00GUITAR-B", volume: 90, pitch: 100, pan: 100};
if(Input.keyTriggered("K")){
if(Input.keyPressed("A")){
AudioManager.stopSe();
AudioManager.playSe(Note😎;}
else{
AudioManager.stopSe();
AudioManager.playSe(NoteA);
}
}
Which totally works! But the script editor is so small, it just overwrites it if I write any more code??? How do I get around this limitation? I want to have 12 note keys total. Do I have to make a plugin in order to have a longer script than this?
var NoteA = { name: "00GUITAR-A", volume: 90, pitch: 100, pan: 100};
var NoteB = { name: "00GUITAR-B", volume: 90, pitch: 100, pan: 100};
if(Input.keyTriggered("K")){
if(Input.keyPressed("A")){
AudioManager.stopSe();
AudioManager.playSe(Note😎;}
else{
AudioManager.stopSe();
AudioManager.playSe(NoteA);
}
}
Which totally works! But the script editor is so small, it just overwrites it if I write any more code??? How do I get around this limitation? I want to have 12 note keys total. Do I have to make a plugin in order to have a longer script than this?
Just make a JS file plugin and put every snippet that you make in there. 🙂
Original thread: https://forums.rpgmakerweb.com/threads/button-_____-is-pressed-down-for-nonstandard-buttons.63766/