๐ŸŽข Episode 4 ยท Improver ยท Data

Read the Park
Episode 4: Money, Guests and Rides

Now your plugin can read the park itself. You will look at cash, park rating, how many guests are inside, and the rides they are queuing for.

๐Ÿ‘ถ Ages 10+ โฑ๏ธ ~50 mins ๐ŸŽข OpenRCT2 โœ“ Free workshop
๐Ÿ’ฐ Park cash โญ Park rating ๐Ÿง Guest count ๐ŸŽก Ride stats
โญ
0 XP
Level 1
๐Ÿ”ฅ0
Your Progress 0 / 5 steps
Build it in our OpenRCT2 Studio too: set up a park plugin, wire up events, read the park and export real plugin files in the browser, with no install. Open the OpenRCT2 Mod Studio →
๐Ÿ”ฅ
Ember says: reading data is what turns a toy into a tool. Once your plugin knows the numbers, it can give advice, or act on its own.
1
๐Ÿ’ฐ
Read the Cash
How much money is in the park
Active
๐ŸŽฏ
Goal for this step

Print the park cash to the console.

  • 1The park object holds the money as park.cash.
  • 2Money is stored in the smallest unit, so you divide to show pounds or dollars.
  • 3Print it with console.log so you can see it.
context.subscribe("interval.day", function () {
  console.log("Cash now: " + Math.round(park.cash / 10) / 100);
});
โœ๏ธ
Fill in the Blanks
+15 XP
The park cash is found at park..
๐Ÿง 
Knowledge Check
+15 XP
Where does your plugin read the park money?
Apark.cash
Bpark.money
Ccash.park
2
โญ
Read the Rating
How happy the park is
Locked
๐ŸŽฏ
Goal for this step

Show the park rating each day.

  • 1The rating is a number out of 1000 in the park object.
  • 2It rises when guests are happy and falls when they are not.
  • 3Print it alongside the cash for a little dashboard.
โœ๏ธ
Fill in the Blanks
+15 XP
The park rating is a number out of .
๐Ÿง 
Knowledge Check
+15 XP
A park rating of 1000 means what?
ABankrupt
BThe best possible happiness
CClosed
3
๐Ÿง
Count the Guests
Everyone in the park
Locked
๐ŸŽฏ
Goal for this step

Count the guests using the map API.

  • 1map.getAllEntities("guest") returns every guest.
  • 2Its length is the guest count.
  • 3You can loop over them to look at each one.
var guests = map.getAllEntities("guest");
console.log("Guests in park: " + guests.length);
โœ๏ธ
Fill in the Blanks
+15 XP
To get every guest, call map.getAllEntities("").
๐Ÿง 
Knowledge Check
+15 XP
What does map.getAllEntities("guest") give you?
AA single guest
BA list of all guests
CThe park owner
4
๐ŸŽก
Look at the Rides
What people are queuing for
Locked
๐ŸŽฏ
Goal for this step

Spot the busiest ride.

  • 1map.getAllEntities("ride") returns every ride.
  • 2Each ride has a name and a queue length.
  • 3Find the longest queue and post a helpful message about it.
โœ๏ธ
Fill in the Blanks
+15 XP
A long ride is a sign the ride is popular.
๐Ÿง 
Knowledge Check
+15 XP
Why might a plugin watch queue lengths?
ATo close busy rides
BTo spot what guests love and tell the player
CTo delete the ride
5
๐Ÿงช
Build a Tiny Dashboard
Put the numbers together
Locked
๐ŸŽฏ
Goal for this step

Post one message with cash, rating and guest count.

  • 1Combine the three readings into one string.
  • 2Post it once per day.
  • 3Run a park and watch your dashboard update.
โœ๏ธ
Fill in the Blanks
+15 XP
A dashboard combines several into one message.
๐Ÿง 
Knowledge Check
+15 XP
What makes a good dashboard message?
AShort, clear numbers the player cares about
BOne very long paragraph
CNo numbers at all
๐ŸŽ‰โœจ๐Ÿ†๐ŸŽ‰
Your Plugin Can See!
You can read cash, rating, guests and rides. Next you will act on guests directly.
0
Total XP
1
Level
0
Best Streak
0%
Accuracy
Next: Episode 5: Working with Guests โ†’