i'm trying to make it so that whenever someone logs in they can choose their job. can someone review this code?
mob
worker
client/New()
var/J
J = input("What job would you like to have?" in list("Construction","Metro"))
loc = locate(1,1,1)
icon = 'worker.dmi'
icon_state = J
ID:176939
Nov 26 2002, 8:31 am
|
|
Nov 26 2002, 8:43 am
|
|
sorry, i didn't write the problem. The problem is that the login listbox in which i'm supposed to choose a job does not show up.
|
In response to Delita12345
|
|
well........ i dont really know but try this,it works for me. itll be in the next post
|
var/list/classes = list("Whatever", "Whatever")
help_text = "Which person would you like to be?" default_value = "Leahcim" var/char_class = input(src, help_text, prompt_title, default_value) in classes // Okay we have enough information, so it's time to create the character and switch the player to it. var/mob/new_mob switch(char_class) if ("Whatever") whatever you need |
oops dang cat....... well thats 1 way of doing it...... if you want it on Login() tell me
|
In response to Leahcim
|
|
it's still not working. help.
mob worker icon = 'worker.dmi' client/New() var/list/classes = list("Construction", "Metro") help_text = "Which person would you like to be?" default_value = "Leahcim" var/char_class = input(src, help_text, prompt_title, default_value) in classes /* var/J J = input("What job would you like to have?" in list("Construction","Metro")) loc = locate(1,1,1) icon_state = J */ var/mob/new_mob switch(char_class) if ("Construction") icon_state = "Construction" if ("Metro") icon_state = "Metro" loading Rokenbok.dme Rokenbok.dm:15:error:help_text:undefined var Rokenbok.dm:16:error:default_value:undefined var Rokenbok.dm:17:error:src:undefined var Rokenbok.dm:17:error:help_text:undefined var Rokenbok.dm:17:error:prompt_title:undefined var Rokenbok.dm:17:error:default_value:undefined var Rokenbok.dm:17:error:classes:invalid variable Rokenbok.dm:17:error:= :expected a constant expression Rokenbok.dm:24:error:char_class:value not allowed here Rokenbok.dm:25:error::duplicate definition Rokenbok.dm:25:error:"Construction":duplicate definition Rokenbok.dm:26:error:"Metro":duplicate definition Rokenbok.dm:25:error::duplicate definition Rokenbok.dm:26:error::duplicate definition Rokenbok.dmb - 14 errors, 0 warnings (double-click on an error to jump to it) |
Delita12345 wrote:
i'm trying to make it so that whenever someone logs in they can choose their job. can someone review this code? *that line is your problem, it should be: J = input("What job would you like to have?") in list("Construction","Metro") You need to close the parenthesis completely after the input(), then put the in list() |
Ok, Im pretty sure that you want to use mob/worker/New() not mob/worker/client/New().
-DogMan |
In response to Delita12345
|
|
That would be an indentation error. Indent everything after Login().
|
In response to Dog Man
|
|
And I think you'd have to set the default mob to mob/worker. I'm not sure, I never use different sub-types of mobs.
<code> world mob = /mob/worker </code> |
In response to OneFishDown
|
|
Yeah. Youd need to make sure that any new client became a worker, not just a mob.
-DogMan |
In response to OneFishDown
|
|
OK, i put in the correction you gave me and there are no more errors, but it still doesn't bring up the menu!
|
In response to Delita12345
|
|
Go read my posts and dog man's posts. When you login you are a mob, just a plain old mob. The code you have is for when a new mob/worker is made.
|
In response to OneFishDown
|
|
So instead of this:
mob worker New() var/J J = input("What job would you like to have?") in list("Construction","Metro") icon = 'worker.dmi' icon_state = J I have this: mob New() var/J J = input("What job would you like to have?") in list("Construction","Metro") worker icon = 'worker.dmi' icon_state = J Right? |
In response to Delita12345
|
|
Delita12345 wrote:
So instead of this: The first will work fine if you add: world -DogMan |
In response to Dog Man
|
|
I already had that. and now it says: "error:J:invalid variable" right here with the *
mob var/J New() J = input("What job would you like to have?") in list("Construction","Metro") worker icon = 'worker.dmi' *icon_state = J |
In response to Delita12345
|
|
That is because J is not a constant.
|
In response to Delita12345
|
|
Use the first one I had in the quote, not the second.
-DogMan |