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.
TopInstallation
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.
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()
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');
?>
Examples
Basic usage example, as shown above.
Output:
Segfault
<?php
include("drcsl.php");
$billy = new Character("Segfault");
echo $billy->get_char_info('Name');
?>
Printing the names of a character's items.
Output:
<?php
include("drcsl.php");
$billy = new Character("Segfault");
foreach($billy->get_char_items() as $item) {
echo "$item[Name]<br />";
}
?>
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