How do I make a script that checks key items?

So basically, I'm new to JavaScript. I made myself a little box that when you press ESC, it goes to the menu like normally, and that blank space between the menu selection and the gold view is my box. I want to have phrases change that basically helps the character progress, but I think to do that, I want to do a script that checks if i have a certain key item. and if i do then the phrase will change to give them a hint on where to go.

I'm not sure how to check in-game items. I tried using

$gameParty.hasItem($dataItems[this._params[5]]);

But i think where the 5 is requires me to insert the item ID? But I dont know how to get the item ID. Can anyone help with this?
Moved to: Javascript/Plugin Support
Why so complicated?
Code:
// a much easier alternative
if (!$gameParty._progress) $gameParty._helpSentence = "Pick up these mushrooms.";
else if ($gameParty._progress == 1) $gameParty._helpSentence = "Eat the mushrooms.";
else if ($gameParty._progress == 2) $gameParty._helpSentence = "Call the ambulance";
else $gameParty._helpSentence = "Now pray you'll make it in time."

//and simply when the player achieves certain feat, you'll have this in your script field inside an event.
if ($gameParty._progress < 1) $gameParty._progress = 1;

And that's it.

Apart from Javascript I'd learn the basics of an object oriented language too btw. It will make more sense.
Solid advice. But while learning it, I want to add new features. I actually have to. So I dont always know which path I'm going is right or not. I might be able to do something with that. Thank you

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-a-script-that-checks-key-items.93035/