๐ŸŽข Episode 3 ยท Beginner ยท Events

Talk to the Park
Episode 3: Events and Messages

Plugins come alive when they react to the park. You will learn the events OpenRCT2 offers and make your plugin send different messages at different times.

๐Ÿ‘ถ Ages 10+ โฑ๏ธ ~45 mins ๐ŸŽข OpenRCT2 โœ“ Free workshop
๐Ÿ”” Event types โฑ๏ธ Time events ๐Ÿ’ฌ Messages ๐Ÿงช Test the timing
โญ
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: events are the door between your code and the living park. Pick the right event and your plugin feels like it has been part of the game all along.
1
๐Ÿ””
Meet the Events
The park broadcasts, you listen
Active
๐ŸŽฏ
Goal for this step

Know three useful events and when they fire.

  • 1interval.tick fires many times a second. Good for smooth checks, easy to overload.
  • 2interval.day fires once per in-game day. Good for slow, gentle logic.
  • 3ride.ratings.calculate fires when the game rates a ride. Good for reacting to builds.
๐Ÿง 
Knowledge Check
+15 XP
Which event fires once per in-game day?
Ainterval.tick
Binterval.day
Cride.ratings.calculate
2
โฑ๏ธ
Pick the Right Speed
Do not run too often
Locked
๐ŸŽฏ
Goal for this step

Choose events that match how often your code needs to run.

  • 1Anything on interval.tick runs constantly. Keep it tiny.
  • 2Anything on interval.day runs rarely. It can do a bit more.
  • 3Rule of thumb: use the slowest event that still does the job.
โœ๏ธ
Fill in the Blanks
+15 XP
For a job that only needs to run once a day, use interval..
๐Ÿง 
Knowledge Check
+15 XP
Why avoid putting heavy code on interval.tick?
AIt runs so often it can slow the game down
BIt only runs once
CIt deletes your save
3
๐Ÿ’ฌ
Different Messages
Make the park talk
Locked
๐ŸŽฏ
Goal for this step

Send a different message each time the event fires.

  • 1Keep a counter in your plugin that grows each time the event runs.
  • 2Pick a message based on the counter.
  • 3Use park.postMessage to show it.
var days = 0;
function main() {
  context.subscribe("interval.day", function () {
    days++;
    park.postMessage("Day " + days + " in the park!");
  });
}
registerPlugin({ name: "Day Counter", version: "1.0", authors: ["You"], type: "local", main: main });
โœ๏ธ
Fill in the Blanks
+15 XP
We store the day count in a so it can grow each time.
๐Ÿง 
Knowledge Check
+15 XP
How does the plugin remember the day count between events?
AIt keeps it in a variable
BIt guesses
CIt asks the player
4
๐Ÿงช
Test the Timing
Watch it happen
Locked
๐ŸŽฏ
Goal for this step

Confirm your message appears once per day.

  • 1Load a park and let a few days pass.
  • 2Watch the console and the in-game messages.
  • 3If it fires too often, you are on the wrong event.
๐Ÿง 
Knowledge Check
+15 XP
Your message appears many times a second. What is wrong?
AYou used interval.tick instead of a slower event
BYour message is too long
CThe park is broken
5
๐ŸŽจ
Design a Little Life
Give the park personality
Locked
๐ŸŽฏ
Goal for this step

Invent three messages the park might say at different moments.

  • 1A cheerful morning message.
  • 2A busy-weekend message.
  • 3A gentle reminder to tidy the paths.
โœ๏ธ
Fill in the Blanks
+15 XP
Messages are written for , so keep them short and friendly.
๐Ÿง 
Knowledge Check
+15 XP
Who is the message really for?
AThe player
BThe compiler
CThe developer toolbar
๐ŸŽ‰โœจ๐Ÿ†๐ŸŽ‰
The Park Has a Voice!
Your plugin reacts to the park on a timer. Next you will read the real park data: money, guests and rides.
0
Total XP
1
Level
0
Best Streak
0%
Accuracy
Next: Episode 4: Money, Guests and Rides โ†’