Advertisement
Guest User

Untitled

a guest
Nov 29th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.86 KB | None | 0 0
  1. <?php
  2. namespace Prodigy;
  3.  
  4. class BotExample extends BotBase implements InterfaceSteelCityAutomaton{
  5.  
  6.   public function on_rez(){
  7.     $this->world->say(0, "Oh! Existance! How amusing!");
  8.   }
  9.  
  10.   public function on_derez(){
  11.     $this->world->say(0, "Good bye, cruel world!");
  12.   }
  13.  
  14.   public function on_move(BotMovement $movement){
  15.     if($movement->delta_motion > 0.1) {
  16.       $this->world->say(0, "Oof! I moved " . number_format($movement->delta_motion, 2) . "!");
  17.       $this->world->play("d11424ea-be2d-9d70-e039-e73278588686");
  18.     }
  19.   }
  20.  
  21.   /**
  22.    * Handle a teleport Request.
  23.    * @param BotAgent $agent
  24.    * @param BotTeleportRequest $teleport_request
  25.    */
  26.   public function teleport_request(BotAgent $agent, BotTeleportRequest $teleport_request){
  27.     if($agent->is_admin()){
  28.       $agent->say("Yes sir.");
  29.       //$this->move($x, $y, $sim);
  30.       $teleport_request->accept();
  31.     }else{
  32.       $agent->say("Aww hell naw, I ain't moving to {$teleport_request->x},{$teleport_request->y} in {$teleport_request->sim}");
  33.     }
  34.   }
  35.  
  36.   /**
  37.    * Not sure if keeping?
  38.    * @param $command
  39.    * @return bool|void
  40.    */
  41.   public function on_command($command){
  42.     if($command == "shit self"){
  43.       $this->world->say(0, "Aww hell naw");
  44.       return false;
  45.     }
  46.   }
  47.  
  48.   /**
  49.    * @param BotAgent $agent
  50.    * @param $message
  51.    */
  52.   public function listen(BotAgent $agent, $message){
  53.     #$this->world->say(0, "{$agent->get_name()} said {$message}");
  54.    if($message == "die"){
  55.       if($agent->get_name() == "Greyscale Eusebio"){
  56.         exit;
  57.       }else{
  58.         $agent->say("heh, no.");
  59.       }
  60.     }
  61.   }
  62.  
  63.   // Handle this script stopping. On stop, logout cleanly.
  64.   public function __destruct(){
  65.     $this->logout();
  66.   }
  67.  
  68.   /**
  69.    * @param $tick integer Number of ticks since begin
  70.    */
  71.   public function on_tick($tick){
  72.  
  73.   }
  74.  
  75.  
  76.  
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement