Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Outdated Siri a Chat command bot 1.5.0 Beta 1

Siri is your computerized personal assistant that you can talk to, and run commands.

  1. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    The if system is different than the switch system. You have to replace it fully to make it work.
  2. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    Well okay I feel like crying, there's over 700 lines of code to redo!
  3. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    You don't have to redo them, it was just a suggestion :p
  4. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    Well I want to! Does it work if you trigger one or if there's 2 "ifs" it has to trigger both?
  5. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I don't get what you mean, an if will only be triggered if that condition is met
  6. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    Does it do this?

    increase brightness = trigger

    or can it work with one

    increase = trigger
  7. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    The first one searches for brightness in the input and the the second decides if it has increase of decrease
  8. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    Complicated coding here I come!
  9. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    What if there's 3?
  10. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I made a mistake in the last code I gave you, I edited it.
  11. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    What?
  12. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Nothing, just if you want to have multiple ifs you call the ones following ifelse. I really can't explain this well, just read a manual on php.net, that's where I got this :p
  13. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    so like this?

    if(strpos($params[0],'hello')!==false){
    $this->api->chat->broadcast("<Siri> Hello master!");
    break;
    ifelse(strpos($params[0],'hi')!==false){
    $user = strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Siri says hi back.");
  14. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Basically, but I though you were imploding the string under $subcmd
  15. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    Okay can you test it?

    PHP:
    <?php
    /*
    __PocketMine Plugin__
    name=Siri - A informational chat bot that you can talk to and run commands
    version=1.4.0
    author=Legomite
    class=Siri
    apiversion=8,9,10
    */

    /*
    ___changelog___
    1.3.0
    * Removed nearly all the public functions as they are not needed
    * Vastly made the commands more flexible and added more chat recognition
    * Improved the Loading message
    * Added new responses as bye,good.morning and good.night
    * Some background changes and tweaks
    * GAMEMODE COMMAND PLANNED TO BE FIXED IN 1.3.1
    1.2.1
    *Added a new loading message
    * Change the name of the file to Siri 2.2.1 by Legomite so you can identify the version your running
    * updated the version name to 2.2.1 as it stayed 1.0.0 through two updates.
    * Updated the name as though it is outdated.
    * STILL DID NOT FIX THE GAMEMODE CHANGE COMMAND
    1.2.0
    * Added 3 new responses!!!
    * Siri can now do one type of joke. e.g) What.did.the.fox.say? (still needs working on)
    * Siri can now talk about bathrooms!!!
    * Add you think im funny? response. (actual text from real Siri)
    * Improved Siri's sense of humour
    * Fixed some capitalizing and added periods for some text that were missing some.
    * SWITCHING GAMEMODES DOES NOT WORK AS OF 1.1.0 AND 1.2.0
    1.1.0
    * removed what your speech said.
    * made the commands more flexible and now access commands with multiple speeches
    * Added new responses as call.me.master and sing.for.me and do.you.have.any.good.news?
    * Can now ask Siri to switch gamemodes for you.
    * New loading sign
    * Several minor improvements and background changes.
    1.0.0
    * released
    */

    class Siri implements Plugin{
    private 
    $api$path$config;
    public function 
    __construct(ServerAPI $api$server false){
    $this->api $api;
    }

    public function 
    init(){

    $this->api->console->register("siri""Siri", array($this"command"));
    console("§a[Siri] Siri loading...");
    console("§a[Siri] §dThis plugin is created by §cLegomite.§dCheck if you have the latest version of this plugin as I will update it constantly!");
    }

    public function 
    __destruct(){}

    public function 
    command($cmd$params$issuer$alias$args$issuer){
    $subcmd implode(" "$params);
    if(
    strpos($params[0],'hello')!==false){
    $this->api->chat->broadcast("<Siri> Hello master!");
    break;
    ifelse(strpos($params[0],'hi')!==false){
    $user strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Siri says hi back.");
    break;
    ifelse(strpos($params[0],'kill')!==false){
    ifelse(strpos($params[0],'everyone')!==false){
    $user strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Okay, killing everybody.");
    $this -> api -> console -> run("kill @a");
    break;
    ifelse(strpos($params[0],'brightness')!==false){
    ifelse(strpos($params[0],'increase')!==false ){
    $user strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Okay increasing brightness.");
    $this -> api -> console -> run("time set day");
    break;
    ifelse(strpos($params[0],'brightness')!==false){
    ifelse(strpos($params[0],'decrease')!==false ){
    $user strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Okay decreasing brightness.");
    $this -> api -> console -> run("time set night");
    break;
  16. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Please change $params[0] to $subcmd
    Also remove the breaks to end an if use }
    When nesting ifs you don't want to use the ifelse
    Again ifs can be tricky so please read a tutorial before working on this
  17. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    What does nesting mean? I only started 3 weeks ago.
  18. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    here

    PHP:
    public function command($cmd$params$issuer$alias$args$issuer){
    $subcmd implode(" "$params);
    if(
    strpos($subcmd,'hello')!==false){
    $this->api->chat->broadcast("<Siri> Hello master!");
    }
    if(
    strpos($subcmd,'hi')!==false){
    $user strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Siri says hi back.");
    }
    if(
    strpos($subcmd[0],'kill')!==false){
    ifelse(strpos($subcmd[0],'everyone')!==false){
    $user strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Okay, killing everybody.");
    $this -> api -> console -> run("kill @a");
    }
    if(
    strpos($subcmd,'brightness')!==false){
    ifelse(strpos($subcmd,'increase')!==false ){
    $user strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Okay increasing brightness.");
    $this -> api -> console -> run("time set day");
    }
    if(
    strpos($subcmd,'brightness')!==false){
    ifelse(strpos($subcmd,'decrease')!==false ){
    $user strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Okay decreasing brightness.");
    $this -> api -> console -> run("time set night");
    break;
  19. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Like if a statement is met then check another statement. They are inside eachother. Can I make an AI kind of like yours expect with a very eccentric personality? I just wanted to ask you as you gave me the idea. :p
  20. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    By that you mean a plugin that does umm... have a personality?

Share This Page

Advertisement