Use Item in a Certain Spot Scripting Help!

I want the player to use certain items in certain spots, so I used this script

$gamePlayer.x === 8 && $gamePlayer.y === 18 && $gamePlayer.direction() === 2 && $gameMap.mapId() === Cabin

But its not working,

Here is how I set everything up below
SecertSanta4 - RPG Maker MV 12_5_2023 4_11_54 PM.png

SecertSanta4 - RPG Maker MV 12_5_2023 4_12_31 PM.png


And incase I also need to add this: The red is where the Player can only use the item
SecertSanta4 - RPG Maker MV 12_5_2023 4_12_16 PM.png

Any help will do~! thank ya kindly!
An ID is not a word. And Cabin without any quotation marks isn't even a word, it would be looking for a JavaScript variable in your code with that name.

I don't see it shown anyplace in your screenshots, but if you only have the two maps and Cabin is the second one, it's probably ID 2. It would say it in the Map properties as well as on the bottom of the editor window.

You can also reduce any need for you to have coding knowledge by simply using the included event commands. Getting the player coordinates and map ID are all right in Control Variables.
An ID is not a word. And Cabin without any quotation marks isn't even a word, it would be looking for a JavaScript variable in your code with that name.

I don't see it shown anyplace in your screenshots, but if you only have the two maps and Cabin is the second one, it's probably ID 2. It would say it in the Map properties as well as on the bottom of the editor window.

You can also reduce any need for you to have coding knowledge by simply using the included event commands. Getting the player coordinates and map ID are all right in Control Variables.
See, I had the originally number in that spot, but it still didn't work. Switched it back and still wont work.

I'm also not sure how Control Variables will work,
SecertSanta4 - RPG Maker MV 12_5_2023 6_55_41 PM.png
It would help if you showed what you have that didn't work. Otherwise we can only guess.

Like, you still haven't said what the ID is of the map.

Just out of curiosity, wouldn't it be way easier to say instead of using the item, you interact with the map? Place an event on the space you expect the player to fix, and then you need to do zero of these complex checks - just check whether they have the item to fix with.
It would help if you showed what you have that didn't work. Otherwise we can only guess.

Like, you still haven't said what the ID is of the map.

Just out of curiosity, wouldn't it be way easier to say instead of using the item, you interact with the map? Place an event on the space you expect the player to fix, and then you need to do zero of these complex checks - just check whether they have the item to fix with.
Well, the number was like you said. It was two, that wasn't very hard to figurer out on my end before I came onto the forum, but for some reason the script still wouldn't work.

And yeah, I do that method a lot, but I wanted to give my players a more interactive thing to do in the game. I got that idea to work with Switches and Conmen Commands anyhow, and it worked pretty good! So saving that in my pocket for later games. But using it in this one is slightly annoying with how many times you have to open you inventory.

Thanks for your help
But using it in this one is slightly annoying with how many times you have to open you inventory.
Huh?
Am I misunderstanding what Turan said, or are you? :LZSlol:

I think what he means is that you just place an event at the spot you want the player to fix, make it player activated, when the player activates it, use a conditional to check if they have the item or not. You don't need to open the inventory at all. You're just using a simple conditional that's built into the editor; no programming knowledge needed!

Am I understanding what you are trying to do correctly?
Am I misunderstanding what Turan said, or are you?
I...think he's agreeing with me. And saying that he changed it to be a map event because of how many times the player has to open their inventory to do stuff.

But I could be wrong 😀

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/use-item-in-a-certain-spot-scripting-help.163614/