BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: Xenixa on September 28, 2005, 10:32:36 pm

Title: Social Mods
Post by: Xenixa on September 28, 2005, 10:32:36 pm
EDIT: Since the problem was solved here are all the Social Mods I've made for Bebot.
These reply with reponses from the Original IGN Plugins... well all Except !credz. That's a "Xenixa Original"™. :p
   
* Special thanks goes out to Zacix for his Helpful insight in making these possible.

Beer.php (http://ftp://xen.afraid.org/bebot_files/Beer.php)
Cheetos.php (http://ftp://xen.afraid.org/bebot_files/Cheetos.php)
Credz.php (http://ftp://xen.afraid.org/bebot_files/Credz.php)
Cyber.php (http://ftp://xen.afraid.org/bebot_files/Cyber.php)
Title: Social Mods
Post by: Derroylo on September 28, 2005, 11:08:10 pm
heya

the problem is easy :)
you want to return the class variable cheese but there isn´t anything in. You didn´t fill it somewhere. What you have done is, that you have defined(filled with data) it in the function get_cheesy so you need to change the line:
Code: [Select]

Return $this -> bot -> $cheese[rand(0,sizeof($cheese)-1)];


with this one

Code: [Select]

Return $cheese[rand(0,sizeof($cheese)-1)];


hope it helped :)
Title: Social Mods
Post by: Zacix on September 29, 2005, 09:53:22 am
first of all you should return
Code: [Select]
Return $this -> $cheese[rand(0,sizeof($this->cheese)-1)];This means that you actually use the classvarible you have declared.

second, you don't pass the $name variable to the get_cheesy() function. Whenever you call get_cheesy(), use
Code: [Select]
$this->get_cheesy($name)

The whole file should look like:
Code: [Select]
<?
  /*
   * Cheetos.php - A Social Module
   * For BeBot - An Anarchy Online Chat Automaton Developed by Blondengy (RK1)
   * Copyright (C) 2004 Jonas Jax
   *
   * Module Developed by Xenixa (RK1)
   *
   * As usual place this file in ./modules
   */
   
  /*
    Add a "_" at the beginning of the file (_Cheetos.php) if you do not want it to be loaded.
  */
 
  $cheetos = new Cheetos($bot);

  $commands["tell"]["cheetos"] = &$cheetos;
  $commands["pgmsg"]["cheetos"] = &$cheetos;
  $commands["gc"]["cheetos"] = &$cheetos;


  /*
    The Class itself...
  */
  class Cheetos
  {
    var $bot;
    var $cheese;
       

    /*
      Constructor:
        Hands over a referance to the "Bot" class.
    */
    function Cheetos (&$bot)
    {
      $this -> bot = &$bot;
      $this->cheese = array(
      "casts Materialize Greater Cheetos in *name*'s mouth.",
      "stuffs some cheetos in your mouth.",
      "Your mom asked me to give you an apple instead.",
      "cleans his orange hands, then puts more cheetos in *name*'s mouth.",
      "carefully uses chopsticks to place a cheeto in *name*'s mouth.",
      "tosses a few cheetos into *name*'s mouth from 11 meters away.",
      "whips out his QL257 Pump Cheeto Master and hits *name* for *dmg* points of Orange damage.",
      "starts to put a cheeto in *name*'s mouth, but pulls away teasingly.",
      "sneaks a few cheerios into *name*'s mouth instead of cheetos.",
      "rushes forward to jamb a cheeto in *name*'s mouth but gets in their nose instead.");
      // You can add more possible responses to the array above.
   
    }


    /*
      This gets called on a tell with the command
    */
    function tell($name, $msg)
    {
      $this -> bot -> send_tell($name, $this -> get_cheesy($name));
    }


    /*
      This gets called on a msg in the privgroup with the command
    */
    function pgmsg($name, $msg)
    {
      $this -> bot -> send_pgroup($this -> get_cheesy($name));
   }


    /*
      This gets called on a msg in the guildchat with the command
    */
    function gc($name, $msg)
    {
      $this -> bot -> send_gc($this -> get_cheesy($name));
    }

   
    /*
      Build response
    */
    function get_cheesy($name)
      {
       $dmg = rand(100,999);
       $returnstr = $this -> cheese[rand(0,sizeof($this->cheese)-1)];
       $returnstr = str_replace("*name*",$name,$returnstr);
       $returnstr = str_replace("*dmg*",$dmg,$returnstr);
       return $returnstr;    
     }
  }
?>
Title: Social Mods
Post by: Zacix on September 29, 2005, 10:03:38 am
Took the liberty to change the file a bit, hate me or not...think it should work at least...haven't tested though :D
Title: Social Mods
Post by: Xenixa on October 02, 2005, 11:17:59 am
Hmmm heheh, forgot I had posted this.
I had actually already changed the Return line to like what you posted Zacix.

I.E. from this
Code: [Select]
Return $this -> bot -> $cheese[rand(0,sizeof($this->cheese)-1)];
to this
Code: [Select]
Return $this -> $cheese[rand(0,sizeof($this->cheese)-1)];
I had put it aside afterword and forgot about it.

All I needed to do was add $name in the function call send_*($this -> get_cheesy(); like you mentioned and walla! It works.

That's an interesting solution you came up with. I tested yours and it does work btw, I'll probably just use yours. Although that string replacing has to make me wonder if it slows down the replies. I'll run a few tests and see which seems to reply faster probably for grins. :)
Title: Social Mods
Post by: Zacix on October 02, 2005, 05:14:28 pm
The problem with your earlier version is that the strings were instanciated each time. If you changed the $cheese variable to $this->cheese would also mean that all the strings would be static and not change at all...if I'm not totally wrong. Think acutally my version is the best ^^
Title: Social Mods
Post by: Xenixa on October 03, 2005, 08:55:05 am
Ya I was just looking at the structure again. The way I had it set up it would rebuild the string array every time it was called. Looks like a trade off, do string replacements or rebuild array. :)

Just sticking with your structure now. Thanks for the help.

Oh and I also made a Social mod for Beer and Cyber that can be found on some IGN bots. They're just conversions of the possible replies really from IGN plugin to BeBot mod.

If anyone wants the Beer and Cyber mods for Bebot I suppose I could slap them up here. Now were was I? Oh ya, looking at retooling the guest autoinv function.
Title: Social Mods
Post by: Xenixa on October 19, 2005, 03:25:38 pm
See EDIT in first post ^^
Title: Re: Social Mods
Post by: Dracutza on November 12, 2006, 08:09:07 pm
is it possible to get a new link to these? or have someone email me the files for beer and cyber?

thanks in advance
Title: Re: Social Mods
Post by: Malosar on December 07, 2006, 07:30:22 pm
Here's the social mods in a new unified module called "jokes". Basically it handles all the different types and allows variables and ingame adding of more entries.

Usage:

!jokeadd type text

Types supported:

!beer
!cheetos
!cyber
!creds
!chuck
!joke


Variables supported:

@@@ = characters name
### = random ql from 1-300
$$$ = random creds from 1-99, resolves as "xxx million"
*** = random damage from 1-1000000


For instance, if you typed the following ingame:

!jokeadd beer Hey there @@@, here's your ql### trox ale, i'll put the $$$ creds on your account.

It would add the text under the type "beer". If I typed !beer in orgchat or a tell and it randomly chose that entry, it would appear so:

Hey there Malosar, here's your ql176 trox ale, I'll put the 56 million creds on your account.

I've included most of the entries from the old IGN bot plugins, feel free to add many yourself and use the variables wherever possible I guess. Add any variables and types you want.

Module, helpfile and sql included in rar package.
Title: Re: Social Mods
Post by: Malosar on December 08, 2006, 09:38:27 pm
Updated module with a !chuck type and updated the sql with a whole bunch of chuck comments.
Title: Re: Social Mods
Post by: Bart on December 16, 2006, 07:18:25 pm
Xenixa's FTP seems to be down, does anyone else have these?
Title: Re: Social Mods
Post by: Malosar on December 16, 2006, 08:05:03 pm
Xenixa's FTP seems to be down, does anyone else have these?

Did you see my post?
Title: Re: Social Mods
Post by: Bart on December 18, 2006, 04:14:31 am
yeah found your post, now can you explain this?


ERROR 1231 (42000) at line 24: Variable 'sql_mode' can't be set to the value of
'NULL'


Title: Re: Social Mods
Post by: madrid on December 18, 2006, 08:09:22 am
Does anyone still have copies of these modules?  The links at the top of the page don't work anymore.  LMK
Title: Re: Social Mods
Post by: Malosar on December 18, 2006, 12:54:49 pm
yeah found your post, now can you explain this?

ERROR 1231 (42000) at line 24: Variable 'sql_mode' can't be set to the value of
'NULL'


Probably an errant ' somewhere in the text fields. I entered the text via sqlyog and dumped via mysqldump. I'll have to check over the sql and remove them.
Title: Re: Social Mods
Post by: Malosar on December 18, 2006, 05:26:22 pm
It was just the sqlmode command at the bottom. Delete from line 24 onwards and you should be fine.

Updated sql in the jokes.rar in my post as well.
Title: Re: Social Mods
Post by: Bart on December 19, 2006, 09:25:18 pm
thx a ton mate :D cheers
SimplePortal 2.3.7 © 2008-2025, SimplePortal