BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Age of Conan Archive => BeBot Hyborian support => Topic started by: Barlyman on July 29, 2008, 11:05:35 pm
-
Hi and thanks for this awsome bot.
I have changed the guildinfo.php module to match out guilds info, I have also listed the Officers of the guild with klickable names that sent a tell with "I'm interested in what you have to offer, please tell me more" to the officer thats klicked.
Now I wonder if it's possible to make a note infront of each officer saying online or offline?
Would it be possible to just call a function in the OnlineDisplay.php module and if so, how?
Would relly like to understand how .php works better but all I ever done is VB and asp :/ and sorry for the foul words ;)
and all my "programming was a while ago, getting a bit rusty :'(
Many thanks for all the superb coding you lads have done
//Barlyman
-
The code you're looking for is:
$online = $this -> bot -> core("online") -> get_online_state($name);
// $online['content'] contains online, offline or unknown as colourized text
-
Dont know if this is correct, dont think so, cause it doesnt work, the bot starts and I get the blob but there is no trace of online/offline info.
Am I doing it completly wrong? ???
/*
Guilds Info
*/
function info()
{
$txt.= "##GI_red##<font Color='red' face='LARGE_BOLD'>Lorem Ipsum Guild Info:</font>##end##\n";
$txt.= "##GI_red##Website:##end## ##GI_highlight##http://loremipsum.mine.com##end##\n\n";
$online = $this -> bot -> core("online") -> get_online_state($Banshee);
$txt.= "##GI_red##Leader:##end## ##GI_highlight##<a href='chatcmd:///tell Banshee Im interested in joining Lorem Ipsum'>Banshee</a>##end##\n\n";
$txt.= "##GI_red##Officers:##end##\n";
$online = $this -> bot -> core("online") -> get_online_state($Judgement);
$txt.= "##GI_highlight##<a href='chatcmd:///tell Judgement Im interested in joining Lorem Ipsum'>Judgement</a> - Melee class leader##end##\n";
$online = $this -> bot -> core("online") -> get_online_state($Cronan);
$txt.= "##GI_highlight##<a href='chatcmd:///tell Cronan Im interested in joining Lorem Ipsum'>Cronan</a> - Tank Class leader##end##\n";
Mabey I need to change the
$online = $this -> bot -> core("online") -> get_online_state($name);
to something else than
$online = $this -> bot -> core("online") -> get_online_state($Cronan);
when hard coding it into the page like this
-
Wont get it to work, even tried
Guilds Info
*/
function info()
{
$txt.= "##GI_red##<font Color='red' face='LARGE_BOLD'>Lorem Ipsum Guild Info:</font>##end##\n";
$txt.= "##GI_red##Website:##end## ##GI_highlight##http://loremipsum.mine.com##end##\n\n";
$online1 = $this -> bot -> core("online") -> get_online_state('Banshee');
$online1['content'];
$txt.= "##GI_red##Leader:##end##\n";
$txt.= "##GI_highlight##<a href='chatcmd:///tell Banshee Im interested in joining Lorem Ipsum'>Banshee</a>##end##\n\n";
$txt.= "##GI_red##Officers:##end##\n";
$online2 = $this -> bot -> core("online") -> get_online_state("Judgement");
$online2['content'];
$txt.= "##GI_highlight##<a href='chatcmd:///tell Judgement Im interested in joining Lorem Ipsum'>Judgement</a> - Melee class leader##end##\n";
$online3 = $this -> bot -> core("online") -> get_online_state($Cronan);
$online3['content'];
$txt.= "##GI_highlight##<a href='chatcmd:///tell Cronan Im interested in joining Lorem Ipsum'>Cronan</a> - Tank Class leader##end##\n";
How do I get the online offline to show?
-
try:
function info()
{
$txt.= "##GI_red##<font Color='red' face='LARGE_BOLD'>Lorem Ipsum Guild Info:</font>##end##\n";
$txt.= "##GI_red##Website:##end## ##GI_highlight##http://loremipsum.mine.com##end##\n\n";
$online = $this -> bot -> core("online") -> get_online_state('Banshee');
$txt.= "##GI_red##Leader:##end##\n";
$txt.= "##GI_highlight##<a href='chatcmd:///tell Banshee Im interested in joining Lorem Ipsum'>Banshee</a>##end## ".$online['content']."\n\n";
$txt.= "##GI_red##Officers:##end##\n";
$online = $this -> bot -> core("online") -> get_online_state("Judgement");
$txt.= "##GI_highlight##<a href='chatcmd:///tell Judgement Im interested in joining Lorem Ipsum'>Judgement</a> - Melee class leader##end## ".$online['content']."\n";
$online = $this -> bot -> core("online") -> get_online_state('Cronan');
$txt.= "##GI_highlight##<a href='chatcmd:///tell Cronan Im interested in joining Lorem Ipsum'>Cronan</a> - Tank Class leader##end## ".$online['content']."\n";
-
Thanks mate, works fine now :)
this is the end result, looks good :)
function info()
{
$txt.= "##GI_red##<font Color='red' face='LARGE_BOLD'>Lorem Ipsum Guild Info:</font>##end##\n";
$txt.= "##GI_red##Website:##end## ##GI_highlight##http://loremipsum.mine.com##end##\n\n";
$online = $this -> bot -> core("online") -> get_online_state('Banshee');
$txt.= "##GI_red##Leader:##end##\n";
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Banshee Im interested in joining Lorem Ipsum'>Banshee</a>##end##\n\n";
$txt.= "##GI_red##Officers:##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Judgement');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Judgement Im interested in joining Lorem Ipsum'>Judgement</a> - Melee class leader##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Cronan');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Cronan Im interested in joining Lorem Ipsum'>Cronan</a> - Tank Class leader##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Lajdyhawk');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Lajdyhawk Im interested in joining Lorem Ipsum'>Lajdyhawk</a> - Healer Class leader##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Mimic');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Mimic Im interested in joining Lorem Ipsum'>Mimic</a> - Ranged Class leader##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Barlyman');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Barlyman Im interested in joining Lorem Ipsum'>Barlyman</a> - Bank, Guildbot, Forum##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Akimo');
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Akimo Im interested in joining Lorem Ipsum'>Akimo</a> - Recruitment, leveling##end##\n\n";
$txt.= "##GI_red##Guild Info:##end##\n";
(http://loremipsum.mine.nu/upload/uploads/Barlyman_picture006.jpg)
keep up the good work
//Barlyman
-
OK, time to upgrade the guildinfo even more, What I'm trying to do now is only make the officers online have clickable names
function info()
{
$txt.= "##GI_red##<font Color='red' face='LARGE_BOLD'>Circle of eternity Info:</font>##end##\n";
$txt.= "##GI_red##Website:##end## ##GI_highlight##http://www.coeguild.com##end##\n\n";
$txt.= "##GI_red##Leader:##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Leyor');
if $online['content'] = "online";
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Leyor Im interested in joining Circle of Eternity'>Leyor</a>##end##\n";
else;
$txt.= "##GI_highlight##".$online['content']." :: Leyor##end##\n";
endif;
$online = $this -> bot -> core("online") -> get_online_state('Banshee');
if $online['content'] = "online";
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Banshee Im interested in joining Circle of Eternity'>Banshee</a>##end##\n\n";
else;
$txt.= "##GI_highlight##".$online['content']." :: Banshee##end##\n\n";
endif;
$txt.= "##GI_red##Officers:##end##\n";
Thow this only gives me an error stating unsuspected T_variable...
Any Idé how this could be solved?
Thanks in advance
Barlyman
-
need more details mainly the line it says
and also need to know what lines you are posting
-
Got it to work now :)
ctrl + c some code from core/whois.php
function info()
{
$txt.= "##GI_red##<font Color='red' face='LARGE_BOLD'>Circle of eternity Info:</font>##end##\n";
$txt.= "##GI_red##Website:##end## ##GI_highlight##http://www.coeguild.org##end##\n\n";
$txt.= "##GI_red##Leader:##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Leyor');
if ($online['status'] <= 0)
{
$txt.= "##GI_highlight##".$online['content']." :: Leyor##end##\n";
}
else
{
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Leyor Im interested in joining Circle of Eternity'>Leyor</a>##end##\n";
}
$online = $this -> bot -> core("online") -> get_online_state('Banshee');
if ($online['status'] <= 0)
{
$txt.= "##GI_highlight##".$online['content']." :: Banshee##end##\n";
}
else
{
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Banshee Im interested in joining Circle of Eternity'>Banshee</a>##end##\n";
}
$txt.= "##GI_red##Officers:##end##\n";
So lets say Banshe is online but Leyor is not it will look like this
Circle of eternity Info:
Website: http://www.coeguild.org
Leader:
Offline :: Leyor
Online :: Banshee
-
is there an easy way to get this ported for AO? Would love something similar
-
chances are it would work with ao as is
altho the module looks org specific so chances would be needed, if barlyman post full code ill look at it and made some improvment as well and making sure its ao compatible
-
getting error upon bootup, can;t attach, so here's the full code with the changes from this post
'<?php
/*
* GuildInfo, by Kaeus
* This module helps people with guild recruitment.
*
*
*/
$GuildInfo = new GuildInfo($bot);
class GuildInfo extends BaseActiveModule
{
function __construct(&$bot)
{
parent::__construct(&$bot, get_class($this));
$this -> register_command('all', 'ginfo', "ANONYMOUS");
$this -> bot -> core("colors") -> define_scheme("GI", "highlight", "yellow");
$this -> bot -> core("colors") -> define_scheme("GI", "normal", "white");
$this -> bot -> core("colors") -> define_scheme("GI", "info", "lightgreen");
$this -> bot -> core("colors") -> define_scheme("GI", "red", "red");
$this -> bot -> core("colors") -> define_scheme("GI", "blue", "blue");
$this -> help['description'] = 'Helps with guild recruitment.';
$this -> help['command']['ginfo']="Displays guild's info tab.";
$this -> help['command']['ginfo members']="Displays a list of members in the guild.";
$this -> help['command']['ginfo classes']="Displays a list of classes in the guild.";
$this -> help['command']['grecruit']="Displays a recruitment link in OOC (usable only with priveleges).";
}
function command_handler($name, $msg, $origin)
{
if (preg_match('/^ginfo/i', $msg, $info)) {
$words = trim(substr($msg, strlen('ginfo')));
if ($words == "members")
{
return $this -> memberslist();
} else if($words == "classes") {
return $this -> memberscount();
} else {
return $this -> info();
}
} else if(preg_match('/^grecruit/i', $msg, $info)) {
//return "Command under development";
$msg = $this -> recruit();
$channel = $this -> bot -> core("chat") -> lookup_group("Playfield");
return "Currently under development: ".$channel;
} else {
$this -> bot -> send_help($name);
}
}
/*
Guilds Info
*/
function info()
{
$txt.= "##GI_red##<font Color='red' face='LARGE_BOLD'>Circle of eternity Info:</font>##end##\n";
$txt.= "##GI_red##Website:##end## ##GI_highlight##http://www.coeguild.org##end##\n\n";
$txt.= "##GI_red##Leader:##end##\n";
$online = $this -> bot -> core("online") -> get_online_state('Leyor');
if ($online['status'] <= 0)
{
$txt.= "##GI_highlight##".$online['content']." :: Leyor##end##\n";
}
else
{
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Leyor Im interested in joining Circle of Eternity'>Leyor</a>##end##\n";
}
$online = $this -> bot -> core("online") -> get_online_state('Banshee');
if ($online['status'] <= 0)
{
$txt.= "##GI_highlight##".$online['content']." :: Banshee##end##\n";
}
else
{
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Banshee Im interested in joining Circle of Eternity'>Banshee</a>##end##\n";
}
$txt.= "##GI_red##Officers:##end##\n";
/*
Still working on this, for now just some random debugging stuff I was trying
*/
function recruit()
{
$blob = "TDK is Recruiting!: '";
$blob.= $this -> info();
$blob.= " Playfield ID: ";
return $blob;
}
/*
Need to revize so it just uses core
*/
function memberslist()
{
$blob = "";
$count = 0;
$result = $this -> bot -> db -> select("SELECT nickname, last_seen FROM #___users WHERE user_level = " . MEMBER . " ORDER BY nickname ASC");
if (!empty($result))
{
$inside = "##blob_title##:::: <botname>'s Member List ::::##end##\n\n";
foreach ($result as $val)
{
$count++;
$inside .= "##blob_text##&#8226; " . $val[0];
if ($val[1] > 0)
{
$inside .= ", last seen at " . gmdate($this -> bot -> core("settings") -> get("Time", "FormatString"), $val[1]);
}
else
{
$inside .= ", never seen online";
}
$inside .= "##end## ".$this -> bot -> core("tools") -> chatcmd("whois " . $val[0], "[Whois]")."\n";
}
$blob = " :: " . $this -> bot -> core("tools") -> make_blob("click to view", $inside);
}
return $count . " Guild Members:" . $blob;
}
/*
Need to revize so it just uses core
*/
function memberscount()
{
$blob = "";
$total = 0;
$buddies = count($this -> bot -> ao -> buddies);
//Get a list of professions
$profession_list = "'".$this->bot->core('professions')->get_professions("', '")."'";
$counts = $this -> bot -> db -> select("SELECT t2.class, COUNT(DISTINCT t1.nickname)
FROM #___users AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname
WHERE user_level = " . MEMBER . " AND t2.class IN ($profession_list) GROUP BY class");
foreach ($this -> bot->core('professions')->get_profession_array() as $prof)
$count[$prof] = 0;
if (!(empty($counts)))
{
foreach ($counts as $profcount)
{
$count[$profcount[0]] += $profcount[1];
$total += $profcount[1];
}
}
$inside = "##blob_title##:::: <botname>'s Member Count ::::##end##\n";
$inside .= "\n##blob_text##Buddy List Count: ##blob_title##".$buddies."##end##\n";
foreach ($count as $key => $value)
$inside .= "\n&#8226; ".$key." = ##blob_title##".$value."##end##";
$blob = " :: " . $this -> bot -> core("tools") -> make_blob("click to view", $inside);
return $total . " Guild Classes:" . $blob;
}
}
?>
-
whats the error?
-
parse error: syntax error, unexpected ';' expecting T_FUNCTION in guildinfo.php on line 158
-
function info has incorrect count of { and }
-
ok, fixed that error, bot loaded fine this time, the command shows up, but for some reason it isn't making the blob like it should
-
I take that back, everything is working except for the fact of there is no guild window...that is an aoc thing
-
im redoing the module, just wondering about more info on what you mean by no guild window?
-
well in aoc anyone can view the guild information, this module makes use of that by linking back to the guild info window...in AO, there really isn't a guild info window save what you make of it.
-
<?php
/*
* GuildInfo, by Kaeus
* This module helps people with guild recruitment.
* Recoded by Temar
*
*/
$GuildInfo = new GuildInfo($bot);
class GuildInfo extends BaseActiveModule
{
function __construct(&$bot)
{
parent::__construct(&$bot, get_class($this));
$this -> register_command('all', 'ginfo', "ANONYMOUS");
$this -> register_alias("member list", "ginfo members");
$this -> register_alias("member", "ginfo classes");
$this -> bot -> core("colors") -> define_scheme("GI", "highlight", "yellow");
$this -> bot -> core("colors") -> define_scheme("GI", "normal", "white");
$this -> bot -> core("colors") -> define_scheme("GI", "info", "lightgreen");
$this -> bot -> core("colors") -> define_scheme("GI", "red", "red");
$this -> bot -> core("colors") -> define_scheme("GI", "blue", "blue");
$this -> help['description'] = 'Helps with guild recruitment.';
$this -> help['command']['ginfo']="Displays guild's info tab.";
$this -> help['command']['ginfo members']="Displays a list of members in the guild.";
$this -> help['command']['ginfo classes']="Displays a list of classes in the guild.";
$this -> help['command']['grecruit']="Displays a recruitment link in OOC (usable only with priveleges).";
$this -> bot -> core("settings") -> create("GuildInfo", "leader", "", "Users who should be Listed as Contacts under Leader seperated by ; eg user1;user2;user3");
$this -> bot -> core("settings") -> create("GuildInfo", "users", "", "Users who should be Listed as Contacts user Officers seperated by ; eg user1;user2;user3");
$this -> bot -> core("settings") -> create("GuildInfo", "website", "", "The Website that will be show in the Guild info blob");
}
function command_handler($name, $msg, $origin)
{
$msg = explode(" ", $msg);
Switch(strtolower($msg[0]))
{
case'ginfo':
Switch(strtolower($msg[1]))
{
//case 'members':
// return $this -> memberslist();
//case 'classes':
// return $this -> memberscount();
Default:
return $this -> info();
}
case 'grecruit': // this section doesnt work as command isnt registered
//return "Command under development";
$msg = $this -> recruit();
$channel = $this -> bot -> core("chat") -> lookup_group("Playfield");
return "Currently under development: ".$channel;
Default:
return "Broken plugin, recieved unhandled command: $command in Guildinfo.php";
}
}
/*
Guilds Info
*/
function info()
{
$txt.= "##GI_red##<font Color='red' face='LARGE_BOLD'>".$this -> bot -> guildname." Info:</font>##end##\n";
$txt.= "##GI_red##Website:##end## ##GI_highlight##".$this -> bot -> core("tools") -> chatcmd($this -> bot -> core("settings") -> get("GuildInfo", "website"), $this -> bot -> core("settings") -> get("GuildInfo", "website"), "start")."##end##\n\n";
$txt.= "##GI_red##Leader:##end##\n";
$users = $this -> bot -> core("settings") -> get("GuildInfo", "leader");
$users = str_replace(" ", "", $users);
$users = explode(";", $users);
if(!empty($users))
{
foreach($users as $user)
{
$user = ucfirst(strtolower($user));
$online = $this -> bot -> core("online") -> get_online_state($user);
if ($online['status'] <= 0)
$txt.= " ".$user."##end##";
else
$txt.= " ".$this -> bot -> core("tools") -> chatcmd("Im interested in joining ".$this -> bot -> guildname, $user, "tell ".$user)."##end##";
$txt.= " :: ##GI_highlight##".$online['content']."\n";
}
}
$txt.= "\n##GI_red##Officers:##end##\n";
$users = $this -> bot -> core("settings") -> get("GuildInfo", "users");
$users = str_replace(" ", "", $users);
$users = explode(";", $users);
if(!empty($users))
{
foreach($users as $user)
{
$user = ucfirst(strtolower($user));
$online = $this -> bot -> core("online") -> get_online_state($user);
if ($online['status'] <= 0)
$txt.= " ".$user."##end##";
else
$txt.= " ".$this -> bot -> core("tools") -> chatcmd("Im interested in joining ".$this -> bot -> guildname, $user, "tell ".$user)."##end##";
$txt.= " :: ##GI_highlight##".$online['content']."\n";
}
}
Return ($this -> bot -> guildname." Info :: ".$this -> bot -> core("tools") -> make_blob("click to view", $txt));
}
/*
Still working on this, for now just some random debugging stuff I was trying
* /
function recruit()
{
$blob = "TDK is Recruiting!: '";
$blob.= $this -> info();
$blob.= " Playfield ID: ";
return $blob;
} */
}
?>
-
i just added the code that returns the info function data as blob, no idea why this isnt there in original code :p
-
getting a warning : wrong parameter count for explode() on line 40 giving ingame message of "broke plugin, recieved unhandled command"
-
fixed
-
ok, updated, but will have to try out the rest later, not liking aorc now, will wait until this evening when I get in game..thanks temar
-
ok temar, getting blank blobs when doing the ginfo.
-
my bad, change the last line of function info, so it used $txt not $info
and yes aorc doesnt like blank blobs :p
-
ok the blob is coming up now, so that is fixed. I've set the info up under "set guildinfo". The website displays fine...
then the problem comes in. Leader does not, neither does officers.
Second problem: somehow it is not recognizing the command arguments. It ignores the "members" or "classes" argument.
basically the blob as it works right now, looks like this:
Ascension Info:
Website: http://www.clan-ascension.org
Leader:
Offline :: Leyor
Officers:
Unknown :: Leyor
the guildinfo settings look like this:Settings for guildinfo
leader: Porta
Description: Users who should be Listed as Contacts under Leader seperated by ; eg user1;user2;user3
/tell shal9000 !set guildinfo leader <new value>
users: Sundragon2,Lillitheve,Troxxor,Ganerc
Description: Users who should be Listed as Contacts user Officers seperated by ; eg user1;user2;user3
/tell shal9000 !set guildinfo users <new value>
website: http://www.clan-ascension.org
Description: The Website that will be show in the Guild info blob
/tell shal9000 !set guildinfo website <new value>
-
Not , but ; in the settings I think.
-
yer i wasnt sure that !ginfo members and !ginfo classes would work as they were subcommand and i wasnt sure if they would work with command alias
i tried do it this was simple because
!ginfo members = !member list
!ginfo classes = !member
i will look into this now
-
the one for leader only had one name, so there was no "," or ";" and it still didn't display right. Will check the other two now
-
ok changed the "," to ";" and the blob now displays:
Ascension Info:
Website: http://www.clan-ascension.org
Leader:
Offline :: Leyor
Officers:
Offline :: Leyor
Unknown :: Leyor
Offline :: Leyor
Offline :: Leyor
Looks like the link part doesn't work, and it doesn't display the actual name....the unknown is actually the toon that is currently logged on while the rest on the list is, indeed, offline. So twofold...not displaying the actual names, and not getting the online status for those names correctly(the unknown factor) for the link to email for more information
-
ok all done, this time i testing and everything :D
BUT! you require the latest SVN copy for some things
the problem with the links going to bot instead of char has been fixed now
and i have added subcommand to comalias :D
-
ok, everything is working (other than the 12 page flood when doing ginfo members) Thanks temar. Now get to customize it..hehe...
-
ok one question temar, something I will want to try myself, if I can get a nudge in the right direction...how can I incorporate the "is online with <<alt>>" into the link?
-
i think u have to get the alt list and check them ur self in the module
$main = $this -> bot -> core("alts") -> main($name);
$alts = $this -> bot -> core("alts") -> get_alts($main);
then to your check on the main and alts
$main will just be the main char name
$alts will be an array containing the alts if any
-
ok, I'll try that, and see where I wind up..lol..thansk again for all your help today on this one
-
as long as u share the finished product so i can use too :p
-
ok, looking at the "is" module, I am not seeing an easy way of porting the information. So, I guess I will leave that to more experience 'grammers