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
-
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)
-
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:
Return $this -> bot -> $cheese[rand(0,sizeof($cheese)-1)];
with this one
Return $cheese[rand(0,sizeof($cheese)-1)];
hope it helped :)
-
first of all you should return
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$this->get_cheesy($name)
The whole file should look like:<?
/*
* 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;
}
}
?>
-
Took the liberty to change the file a bit, hate me or not...think it should work at least...haven't tested though :D
-
Hmmm heheh, forgot I had posted this.
I had actually already changed the Return line to like what you posted Zacix.
I.E. from thisReturn $this -> bot -> $cheese[rand(0,sizeof($this->cheese)-1)];
to this
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. :)
-
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 ^^
-
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.
-
See EDIT in first post ^^
-
is it possible to get a new link to these? or have someone email me the files for beer and cyber?
thanks in advance
-
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.
-
Updated module with a !chuck type and updated the sql with a whole bunch of chuck comments.
-
Xenixa's FTP seems to be down, does anyone else have these?
-
Xenixa's FTP seems to be down, does anyone else have these?
Did you see my post?
-
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'
-
Does anyone still have copies of these modules? The links at the top of the page don't work anymore. LMK
-
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.
-
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.
-
thx a ton mate :D cheers