ID:1627723
 
Keywords: overlay
(See the best response by WSHGC.)
Code:)
mob
Login()
usr.name=input("Chose a nickname","Name") as text //Lets pick a name for you, shall we?
world << "[usr] has logged in!"
usr.race=input("Which race would you like to be?","race")in list("Demon","Human")
if("Human")
usr.Human = 1
usr.icon = 'Base Char.dmi'
usr.icon_state = ""
if("Demon")
usr.Demon = 1
usr.icon = 'Horned Demon.dmi'
usr.icon_state = ""
usr.class=input("Which class would you like to be?","class")in list("Swordmen","Boxer")
if("Swordmen")
usr.Swordmen = 1
usr.icon = 'Swordmen.dmi'
usr.icon_state = ""
if("Boxer")
usr.Boxer = 1
usr.icon = 'Boxer.dmi'
usr.icon_state = ""
usr.hair=input("Which hair would you like to have","hair")in list("Afro","None")
if("Afro")
usr.Afro = 1
overlays += 'hair.dmi'
icon_state = pick("Afro")
usr.loc=locate(1,1,1)
if("None")
usr.Afro = 0
usr.loc=locate(1,1,1)


Problem description:
when i click none it still shows afro

Same with swordmen
There's no switch() statement (in either input section) thus it evaluates and runs all if(TRUE) statement (TRUE = any value not 0, "" or null).

This means that all the if() statements are called (and you will see all those variables will be set to 1).

Solution: Remember to use switch()
In response to GhostAnime
GhostAnime wrote:
There's no switch() statement (in either input section) thus it evaluates and runs all if(TRUE) statement (TRUE = any value not 0, "" or null).

This means that all the if() statements are called (and you will see all those variables will be set to 1).

Solution: Remember to use switch() where do i use switch

In response to GhostAnime
where do i use switch
Did you look it up in the DM Reference yet? If not, do so.

You would place it after the input prior to those if() statements which have to be indented.

Also, why do you have two sets of race & hair variables? You have one that stores the choice chosen and an individual variable for each of those options; it's rather inefficient.
Character Creation.dm:6:error: missing expression
i dont know how to use the switch state ment i already looked in reference and i still dont understand
can you please just edit the code to how it should look like
That error doesn't help us if you do not show us what you did. As for using switch():
switch(var)
if(value1)
X
if(value2)
Y
else
Z


is akin to saying:
if(var == value1)
X
else if(var == value2)
Y
else
Z
mob
Login()
usr.name=input("Chose a nickname","Name") as text //Lets pick a name for you, shall we?
world << "[usr] has logged in!"
usr.race=input("Which race would you like to be?","race")in list("Demon","Human")
switch(usr.race)
if("Human")
usr.Human = 1
usr.icon = 'Base Char.dmi'
usr.icon_state = ""
if("Demon")
usr.Demon = 1
usr.icon = 'Horned Demon.dmi'
usr.icon_state = ""
usr.class=input("Which class would you like to be?","class")in list("Swordmen","Boxer")
switch(usr.class)
if("Swordmen")
usr.Swordmen = 1
usr.icon = 'Swordmen.dmi'
usr.icon_state = ""
if("Boxer")
usr.Boxer = 1
usr.icon = 'Boxer.dmi'
usr.icon_state = ""
usr.hair=input("Which hair would you like to have","hair")in list("Afro","None")
if("Afro")
usr.Afro = 1
overlays += 'hair.dmi'
icon_state = pick("Afro")
usr.loc=locate(1,1,1)
if("None")
usr.Afro = 0
usr.loc=locate(1,1,1)

