ID:261263
 
I'm trying to give the usr in my game the option to choose his/her alignment when they login. I can do this part just fine, but I can't make it so that whichever alignment they choose, shows up in their stat panel. Here's what I have.

mob/Login()
switch(input("What is your alignment?","Alignment")in list("Good",Evil","Neutral"))
if("Good")
src.Alignment = "Good"
if("Neutral")
src.Alignment = "Neutral"
if("Evil")
src.Alignment = "Evil"

Now, here's my stat code.

mob
Stat()
stat("Alignment","[src.Alignment]")

Then when I run my game, there is nothing in my statpanel. What am I doing wrong?

Thank you,

-_-THe Wizard of How-_-
You never called statpanel(), hehe.
The Wizard of How wrote:
I'm trying to give the usr in my game the option to choose his/her alignment when they login. I can do this part just fine, but I can't make it so that whichever alignment they choose, shows up in their stat panel. Here's what I have.

mob/Login()
switch(input("What is your alignment?","Alignment")in list("Good",Evil","Neutral"))
if("Good")
src.Alignment = "Good"
if("Neutral")
src.Alignment = "Neutral"
if("Evil")
src.Alignment = "Evil"

Now, here's my stat code.

Ok heres the problem, the src part makes it so nothing happens, Im not quite sure why, but that isnt important anyway in this case, instead make it this:
mob/Login()
switch(input("What is your alignment?","Alignment")in list("Good",Evil","Neutral"))
if("Good")
usr.Alignment = "Good"
if("Neutral")
usr.Alignment = "Neutral"
This makes it so it defines the person's alignment being the user who is logging in.
if("Evil")
usre.Alignment = "Evil"
In response to Geo
Geo...Geo..Geo, come on I know you better than to not see what was really wrong in that code, Login() is a proc hence src should be used, look over his code a little more.
In response to Nadrew
Well...this may be true Nadrew, but I did call it in my coding. I just retyped it in the forum because I felt like typing it instead of Copying and pasting.....that'll teach me eh?
In response to Nadrew
Nadrew wrote:
Geo...Geo..Geo, come on I know you better than to not see what was really wrong in that code, Login() is a proc hence src should be used, look over his code a little more.

Nadrew, nadre, nadrew. I have tried using src many times in my login codes and all of it made the login go down the drain. I use the usr allot more and it always seems to work.
In response to Geo
Geo wrote:
Nadrew wrote:
Geo...Geo..Geo, come on I know you better than to not see what was really wrong in that code, Login() is a proc hence src should be used, look over his code a little more.

Nadrew, nadre, nadrew. I have tried using src many times in my login codes and all of it made the login go down the drain. I use the usr allot more and it always seems to work.


I use src alot and it works fine, it's about time for Deadron to come up with a "Evil usr!!!" post in this thread.
In response to Nadrew
Just for your info Geo, usr did not work in this case. I guess my world will have to be full of good.
After fixing the indentation and adding the " before Evil the code worked perfectly fine and did display alignment.
In response to Theodis
Theodis. I know I should have said something when I posted the first time, but I didn't think it would matter, but That's not how it looks in MY coding. I just decided not to put the unecessary stuff in there, so instead of copying and pasting, I just typed it, I thought I didn't make any mistakes, but I did I guess..whoops !_!
Does your stat panel look like the one I put in my first post, aside from the fact that mine is missing the statpanel()?
In response to The Wizard of How
The Wizard of How wrote:
Theodis. I know I should have said something when I posted the first time, but I didn't think it would matter, but That's not how it looks in MY coding. I just decided not to put the unecessary stuff in there, so instead of copying and pasting, I just typed it, I thought I didn't make any mistakes, but I did I guess..whoops !_!
Does your stat panel look like the one I put in my first post, aside from the fact that mine is missing the statpanel()?

I cut and pasted the code to a new environment. I then fixed the indentation and added the one missing quote. Thats all I did so the code you posted works other than having a slight syntax error. So if you're having problems you didn't post all the relavent source code.
As Theodis pointed out, the error is not in the code you posted above. This means that it is not the first Login() to be called, and will never be called due to lack of ..()'s, heh. Stick a ..() in the start of that Login(), and any other part of your code or included files which have mob/Login() in it.

In any case, stick a world << "Login called" in it to make sure it gets called if it doesnt work.

Alathon
In response to Nadrew
Nadrew wrote:
You never called statpanel(), hehe.

You don't have to call statpanel() in the Stat() proc. If you never call statpanel(), the stats will be displayed in a default statpanel called "Stats".
In response to Geo
Geo wrote:
Nadrew wrote:
Geo...Geo..Geo, come on I know you better than to not see what was really wrong in that code, Login() is a proc hence src should be used, look over his code a little more.

Nadrew, nadre, nadrew. I have tried using src many times in my login codes and all of it made the login go down the drain. I use the usr allot more and it always seems to work.

Src is indeed correct, Geo. Usr is only valid for verbs.

I'd guess your Login procs go down the toilet for completely different reasons, possibly including the same reason (not calling ..() first) WOH has had so much trouble.

Lummox JR