62 lines
1.8 KiB
Markdown
62 lines
1.8 KiB
Markdown
Roblox Bhop/Surf Bot File Format
|
|
================================
|
|
|
|
## Example
|
|
|
|
Read the whole file and print each position:
|
|
```rust
|
|
use strafesnet_roblox_bot_file::v0::read_all_to_block;
|
|
|
|
let file=std::fs::read("bot_file")?;
|
|
let mut input=std::io::Cursor::new(file);
|
|
|
|
let block=read_all_to_block(&mut input)?;
|
|
|
|
for output_event in &block.output_events{
|
|
println!("{:?}",output_event.event.position);
|
|
}
|
|
```
|
|
Or decode individual blocks using block location info:
|
|
```rust
|
|
use strafesnet_roblox_bot_file::v0::{Block,BlockTimelines,FileHeader};
|
|
|
|
let file=std::fs::read("bot_file")?;
|
|
let mut input=std::io::Cursor::new(file);
|
|
|
|
// FileHeader is the first 16 bytes of the file.
|
|
let header=FileHeader::from_reader(&mut input)?;
|
|
// BlockTimelines is an index of the blocks within the file.
|
|
let timelines=BlockTimelines::from_reader(&header,&mut input)?;
|
|
|
|
// offline blocks include the following event types:
|
|
// World, Gravity, Run, Camera, Setting
|
|
for timed in timelines.offline_blocks(){
|
|
let block_info=timelines.block_info(timed.event)?;
|
|
let block_reader=block_info.take_seek(&mut input)?;
|
|
let block=Block::from_reader(block_reader)?;
|
|
}
|
|
|
|
// realtime blocks include the following event types:
|
|
// Input, Output, Sound
|
|
for timed in timelines.realtime_blocks(){
|
|
let block_info=timelines.block_info(timed.event)?;
|
|
let block_reader=block_info.take_seek(&mut input)?;
|
|
let block=Block::from_reader(block_reader)?;
|
|
}
|
|
```
|
|
|
|
#### License
|
|
|
|
<sup>
|
|
Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
|
|
2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
|
|
</sup>
|
|
|
|
<br>
|
|
|
|
<sub>
|
|
Unless you explicitly state otherwise, any contribution intentionally submitted
|
|
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
|
|
be dual licensed as above, without any additional terms or conditions.
|
|
</sub>
|