Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| street [2026/11/12 19:16] – [Sample Scripts] Copied the example code from street.js Bobble | street [2026/11/20 05:33] (current) – [Sample Scripts] format sample script Bobble | ||
|---|---|---|---|
| Line 66: | Line 66: | ||
| ==== Events ==== | ==== Events ==== | ||
| - | The street will send events when things happen, you can use the '' | + | The street will send events when things happen, you can use the '' |
| | **Event** | **Fires when** | **Callback receives** | | | **Event** | **Fires when** | **Callback receives** | | ||
| Line 91: | Line 91: | ||
| < | < | ||
| # Alert HELLO when a player is within the range of the door. | # Alert HELLO when a player is within the range of the door. | ||
| - | Street.on( " | + | Street.on( " |
| - | { | + | if( Street.isPlayerNear( " |
| - | if( Street.isPlayerNear( " | + | |
| - | } ); | + | |
| + | }); | ||
| - | Street.on( " | + | Street.on( " |
| + | | ||
| + | | ||
| + | | ||
| + | }); | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | # A custom chat command that replies with the player' | ||
| + | document.addEventListener(" | ||
| + | Street.registerCommand(" | ||
| + | }); | ||
| + | |||
| + | function helloPlayer() { | ||
| + | const player = Street.me.streetName; | ||
| + | Street.say(`Hello ${player}!`); | ||
| + | } | ||
| </ | </ | ||
