-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.py
More file actions
26 lines (20 loc) · 871 Bytes
/
controller.py
File metadata and controls
26 lines (20 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from lib.base_controller import BaseController
import time
import minescript # must be imported last to avoid errors
class ExampleController(BaseController):
def task(self):
"""
Example task implementation.
Performs a simple 10-step loop with breakable points.
"""
for i in range(10):
minescript.echo(f"[TASK] Executing example task {i}...")
time.sleep(1) # Simulate work
# Breakable point to check running/terminated state
if not self.running or self.terminated:
minescript.echo("[TASK] Task interrupted at breakable point.")
return
# self.running = False # Option to pause after completing the cycle
if __name__ == "__main__":
ctrl = ExampleController()
ctrl.start()