Setting variable based on how many events are on a few of the in-game maps.

Yeah, I hear that. I sort of resent myself in some ways because I've gotten started with learning but every time I give up on it and then end up here asking for help when if I would've just seen it through, I would've likely been able to figure it out on my own...ha. Do you know of any good resources to learn Javascript?



So let's say I want to track the furniture item values in maps 25, 26, 27, and 28 only and keep a running calculation in variable 100 of the total score across those maps, would that be possible in that code you pasted?
Yeah, I hear that. I sort of resent myself in some ways because I've gotten started with learning but every time I give up on it and then end up here asking for help when if I would've just seen it through, I would've likely been able to figure it out on my own...ha. Do you know of any good resources to learn Javascript?



So let's say I want to track the furniture item values in maps 25, 26, 27, and 28 only and keep a running calculation in variable 100 of the total score across those maps, would that be possible in that code you pasted?
You could get that by adding the values for those maps together.

The "long" way would be

JavaScript:
const obj = $gameVariables.value(100);
const total = obj[25] + obj[26] + obj[27] + obj[28];

Then you could store that in a variable or use it for whatever. But you can also do it via a loop.

One thing to note is that my code doesn't check map ID, so it'll track furniture for any map furniture can be placed. If you want to limit the object values to only those maps, you'd have to build a map ID check in to the logic.
Yeah that's where I'm getting hung up as I want to it keep track of it on certain maps (just the player's home and yard) but not whatever furniture items they place around the town as that wouldn't play into their "home value" score that I would like to track. Ultimately, my goal is to have the player be able to check their home value from a menu command eventually, but I would need to be able to store that value in a variable based on the furniture score of multiple maps, but only those maps.

I'm sure you told me exactly how to do that, but I'm trying to wrap my head around it like wrapping my head around a foreign language XD.
Sidenote: It really fascinates me how you all can just bang this stuff out like it's easy or look at a few lines of code and identify what needs adjusting! Makes me really want to learn it myself, but I always get overwhelmed looking at it and not knowing where to even start to learn it.
Trihan's a better coder than me. I worked in software but on the business side dealing with clients, writing requirements and checking the devs' work.

I knew basic programming but my skills got way better after picking up RPG Maker and being forced to solve coding problems in my project daily.

Honestly W3 Schools is fine. Even if you just learn some things, like what a loop is, or an array, or how to loop through an array, that unlocks a lot of things you can do in RPG Maker.

check their home value from a menu command eventually, but I would need to be able to store that value in a variable based on the furniture score of multiple maps, but only those maps.
$gameVariables.value(100)[home map number] will give you the points for the home map

I put that script in a common event to run parallel with the GameStart switch that turns on when loading the game with a Wait 10 at the end
This shouldn't be in a parallel event. It'll "work" but you're running it way more often than you need to since the values will only ever change when a furniture is added or removed. You should only run it after you run a furniture add or remove command, and only on the maps you want to count the number of furniture items or points
For learning basic Javascript I'd also recommend www.codecademy.com

Original thread: https://forums.rpgmakerweb.com/threads/setting-variable-based-on-how-many-events-are-on-a-few-of-the-in-game-maps.165492/