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. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    Thanks
  2. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    THANK YOU IT WORKS!!! YOU WILL BE MENTIONED!!!(In my plugin)
  3. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    Don't forget to finish it, you need to replace the . with spaces from "do you like cake down"
  4. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    I know:):):);)
  5. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    ok
  6. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    The plugin looks great, the only things that could be improved upon is switching from exact case matching to a series of ifs (eg:If string contains brightness and decrease then decrease brightness). This should decrease the size quite a bit and make it much more efficient. Also making it load an external plugin would be easier that way it would update seamlessly, I think this can be done via $this->api->plugin->load("{URL}");
    Glitchmaster_PE likes this.
  7. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    this is a good idea, this plugin tends to have a lot of updates since it is constantly being added to, so auto updating would be a good move
  8. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    I tried that that's why im on github.
  9. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    This sounds like a good idea.
  10. 99leonchang
    Offline

    99leonchang Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    165
    Plugins:
    2
    Minecraft User:
    99leonchang
    It is a good idea as you can see with @Humerus 's SList plugin which self loads from the internet
  11. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    For now it's good, but eventually it would be better to make a offline version.
  12. 99leonchang
    Offline

    99leonchang Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    165
    Plugins:
    2
    Minecraft User:
    99leonchang
    Yeah, i guess so
  13. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    Hey do you know how to switch from exact case matching to a series of ifs (eg:If string contains brightness and decrease then decrease brightness) I just need a start on the code for Siri.
  14. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Here is what I was thinking:
    PHP:
    if(strpos($params[0],'brightness')!==false && strpos($params[0],'increase')!==false ){
    //Whatever code you use to increase
    }
    if(
    strpos($params[0],'brightness')!==false && strpos($params[0],'decrease')!==false ){
    //Whatever code you use decrease
    }
    Or you could nest the ifs:

    PHP:
    if(strpos($params[0],'brightness')!==false){
    if(
    strpos($params[0],'increase')!==false ){
    //Code to increase
    }
    if(
    strpos($params[0],'decrease')!==false ){
    //Code to decrease
    }
    }
  15. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    So I replace it with the cases?
  16. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Nah, with ifs you don't need cases, it will just do what you tell it if the conditions are met, so it basically is all the cases for one action in one statement
  17. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    public function command($cmd, $params, $issuer, $alias, $args, $issuer){
    $subcmd = implode(" ", $params);
    switch($subcmd){
    if(strpos($params[0],'brightness')!==false){
    if(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;

    ERROR CAN YOU FIX IT?

    2013-10-30 §b01:00:39§r [ERROR] Failed loading plugin: evaluation error
  18. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Yes, you no longer need a switch, your imploding params, so you will want to use $subcmd instead, here is what I got (I included decrease as well because they are nested together)
    PHP:
    public function command($cmd$params$issuer$alias$args$issuer){
    $subcmd implode(" "$params);
    if(
    strpos($subcmd,'brightness')!==false){
    if(
    strpos($subcmd,'increase')!==false ){
    $user strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Okay increasing brightness.");
    $this -> api -> console -> run("time set day");
    }
    elseif(
    strpos($subcmd,'decrease')!==false ){
    $user strtolower($args[0]);
    $this->api->chat->broadcast("<Siri> Okay increasing brightness.");
    $this -> api -> console -> run("time set night");
    }
    }
    Last edited: Oct 30, 2013
  19. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    You may want to read up on if/ifelse/else statements in PHP before you start getting working on this
  20. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    So I have to delete every single cases then replace it with ifs if I want to avoid errors?

Share This Page

Advertisement