DragonPrime - LoGD Resource Community

Game Administration, Installation and Configuration => Game Administration Chat => Topic started by: Spider on December 22, 2004, 08:12:35 AM



Title: finding installed specialties
Post by: Spider 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.


Title: Re:finding installed specialties
Post by: Kendaer 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



Title: Re:finding installed specialties
Post by: Spider 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 :)


Title: Re:finding installed specialties
Post by: Kendaer on December 22, 2004, 10:12:24 AM
Updated my reply with a bit more info :)

© 2017 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines