Development > Coding and development discussion

Working on a new raidbot module

(1/1)

ZubZero:
I have completed all the !startraid <name>, !addpts <name>, !raidlock etc etc.
I am also working an !account command, so atm I am implementing logging onto the !addpts and !raid kick commands.
I have one little problem with the raid !kick commands if I dont write the reason in 8 words I get alot space like "(Reason: noob      )"

My raidscript is based of the original raidscript and the mercbot someone posted.

I can poste my code and see if someone else has a better way to do it.
How I call the function:

--- Code: ---
else if (preg_match("/^" . $this -> bot -> commpre . "raid kick (.+)$/i", $msg, $info))
$this -> kick_raid($name, $info[1]);

--- End code ---
The function itself.

--- Code: --- function kick_raid($name, $data)
{
$data = ucfirst(strtolower($data));
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
$var = explode(" ", $data);
$raiding = $this -> bot -> db -> query("SELECT * FROM " . $this -> bot -> get_tablename("raid_list") . " WHERE name = '" . $var[0] . "'");
  if (!empty($raiding))
  $this -> bot -> send_tell($name, "<font color=#ffff00>$var[0]</font> is not in the raid.");
  else
  {
   
  unset($this -> user[$who]);
  $this -> bot -> send_pgroup("<font color=#ffff00>" . $var[0] . "</font> was kicked from the raid. Reason = $var[1] $var[2] $var[3] $var[4] $var[5] $var[6] $var[7] $var[8] $var[9]");
  $this -> bot -> send_tell($var[0], "<font color=#ffff00>$name</font> kicked you from the raid. Reason = $var[1] $var[2] $var[3] $var[4] $var[5] $var[6] $var[7] $var[8] $var[9]");
  $this -> bot -> db -> query("DELETE FROM " . $this -> bot -> get_tablename("raid_list") . " WHERE name = '" . $var[0] . "'");
$this -> bot -> db -> query("UPDATE raid_points SET raiding = 0 WHERE id =" . $this -> points_to($var[0]));
    //$this -> bot -> db -> query("INSERT INTO " . $this -> bot -> get_tablename("raid_account") . " (name, history) VALUES ('" . $var[0] . "','Kicked from raid. (Reason: " . $var[1] $var[2] $var[3] $var[4] $var[5] $var[6] $var[7] $var[8] $var[9] . ") by " . $name . "')");
    $this -> bot -> db -> query("INSERT INTO " . $this -> bot -> get_tablename("raid_account") . " (name, history) VALUES ('" . $var[0] . "','Kicked from raid. (Reason: " . $var[1] . " " . $var[2] . " " . $var[3] . " " . $var[4] . " " . $var[5] . " " . $var[6] . " " . $var[7] . " " . $var[8] . " " . $var[9] . ") by lamer')");
  }
}
else
$this -> bot -> send_tell($name, "You must be a raid leader to do this");
}

--- End code ---

Wanuarmi:

--- Quote from: ZubZero on January 25, 2006, 11:27:13 pm ---
--- Code: ---
else if (preg_match("/^" . $this -> bot -> commpre . "raid kick (.+)$/i", $msg, $info))
$this -> kick_raid($name, $info[1]);

--- End code ---

--- End quote ---

else if (preg_match("/^" . $this -> bot -> commpre . "raid kick ([a-zA-Z0-9][a-zA-Z0-9]*) (.+)$/i", $msg, $info))
         return $this -> kick_raid($name, $info[1], $info[2]);

then you get two variables in the kick_raid() function, the name and the reason

this looks alot like the raid module im doing, why are you making another one, if I may ask :P

ZubZero:
Well I said it was based of your mercbot :P
I just want some similar stuff, I removed the add points out of your raiddone, I added a !addpts command that also logs to the raid_account file. so I can do !addpts APF or whatever. I also want alot of logging towards the raid_account like this raid kick.
I also want to redo the bid system since I need it to show how many points someone has bid. And I also want 2 different way of bidding, I want !bid 100 that makes you bid 100, and I want !bid +1 that makes you bid 1 over what has been bidden before. And I also want this to log to 2 different tables, the raid_account and a raid_auction.

As you might have guessed the raid_account will be used to display a log for someone using the !account command.

I also need to add !command and !announce.
Plus a bunch of aliases :P

Wanuarmi:
alreadythere just released another raid module based off mercbot
http://bebot.link/index.php/topic,313.0.html

mine isnt based on mercbot, its based on IGN bot, im planning on adding logging of raid kicks/auctions on account and an auction module to go with it, its just not finished yet

of course you can make all raid modules you want, I just wanted to know what was different from mine and why not use mine, to get some feedback

Navigation

[0] Message Index

Go to full version