i havent time to test, i think it will work
In response to Jkkkg
Jkkkg wrote:
> mob
> Login()
> usr.name=input("Chose a nickname","Name") as text //Lets pick a name for you, shall we?
> world << "[usr] has logged in!"
> usr.race=input("Which race would you like to be?","race")in list("Demon","Human")
> switch(usr.race)
> if("Human")
> usr.Human = 1
> usr.icon = 'Base Char.dmi'
> usr.icon_state = ""
> if("Demon")
> usr.Demon = 1
> usr.icon = 'Horned Demon.dmi'
> usr.icon_state = ""
> usr.class=input("Which class would you like to be?","class")in list("Swordmen","Boxer")
> switch(usr.class)
> if("Swordmen")
> usr.Swordmen = 1
> usr.icon = 'Swordmen.dmi'
> usr.icon_state = ""
> if("Boxer")
> usr.Boxer = 1
> usr.icon = 'Boxer.dmi'
> usr.icon_state = ""
> usr.hair=input("Which hair would you like to have","hair")in list("Afro","None")
> if("Afro")
> usr.Afro = 1
> overlays += 'hair.dmi'
> icon_state = pick("Afro")
> usr.loc=locate(1,1,1)
> if("None")
> usr.Afro = 0
> usr.loc=locate(1,1,1)
>

i havent time to test, i think it will work


Character Creation.dm:19:error: =: expected "if" or "else"
Character Creation.dm:20:error: =: expected code block
Character Creation.dm:33:error: =: expected "if" or "else"
Character Creation.dm:20:warning: usr.icon_state: statement has no effect
Character Creation.dm:20:warning: "": statement has no effect
Divine Youkai.dmb - 3 errors, 2 warnings

In response to YoungJR1232
You shouldn't blindly copy and paste code examples from the forums. The snippet presented is also full of indention errors.
mob
Login()
usr.name=input("Chose a nickname","Name") as text //Lets pick a name for you, shall we?
world << "[usr] has logged in!"
switch(usr.race=input("Which race would you like to be?","race")in list("Demon","Human"))
if("Human")
usr.icon = 'Base Char.dmi'
usr.icon_state = ""
if("Demon")
usr.icon = 'Horned Demon.dmi'
usr.icon_state = ""
switch(usr.class=input("Which class would you like to be?","class")in list("Swordmen","Boxer"))
if("Swordmen")
usr.icon = 'Swordmen.dmi'
usr.icon_state = ""
if("Boxer")
usr.icon = 'Boxer.dmi'
usr.icon_state = ""
switch(usr.hair=input("Which hair would you like to have","hair")in list("Afro","None"))
if("Afro")
overlays += 'hair.dmi'
icon_state = pick("Afro")
usr.loc=locate(1,1,1)
if("None")
usr.loc=locate(1,1,1)
i changed code to this but i got this error Character Creation.dm:5:error: : invalid expression
In response to YoungJR1232
The switch statements shouldn't be tabbed over; they should be the same indention level as the two lines at the start of the Login() function.

Also you have a wayward usr.loc=locate(1,1,1) in your switch statements, which is an invalid expression.
............ you guys got me confused on what i need to do
What you need to do is go over DM guide again. These things are pretty basic and seeing you struggling over indentation issues is just..(speechless)
mob
Login()
usr.name=input("Chose a nickname","Name") as text //Lets pick a name for you, shall we?
world << "[usr] has logged in!"
usr.race=input("Which race would you like to be?","race")in list("Demon","Human")
switch(usr.race)
if("Demon")
usr.icon = 'Horned Demon.dmi'
usr.icon_state = ""
if("Human")
usr.icon = 'Base Char.dmi'
usr.icon_state = ""
usr.class=input("Which class would you like to be?","class")in list("Swordmen","Boxer")
switch(usr.class)
if("Swordmen")
usr.Swordmen = 1
usr.icon = 'Swordmen.dmi'
usr.icon_state = "Mob"
if("Boxer")
usr.Boxer = 1
usr.icon = 'Boxer.dmi'
usr.icon_state = ""
usr.hair=input("Which hair would you like to have","hair")in list("Afro","None")
if("Afro")
usr.Afro = 1
overlays += 'hair.dmi'
icon_state = pick("Afro")
usr.loc=locate(1,1,1)
if("None")
usr.Afro = 0
usr.loc=locate(1,1,1)
thnx for all your help it works now
No it doesn't.. Your indentation is all messed up...
Page: 1 2