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:
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 176: parser error : Entity 'nbsp' not defined in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: &nbsp; in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 221: parser error : Entity 'copy' not defined in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: <p class="copyright">&copy; 2010 NC Interactive, Inc. All rights reserved. All in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 222: parser error : Opening and ending tag mismatch: p line 175 and div in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: </div> in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 245: parser error : Opening and ending tag mismatch: div line 65 and body in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: </body> in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 246: parser error : Opening and ending tag mismatch: body line 64 and html in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: </html> in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 248: parser error : Premature end of data in tag html line 2 in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php:510 Stack trace: #0 /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php(510): SimpleXMLElement->__construct('<!DOCTYPE html ...') #1 /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php(466): Character->fetch_character_curl('Segfault') #2 /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php(37): Character->fetch_character('Segfault') #3 /home/snarky/threeplanetssoftware.com/software/php_dr_library/documentation.php(196): Character->__construct('Segfault') #4 {main} thrown in /home/snarky/threeplanetssoftware.com/software/php_dr_library/Character.php on line 510