DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • April 21, 2019, 07:10:54 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Resource Pages

Pages: [1]   Go Down
Author Topic: finding installed specialties  (Read 3660 times)
0 Members and 1 Guest are viewing this topic.
« on: December 22, 2004, 08:12:35 AM »

I want to be able to come up with a list of every specialty installed in one of my modules, and whilst I can see from the specialty modules that there is a specialtyname hook which would get me somewhere, I don't see any way of working out how many specialties are actually installed.  Only how to get which specialty the user has.

Any ideas would be good.
« Reply #1 on: December 22, 2004, 10:07:22 AM »

$specialties = modulehook("specialtynames");

// the following line tells you how many are *ACTIVATED* as set
// up above.
// If you have a specialty installed but not active but want to count
// them instead of just the activated ones, you need to do
// $specialties = modulehook("specialtynames", array(), true)
// which tells it to run the hooks even on deactivated modules.
$nSpec = count($specialties);

// Iterate over the specialties.
foreach ($specialties as $key=>$name) {
     // $key here is the short key for the specialty (what would be stored in
     // $session['user']['specialty']) IE, DA or TS or MP
     // $name here is the already translated name of the specialty.

You could have found out most of this information by looking at the Inn where players can choose a new specialty after bribing Cedrik, or from the user editor where it lists the specialities and allows the admin to change the users specialty.

Finding the length of an array (the number of elements) is basic PHP, and if you don't know this you should spend a LOT of time reading the documentation on PHP from http://php.net

« Last Edit: December 22, 2004, 10:10:59 AM by Kendaer » Logged
« Reply #2 on: December 22, 2004, 10:09:45 AM »

you're most definately right, I should have been able to work that out myself.  combination or laziness and lack of php practice I guess.

sorry Smiley
« Reply #3 on: December 22, 2004, 10:12:24 AM »

Updated my reply with a bit more info Smiley
Pages: [1]   Go Up
Jump to:  

DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
106 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search