collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Attempt of a recruition type script:  (Read 5628 times)

0 Members and 1 Guest are viewing this topic.

joey12344

  • Guest
Attempt of a recruition type script:
« on: June 30, 2006, 05:30:41 pm »
Code: [Select]
<?
    $shout = new shout($bot);

    $commands["tell"]["joinorg"] = &$shout;
    $commands["tellout"]["joinorg"] = &$shout;

    class shout
     {
       var $bot;
       function shout($bot)
      {
         $this -> bot = &$bot;
      }
 
       function tell($name)
       {
          if ( (preg_match("/^" . $this -> bot -> commpre . "shout (.+)$/i", $info)) )
      {
          $this -> spew ($name, $info[1], "gc");
      }
       }
   
       function tellout($name)
       {
          if ( (preg_match("/^" . $this -> bot -> commpre . "shout (.+)$/i", $info)) )
      {
          $this -> spew ($name, $info[1], "gc");
      }
       }
   
       function spew ($name, $where)
       {
          if ($this -> bot -> is_member($name))
      {
 
          $output = "<br>";
      $output .= "<font color=#ff0000>-------------------------</font>";
      $output .= "<font color=#ffff45>" . $name . " Wants to Join Barador Arin!! </font>";
      $output .= "<font color=#ffffc9>Click <a href='chatcmd:///tell $name'>Here</a> to send them a tell!";
      $output .= "<font color=#ff0000>-------------------------</font>";
      $output .= "<br>";
 
      switch ($where)
      {
          case "gc":
          $this -> bot -> send_gc($output);
      break;
      }
          }
       }
     }
?>

Thats the code for it , For some resaon it doesnt work when i type !joinorg to the bot , Any errors i made i would be greatful for , After all this is my first module :)

Thanks!

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: Attempt of a recruition type script:
« Reply #1 on: June 30, 2006, 11:10:47 pm »
Instead of flaming you (as I really really should) I'll tell you to...
1) Go read php tutorials on the web, google is Your friend!
2) Read up on how to code for BeBot, don't guess and code.
Too many toons.

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Attempt of a recruition type script:
« Reply #2 on: June 30, 2006, 11:28:41 pm »
Aww, you got off easy Joey, he usually always flames. ;P
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Blondengy

  • BeBot Creator and Founder
  • BeBot Hero
  • ******
  • Posts: 51
  • Karma: +0/-0
Re: Attempt of a recruition type script:
« Reply #3 on: July 01, 2006, 02:02:26 am »
I haven't toutched bebot code for over a year now but as far as I remember "tell2" handles tells from people who are not a member of the bot (not tell, like you're using). (This might have been changed in recent updates though - don't take my word for it, just check the code. ;))

You also registered the command as "!joinorg" but in the preg_match you're testing for "!shout" . Ofcause that'll always return false, since the tell function only gets called on "!joinorg". ;)

Third error: You're testing if the sender is a member of the guild ($this -> bot -> is_member($name)) but if he wants to join the guild, he'll definatly not be a member... ;)

Then you're calling "spew" with three diferent parameters ($name, $info[1] and "gc") but you only defined it with two ($name and $where).

On a little side note, you might want to change "Barador Arin" to the guild name stored in "$this -> bot" so that people who also want to use this module won't have to edit the sourcecode, just the config, which they'll have edited to suit their guildname anyway. ;)

Thats about all that I can find wrong with it at first sight. ;)
« Last Edit: July 01, 2006, 02:10:34 am by Blondengy »

joey12344

  • Guest
Re: Attempt of a recruition type script:
« Reply #4 on: July 01, 2006, 09:09:18 am »
Oh , ok :D I tried my best though

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 173
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal