1. Requirements
  2. Installation
  3. Functions
  4. Usage
  5. Examples
  6. MediaWiki Extension

Requirements

All that is required to use the DRCSL is a normal PHP 5 installation. This installation needs to have cURL turned on to do the fetching. Also, the current version uses UNIXy paths so until that's changed Windows servers may not work.

Top

Installation

Installation of DRCSL is rather easy. Download the latest release, unzip it inside the folder you want your character viewer in (bearing in mind that the zip doesnt' contain an internal folder) and do a simple include() or require_once() of drcsl.php.
The result of unzipping will give you the class files (such as Character.php) inside your working directory, the config/include file (drcsl.php), as well as an example viewer (character_example.php) that you can edit however you want. drcsl.php is the file to edit for any configuration changes (in the future), and to include since it includes all required classes.

Top

Functions

System Functions

"Setter" Functions

"Getter" Functions

  • get_char_attribute($attr)
  • get_char_bonus($attr)
  • get_char_defense()
  • get_char_info($type)
  • get_char_item($slot)
  • get_char_resist($attr)
  • get_char_skill($slot)
  • get_char_weapon($hand)

"Cheat" Functions

  • get_char_skills()
  • get_char_items()
  • get_char_bonuses()
  • get_char_resistances()
Top

Usage

Basic usage involves including drcsl.php, creating a new Character, then displaying information from it. No cleanup is required.

<?php
    include("drcsl.php");
    $billy = new Character("Segfault");
    echo $billy->get_char_info('Name');
?>
                

Top

Examples

Basic usage example, as shown above.

<?php
    include("drcsl.php");
    $billy = new Character("Segfault");
    echo $billy->get_char_info('Name');
?>
                
Output: Segfault

Printing the names of a character's items.

<?php
    include("drcsl.php");
    $billy = new Character("Segfault");
    foreach($billy->get_char_items() as $item) {
        echo "$item[Name]<br />";
    }
?>
                
Output:

Fatal error: Cannot use object of type Item as array in /home/.empire/snarky/threeplanetssoftware.com/software/php_dr_library/documentation.php on line 216