Back Reply to topic
Chaly 
(started thread)
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
How to create your own plugins for Ragebot Posted: Post 01:44 Sun - Jun 22, 2008

How to write your own plugins..

At least you have to learn / know at least what PHP is...

Plugin types:
Name Trigger
====== ========
5000ms EVERY 5 seconds
buddy a buddy changes state from online to offline (afk is possible but ignored)
guild if we get a message in the guildchannel /gu
public your bots - character receives a message in a public channel (like 'Cimmeria')..
tell got a private tell


How to
======
Create a subdirectory in one of the directories mentioned above.
Create a file called "index.php" in your new subdirectory.
You're done. (No restart of your bot is needed)
Don't forget to let your index.php start with <?php ... zwinkern


Variables in a plugin that are
available without using "global"
Variables Description/Example
============ ===================
$pluginname ./guild/calc/index.php
$currentplugin ./guild/calc
$plugindirname ./guild
$pluginargs an array of the parameters of the last chatpaket
$pluginmessage the message.. if there was any
$pluginwords an array of the lowercase-message splitted by its spaces: "!calc 1+1 *7"=>array('!calc','1+1','*7)
$pluginchannel the name of the public channel where the message was received
$args array arguments of the chatpacket*


Usefull globals
(use with caution)
==================
$myguild guild's name of your bot
$channels array of public channels your bot listens to
$AOC AOcChat class
$admins array with the bot's admins

Useful functions
================
returns the name of a class
classname($classnumber)

Beautify the output! This produces a 3-way-colorfading (see bot_functions.php)
colortext($txt,$c1=array(200,10,200),$c2=array(220,240,200))

create a clickable link (no colors supported in $linkname..)
makelink($linkname,$linktext)


Talking
these functions produce entries
in the chatqueue to avoid spamming
==================================
tell
send_private_tell($user,$msg)
guild channel
send_guild_channel_message($msg)
public channel
send_public_channel_message($channel_name,$msg)
reply to the last message the bot received
send_reply($msg)
private channel (not supported by aoc yet?)
send_private_channel_message($channel_name,$msg)


*$args
is an array with numeric keys when inside a guild, public or tell-plugin
it is an array with the following keys when inside a buddy-plugin: status,playfield,level,class,name
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.


Last edited by Chaly on 10:53 Sun - Jul 13, 2008; edited 3 times in total
Chaly 
(started thread)
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 07:43 Mon - Jun 23, 2008

Maybe I didn't mention it eye-catching enough but..:
if you've created a working plugin and want to release your !kos, !diplomacy, !news, !whatever tools for other players, write me a short pm to
Host your plugin here!
(er.. hope thats eye-catching enough)

a note for your plugins:
please try to not replace the "standard" plugins, but make your own.
example:
you want to add !date to the time-plugin. it would be great if you write an additional plugin called "date-myname", copy&paste 99% of the standard time-plugin and
- change command !time to !date
- change the outputformat to "m/d/Y"
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
Back Reply to topic