help with script

I'm doing a password related switch.

I don't know java script, so far I got this:

if ($gameActors.actor(11).name() == "G")

{

$gameSwitches.setValue(111, true);

}

I want that when the player puts the right letter a switch turn on and we lose one item. In case he uses the wrong password I also want a message saying to try again or something like that.

Could you help me to complete this script ?
Is there a reason you need it to be done in js?

This can be done pretty easily just using editor functions:
upload_2018-6-21_13-45-46.png
@Rubescen

I saw the password thing on youtube and there they used js. I didn't saw that the conditional branches had that option. I always forget to check the tabs. Thanks @Rubescen

Original thread: https://forums.rpgmakerweb.com/threads/help-with-script.96729/