TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-16-2010, 12:14 AM   #1 (permalink)
The Contributor
 
nefus's Avatar
 
Join Date: Nov 2007
Location: Nashville, TN
Posts: 66
Thanks: 20
nefus is on a distinguished road
Help rq character generator functions

Hey gang, I tried to ask this question probably two months ago but I know for a fact that my question probably made no sense at all. So here I go again for try number 2.

I'd like to build a basic character generator that allows players to make a few selections and build a character or npc for their runequest game. For those who care, I'm using the MRQ2 edition.

As a person with limited programming ability I'd like to build functions for things like Common Skill Bonuses. Let me give you two examples from the book.

Barbarian: +30% to Culture(Own) and Lore(Regional). +10% to Athletics and Resilience. +5% to Brawn, Perception, Ride and Stealth.

Now... that seems pretty straight forward until you look at one of the other common skill selections like this one from Nomads: 10% to either Brawn, Drive, Ride or Swim.

Like Barbarians, the Nomads have a few free skill bonuses and then you are forced to make a selection to top it off.

As a neophyte programmer I might try something like this for the Barbarian.

Code:
function barbarian_skills_one(){
    $background = array("Culture(Own)"=>'30', "Lore(Regional)"=>'30', 
    "Resilience"=>'10', "Athletics"=>'10', "Brawn"=>'5', "Perception"=>'5', 
    "Stealth"=>'5', "Ride"=>'5');
    return $background;
        }
How would I add the selection to the function? Should I add a special variable in the function that I look for to see if there is a second function that has selections in it? Should I wave a dead chicken over my keyboard and hope for some fancy voodoo?
__________________
I am not a programmer, nor do I play one on tv.
nefus is offline  
Reply With Quote
Old 02-26-2010, 10:20 AM   #2 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

In php5, you can just change the function you use to call it.

PHP Code:
foreach ($barbarian as &$barb) {
    if (
$barb['strength'] != NULL){
       
chooseAttribute('strength');

__________________
Signatures are nothing but incriminating.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 02-26-2010, 03:31 PM   #3 (permalink)
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default

Quote:
Originally Posted by nefus View Post
I know for a fact that my question probably made no sense at all
Hmmm that's contradicting.....
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
8 Practical PHP Regular Expressions Matt83 Advanced PHP Programming 54 01-29-2013 12:07 PM
Simple character problem ? CΛSTΞX General 4 02-04-2010 04:37 PM
Mysql Character Sets captainmerton MySQL & Databases 0 11-11-2009 10:24 AM
Accessing data in protected and private properties Kalle Tips & Tricks 3 09-12-2008 11:59 PM
International Character Support aristoworks MySQL & Databases 4 11-29-2007 09:36 PM


All times are GMT. The time now is 10:44 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design