ID:261820
 
Alright, I got a problem. I was told it probably can't be answered by Camaro, but I can't understand what the problem is, so I'll post it here anyway.

I'm trying to make it so that when you open up, it asks you for your name and job class. Here's the code:

..()
usr.name = input("What is your name?","Name Your Character")

var/icon = input("Which Job Class will you choose?","Choose Your Job Class")in list("Black Mage","Fighter","Monk")
switch(icon)

if("Black Mage")
usr.icon = 'blackmage.dmi'
if("Fighter")
usr.icon = 'fighter.dmi'
if("Monk")
usr.icon = 'monk.dmi'



(I tried to make the indents good, they get screwed up when I paste the code in)

Now, the problem is.. Well, it just doesn't do what you choose. If you choose Black Mage, it'll be a Fighter, if I choose the Fighter, it'll be invisible, and if I choose Monk it'll be fighter. It's just all screwed up. And yeah, I have all the dmi name states and all that stuff right. Is there something wrong with the code? Help would be appreciated.. Thanks.
Didn't you already make a thread about this? And the question was answered. In fact, I distinctly remember answering it myself. As you're obviously far too lazy to read anything you're told, I'll say it yet again:

"icon" is already a var. You don't want to use "icon". Call it "class" instead, like THIS...

var/class = input("Which Job Class will you choose?","Choose Your Job Class")in list("Black Mage","Fighter","Monk")
switch(class)

(Changes highlighted in bold.)

There. Now actually take the advice you're given, for once! I'm not answering the same question for a third time.
In response to Crispy
I'm a bit offended. Don't you go back to check the replies to your answers?

Author: Rockin' Eli
Date: 8/12/03 1:31 am
Topic: Re: Switch Errors.. Makes No Sense.
Post [link]
Parent [link]
Next [link]


I appreciate your answer, even though that didn't do anything.

:'(

And I figured since it didn't seem like such a newbie question considering noone could help, I thought I'd give it a try in here.. Sorry.

Oh, and now I get these warnings, to add to my troubles/misery.

Logging In stuffs.dm:43::warning: empty switch statement
Logging In stuffs.dm:45:if :warning: if statement has no effect
In response to Rockin' Eli
Okay, sorry. I didn't remember about those replies, and as you hadn't actually made the changes that were recommended (as far as I could see, at least) then I assumed that my advice had got lost in the small flood of nonsense and bad advice on that thread.

The warnings are clues. Are you sure your indentation is correct? All of those if()s should be indented once past the level of the switch().
In response to Crispy
Ah, well, sorry, I didn't change it 'cause it didn't have an effect, I will, though.

And that got rid of he one warning when I redid the indents, now it's just

Logging In stuffs.dm:45:if :warning: if statement has no effect

Which is the line with:

if("Fighter")

If it has no effect.. What's that mean? Should I be using else?
You need to show more of the proc here--the whole proc, not this snippet of it.

From what you said I take it this is a Login() proc. If so, then you need to remember two things:

  • Tread carefully with usr. It's only semi-safe here, and in most procs not safe at all. (Don't use it in Logout().)
  • Don't call ..() in a character creation login; the regular mob/Login() should handle the characters themselves (and usr won't be safe there anymore), not the character selection/creation prompt.

    Lummox JR
In response to Lummox JR
All of the proc() code? This IS all of it, at least for this switch alert class job choice selection thing. The rest is other stuff. But, uh, the src didn't do anything either. Should I give them name states? Right now I made sure that they didn't have anything. And I dunno, is that input supposed to be there? This isn't exactly input since they're selecting it from a list, is it?
In response to Rockin' Eli
Rockin' Eli wrote:
All of the proc() code? This IS all of it, at least for this switch alert class job choice selection thing. The rest is other stuff.

What part of "all" wasn't clear?

What's at least important is the proc declaration, that says it's actually a proc. You can't afford to leave that out when asking for help; it's often useful to know.

Lummox JR