53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Example configuration script that sets up shared state for other scripts
|
|
Usage: ./mcrogueface --exec example_config.py --exec example_automation.py game.py
|
|
"""
|
|
import mcrfpy
|
|
|
|
# Create a shared configuration namespace
|
|
class AutomationConfig:
|
|
# Test settings
|
|
test_enabled = True
|
|
screenshot_interval = 5 # Take screenshot every N tests
|
|
max_test_count = 50
|
|
test_delay_ms = 1000
|
|
|
|
# Monitoring settings
|
|
monitor_enabled = True
|
|
monitor_interval_ms = 500
|
|
report_delay_seconds = 30
|
|
|
|
# Game-specific settings
|
|
start_button_pos = (512, 400)
|
|
inventory_key = "i"
|
|
movement_keys = ["w", "a", "s", "d"]
|
|
|
|
# Shared state
|
|
test_results = []
|
|
performance_data = []
|
|
|
|
@classmethod
|
|
def log_result(cls, test_name, success, details=""):
|
|
"""Log a test result"""
|
|
cls.test_results.append({
|
|
"test": test_name,
|
|
"success": success,
|
|
"details": details,
|
|
"frame": mcrfpy.getFrame()
|
|
})
|
|
|
|
@classmethod
|
|
def get_summary(cls):
|
|
"""Get test summary"""
|
|
total = len(cls.test_results)
|
|
passed = sum(1 for r in cls.test_results if r["success"])
|
|
return f"Tests: {passed}/{total} passed"
|
|
|
|
# Attach config to mcrfpy module so other scripts can access it
|
|
mcrfpy.automation_config = AutomationConfig
|
|
|
|
print("Config: Automation configuration loaded")
|
|
print(f"Config: Test delay = {AutomationConfig.test_delay_ms}ms")
|
|
print(f"Config: Max tests = {AutomationConfig.max_test_count}")
|
|
print("Config: Other scripts can access config via mcrfpy.automation_config") |