pub fn run_script_agent<T: ScriptAgent>(
agent_id: String,
wants_ball_predictions: bool,
wants_comms: bool,
connection: RLBotConnection,
) -> Result<(), AgentError>Expand description
Run a single ScriptAgent with no controllables on one thread.
Ok(()) means a successful exit, i.e. core sent a disconnect.
ยงErrors
Returns an error if the agent panics or the connection fails.
Examples found in repository?
examples/high_jump_script/main.rs (line 92)
83fn main() {
84 let AgentEnvironment {
85 server_addr,
86 agent_id,
87 } = AgentEnvironment::from_env();
88 let agent_id = agent_id.unwrap_or_else(|| "rlbot/rust-example/high_jump_script".into());
89 let rlbot_connection = RLBotConnection::new(&server_addr).expect("connection");
90
91 // Blocking.
92 run_script_agent::<MyScript>(agent_id.clone(), true, true, rlbot_connection)
93 .expect("run_script_agent crashed");
94
95 println!("Script with agent_id `{agent_id}` exited nicely");
96}