ID:145885
 
I am having a problem with my character creation code and here it is below

switch(pRace)
if ("krillin")
new_mob = new /mob/characters/male()
new_mob.icon = 'saiyan.dmi'
new_mob.mpowerlevel = rand(1,120)
new_mob.powerlevel = new_mob.mpowerlevel
if ("pam")
new_mob = new /mob/characters/female()
new_mob.icon = 'female2.dmi'
new_mob.mpowerlevel = rand(1,120)
new_mob.powerlevel = new_mob.mpowerlevel
if ("goku")
new_mob = new /mob/characters/saiyan()
new_mob.icon = 'saiyan.dmi'
new_mob.mpowerlevel = rand(1,120)
new_mob.powerlevel = new_mob.mpowerlevel
if ("gohan")
new_mob = new /mob/characters/gohan()
new_mob.icon = 'halfsaiyan.dmi'
new_mob.mpowerlevel = rand(1,120)
new_mob.powerlevel = new_mob.mpowerlevel
if ("piccolo")
new_mob = new /mob/characters/piccolo()
new_mob.icon = 'NewNamek.dmi'
new_mob.mpowerlevel = rand(1,120)
new_mob.powerlevel = new_mob.mpowerlevel
if ("Cell")
new_mob = new /mob/Biologicalcell()
new_mob.icon = 'Celltype.dmi'
new_mob.mpowerlevel = rand(1,120)
new_mob.powerlevel = new_mob.powerlevel


now i get these errors
newcharhandling4.dm:55:pRace :warning: variable defined but not used
newcharhandling4.dm:57:error:pRace:value not allowed here
newcharhandling4.dm:58:error:"krillin":duplicate definition
newcharhandling4.dm:63:error:"pam":duplicate definition
newcharhandling4.dm:68:error:"goku":duplicate definition
newcharhandling4.dm:73:error:"gohan":duplicate definition
newcharhandling4.dm:78:error:"piccolo":duplicate definition
newcharhandling4.dm:83:error:"Cell":duplicate definition
newcharhandling4.dm:59:error:new_mob:undefined var
newcharhandling4.dm:60:error:new_mob.icon:undefined var
newcharhandling4.dm:61:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:62:error:new_mob.powerlevel:undefined var
newcharhandling4.dm:62:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:59:error::duplicate definition
newcharhandling4.dm:64:error:new_mob:undefined var
newcharhandling4.dm:65:error:new_mob.icon:undefined var
newcharhandling4.dm:66:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:67:error:new_mob.powerlevel:undefined var
newcharhandling4.dm:67:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:64:error::duplicate definition
newcharhandling4.dm:69:error:new_mob:undefined var
newcharhandling4.dm:70:error:new_mob.icon:undefined var
newcharhandling4.dm:71:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:72:error:new_mob.powerlevel:undefined var
newcharhandling4.dm:72:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:69:error::duplicate definition
newcharhandling4.dm:74:error:new_mob:undefined var
newcharhandling4.dm:74:error:/mob/characters/gohan:undefined type path
newcharhandling4.dm:75:error:new_mob.icon:undefined var
newcharhandling4.dm:76:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:77:error:new_mob.powerlevel:undefined var
newcharhandling4.dm:77:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:74:error::duplicate definition
newcharhandling4.dm:79:error:new_mob:undefined var
newcharhandling4.dm:79:error:/mob/characters/ piccolo:undefined type path
newcharhandling4.dm:80:error:new_mob.icon:undefined var
newcharhandling4.dm:80:error:'NewNamek.dmi':cannot find file
newcharhandling4.dm:81:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:82:error:new_mob.powerlevel:undefined var
newcharhandling4.dm:82:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:79:error::duplicate definition
newcharhandling4.dm:84:error:new_mob:undefined var
newcharhandling4.dm:84:error:/mob/Biologicalcell:undefined type path
newcharhandling4.dm:85:error:new_mob.icon:undefined var
newcharhandling4.dm:85:error:'Celltype.dmi':cannot find file
newcharhandling4.dm:86:error:new_mob.mpowerlevel:undefined var
newcharhandling4.dm:87:error:new_mob.powerlevel:undefined var
newcharhandling4.dm:87:error:new_mob.powerlevel:undefined var
newcharhandling4.dm:84:error::duplicate definition
newcharhandling4.dm:58:error::empty type name (indentation error?)


With the powerlevel and mpowerlevel bit i have it defined here

mob/var/new_mob
mob/var/powerlevel
mob/var/mpowerlevel
mob/var/race


But that doesnt seem to define it as a varable can anyone give me a hand here please
Well you shouldn't be getting duplicate definition errors from a text string, so something is massively frelled up in your code. Either that, or you made some changes between your actual code and what you posted; that'd be a dumb idea but lots of people have done it before.

Of course, without seeing the whole proc, and likely enough the one that preceded it as well (since I'm thinking this has to be a syntax error), we'll never know what the problem is. With this particular kind of error, the snippet where the error appears is only half the problem.

I'd wager good money you have an indentation error that's causing all these problems. First check: Hit Ctrl+T in Dream Maker and check to see you haven't mixed tabs and spaces, which is even likelier a problem when you start off with ripped code. Then be sure switch() is actually indented to the right level.

Lummox JR