ID:234854
 
Keywords: attributes, race
(See the best response by Flame Sage.)
hi i have a little problem i need to get a list that holds the race attributes so i can choose from a certain race at login and set my starting attributes at the same time.

race/dragonoid
var/power=10
var/defence=5... etc
but im not sure if i should make a variable for race a list or what any help would be apreciated but please keep it simple cuz im new at this and technical talk is hard for me to follow thank you.
Best response
This is where Object Oriented programming really shines.

You could do something like..
/mob/races/
var/power
var/defense
var/hp
proc/dosomething()
world << "I'm about to do something!"
..()
dragonoid
power = 15
defense = 20
hp = 5
dosomething()
..()
world << "I'm a dragonoid!"
lizard
power = 5
defense = 5
hp = 200
dosomething()
..()
world << "Lizards get squished."
del(src)


You can have procs that function completely differently based on what race they are.

This is one of the awesome features of OOP.
http://en.wikipedia.org/wiki/ Inheritance_(object-oriented_programming)
ok but actually i need to enter the variable as a list so that:

var/list/Races = list("dragonoid","elf")


mob

Login()
src.race = input(src, "What race shal you be?","race select")in Races

or similar will let me choose a race and add the variables to my mob on login. i just cant figure out how to make it so that if i choose elf or dragonoid the icon changes and life,defence,power, etc change... i know that a weapon would change my variables by coding a verb but can i make a verb list for choosing a race?? or somethin
You would want to do something like this...
src.race = input("What race shall you be?") in list("Dragonoid, "Elf")
switch(src.race)
if("Dragonoid")
// do something
In response to Flame Sage
Flame Sage wrote:
You would want to do something like this...
> src.race = input("What race shall you be?") in list("Dragonoid", "Elf")
> switch(src.race)
> if("Dragonoid")
> // do something
>


Fixed.
In response to Neimo
Didn't catch that, thanks.
The // do something should definitely be changing the client's mob into an instance of the race. The mob the user is logged into should only be a temporary one, possibly just for character creation.
thanks works great