ID:142229
 
Code:

    g
var/list/classlist = list("Fighter","Dark Mage","Spearman","Samurai")
var/cclass = input(src, "Pick a class","The Chronicles") in classlist
switch(cclass)
if("Dark Mage") switch(alert("Dark Mages use offensive magics but have low defense and go best with a light mage.","","Yes","No"))
if("Yes")src.newchar = new /mob/bright ()
else goto g
if("Fighter") switch(alert("Fighters use physical combat skills and have high health.","","Yes","No"))
if("Yes")src.newchar = new /mob/hero ()
else goto g
if("Spearman") switch(alert("Spearman have more powerful combat skills but have low critical hit rates and low health. It would be best to gather armor for this class for it is a power-house of destruction","","Yes","No"))
if("Yes")src.newchar = new /mob/spearman ()
else goto g
if("Samurai") switch(alert("Samurai penetrate defenses and have high critical hit rates. Samurai are amongst the few classes that can work well alone","","Yes","No"))
if("Yes")src.newchar = new /mob/samurai ()
else goto g
f
var/ccclass = input(src, "Pick a class for your partner","The Chronicles") in classlist
switch(ccclass)
if("Dark Mage") switch(alert("Dark Mages use offensive magics but have low defense and go best with a light mage.","","Yes","No"))
if("Yes")
var/mob/partner/P = new()
P.newchar = new /mob/bright ()
P.name = input(src, "What is your party members name.","")as text
newchar.name = input(src, "What is your party members name.","")as text
P = newchar
src.partyner = P
src.party += src.partyner
src.party.Add(src.partyner)
else goto f
if("Fighter") switch(alert("Fighters use physical combat skills and have high health.","","Yes","No"))
if("Yes")
var/mob/partner/P = new()
P.newchar = new /mob/hero ()
newchar.name = input(src, "What is your party members name.","")as text
P = newchar
src.partyner = P
src.party += src.partyner
src.party.Add(src.partyner)
else goto f
if("Spearman") switch(alert("Spearman have more powerful combat skills but have low critical hit rates and low health. It would be best to gather armor for this class for it is a power-house of destruction","","Yes","No"))
if("Yes")
var/mob/partner/P = new()
P.newchar =new /mob/spearman ()
newchar.name = input(src, "What is your party members name.","")as text
P = newchar
src.partyner = P
src.party += src.partyner
src.party.Add(src.partyner)
else goto f
if("Samurai") switch(alert("Samurai penetrate defenses and have high critical hit rates. Samurai are amongst the few classes that can work well alone","","Yes","No"))
if("Yes")
var/mob/partner/P = new()
P.newchar= new /mob/samurai ()
newchar.name = input(src, "What is your party members name.","")as text
P = newchar
src.partyner = P
src.party += src.partyner
src.party.Add(src.partyner)

else goto f
newchar.name = input(src,"What is your name?","The Chronicles")as text
newchar.logged = 1
new /item/potion (newchar) // start off with those
new /item/ether (newchar)
src.client.mob = newchar
src.party+=src.partyner
del(src)


Problem description:
I added a statpannel that tells me if I have a partymember or not but when i make a new character and add the party member it still stays null
You have a lot of repeated and unneeded stuff there. I'd advise you to take care of that problem and then take care of any error that may come.

Also, I wouldn't advise you to use "goto"
In response to Andre-g1
1 I am using goto
2 I repeated it so it would add it in different ways and if one worked I'd remove the otheres
In response to Choka
You shouldn't use goto. Unless you know what you're doing (which, if you're using it like this, you obviously don't), it inevitably results in spaghetti code. No one likes spaghetti code.
In response to Popisfizzy
...Spaghetti code?
In response to Choka
Choka wrote:
1 I am using goto

Like said, not a good idea. Sure, you don't have to listen to any of what we say - if you use it, then that's your problem. But I should point out that people will tend to bother to help less with with ugly, large, unreadable code, especially 'spaghetti code' (which is produced by using 'goto').

EDIT: 'Spaghetti code' basically means the code is a mess, eg like a salad. When reading it (or when the compiler runs it) the current point of execution runs all over the place, variably jumping to another point whenever you use goto. It's just a mess, especially compared to reading 'while(x)' then reading the code after it once - then you immediately get the complete picture of how the code works. With goto you need to read it multiple times (jumping with your eyes whenever the code jumps (or 'goes to' (in some languages 'goto' is just named 'jump')), basically, and even after you've read it enough times you'd probably need more to fully understand.
In response to Choka
In response to Kaioken
So....should i make a procedure instead....?
In response to Choka
Yes, you should use a for() or while() loop, which are structured and more properly made. They still basically get compiled the same as goto, but your source code itself isn't a mess and is easy to follow and work with.

Note that they're both quite interchangeable, you can use either for anything you like, pretty much, although one may be (merely) more convenient than the other in certain cases.
In response to Kaioken
Wait but can you answer the real question first why arent the party members being added to the list
In response to Choka
--Are you sure the thing you're adding has a proper value (isn't null, for instance)?
--Are you sure the portions of code which are doing the adding are getting executed (eg if they're under an if(), maybe it doesn't run)?
--Are you sure at that point, the list is properly initialized (you should get a runtime error if not)?

You should add debug messages to confirm all of those.