RPG Maker SDK API Reference
Complete API documentation for the Shard RPG Maker SDK.
ShardSDK
Global object providing access to all SDK services.
Properties
| Property | Type | Description |
|---|---|---|
Config | object | SDK configuration (read-only) |
Recording | object | Recording service |
Monitor | object | Monitor service |
Social | object | Social service |
Config Object
| Property | Type | Description |
|---|---|---|
launcherUrl | string | URL of the Shard Launcher |
enableRecording | boolean | Whether recording is enabled |
enableMonitor | boolean | Whether monitoring is enabled |
enableSocial | boolean | Whether social events are enabled |
ShardSDK.Recording
Service for triggering recording events.
triggerEvent(eventId)
Triggers a recording event in the Shard Launcher.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
eventId | string | Yes | The recording event ID |
Example:
// Trigger a recording event
ShardSDK.Recording.triggerEvent("myGame_bossDefeated");HTTP Request:
- Endpoint:
POST /api/recording/trigger - Payload:
{ "eventId": "...", "timestamp": "..." }
ShardSDK.Monitor
Service for reporting errors and diagnostics.
reportError(message, stackTrace)
Reports an error to the Shard Launcher.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Error or diagnostic message |
stackTrace | string | No | Optional stack trace |
Example:
// Report an error with message only
ShardSDK.Monitor.reportError("Player position invalid");
// Report an error with stack trace
try {
// risky code
} catch (e) {
ShardSDK.Monitor.reportError(e.message, e.stack);
}HTTP Request:
- Endpoint:
POST /api/monitor/report - Payload:
{ "message": "...", "stackTrace": "...", "timestamp": "..." }
ShardSDK.Social
Service for triggering social events.
triggerEvent(eventId)
Triggers a social event in the Shard Launcher.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
eventId | string | Yes | The social event ID |
Example:
// Trigger a social event
ShardSDK.Social.triggerEvent("myGame_achievementUnlocked");HTTP Request:
- Endpoint:
POST /api/social/trigger - Payload:
{ "eventId": "...", "timestamp": "..." }
Plugin Parameters
Configure via RPG Maker’s Plugin Manager:
| Parameter | Type | Default | Description |
|---|---|---|---|
| Launcher URL | string | http://localhost:9876 | URL of the Shard Launcher |
| Enable Recording | boolean | true | Enable recording event triggers |
| Enable Monitor | boolean | true | Enable monitor/error reporting |
| Enable Social | boolean | true | Enable social event triggers |
Script Call Examples
Use these in RPG Maker event Script calls:
Recording a Boss Fight
// When boss battle starts
ShardSDK.Recording.triggerEvent("myGame_bossFight");Reporting Game Errors
// In a try-catch block
try {
// game logic
} catch (e) {
ShardSDK.Monitor.reportError(e.message, e.stack);
}Achievement Unlocked
// When player unlocks an achievement
ShardSDK.Social.triggerEvent("myGame_firstBoss");Advanced Usage
Checking if Features are Enabled
// Check if recording is enabled before triggering
if (ShardSDK.Config.enableRecording) {
console.log("Recording is enabled");
}Custom Error Handler
// Set up a global error handler
window.onerror = function(message, source, lineno, colno, error) {
ShardSDK.Monitor.reportError(
message,
error ? error.stack : `${source}:${lineno}:${colno}`
);
return false; // Let the error propagate
};The SDK automatically handles cases where the launcher is not running - your game will continue without errors.