Files
BreakEscape/js
Z. Cliffe Schreuders 2a4ee59e4f docs(rfid): Add Ink integration and comprehensive variable documentation
Add Ink integration for RFID card protocols, allowing conversation scripts
to detect and respond to different card security levels and protocols.

## Ink Integration (Phase 5):

### 1. Added syncCardProtocolsToInk() Method
- Location: js/minigames/person-chat/person-chat-conversation.js
- Auto-syncs when syncItemsToInk() is called
- Generates rfid_data if card uses card_id pattern
- Syncs variables for each keycard NPC holds

### 2. Per-Card Variables Synced:
- {prefix}_protocol - Protocol name
- {prefix}_name - Card display name
- {prefix}_card_id - Logical identifier
- {prefix}_security - "low", "medium", "high"
- {prefix}_instant_clone - Boolean (EM4100, weak MIFARE)
- {prefix}_needs_attack - Boolean (custom key MIFARE)
- {prefix}_uid_only - Boolean (DESFire)
- {prefix}_uid - Card UID (MIFARE)
- {prefix}_hex - Card hex ID (EM4100)

### 3. Prefix Pattern:
- First card: card_protocol, card_name, card_card_id, etc.
- Second card: card2_protocol, card2_name, card2_card_id, etc.

## Documentation:

### scenarios/ink/README_RFID_VARIABLES.md (NEW)
Comprehensive guide for scenario designers covering:

1. **Variable Declarations** - Required Ink variable setup
2. **Variable Reference** - Complete table of all variables
3. **Protocol Characteristics** - Details for each of 4 protocols
4. **Usage Examples**:
   - Simple EM4100 clone
   - Multi-protocol detection
   - Conditional dialogue based on protocol
5. **Ink Tags** - Suggested tag patterns for RFID actions
6. **Scenario JSON Format** - How to define keycards
7. **Tips for Scenario Designers** - Best practices
8. **Complete Example Scenario** - Full working Ink script
9. **Troubleshooting** - Common issues and solutions

## Example Ink Usage:

```ink
VAR card_protocol = ""
VAR card_security = ""
VAR card_instant_clone = false

{card_security == "low":
  "This is a low-security card. Easy to clone!"
  # clone_keycard:{card_card_id}
  -> cloned
}

{card_needs_attack:
  "Need to run Darkside attack..."
  # save_uid_and_start_attack:{card_card_id}|{card_uid}
  -> wait_for_attack
}
```

## Benefits:

1. **Scenario designers** can write protocol-aware dialogue
2. **NPCs** can react realistically to card security levels
3. **Players** get different experiences based on card type
4. **Automatic** - no manual variable management needed

## Files Modified:
- js/minigames/person-chat/person-chat-conversation.js
- scenarios/ink/README_RFID_VARIABLES.md (NEW)

## Next Steps:
- Create test scenarios for each protocol
- Add Ink tag handlers for suggested patterns
- Test with various card combinations

Phase 5 (Ink Integration) complete!
2025-11-15 23:48:15 +00:00
..
2025-11-14 19:47:54 +00:00
2025-11-14 19:47:54 +00:00
2025-11-14 19:47:54 +00:00
2025-11-14 19:47:54 +00:00