ID:150825
 
var/g = input("Your Gender?","Gender") in list("Male","Female")
switch(g)
if("Male")
var/i = input("Choose a model.","Icon") in list("Alien","Human")
switch(i)
if("Alien")
icon = 'models.dmi'
icon_state = "malien"
if("Human")
icon = 'models.dmi'
icon_state = "male"
if("Female")
switch(i)
var/i = input("Choose a model.","Model") in list("Alien","Human")
if("Alien")
icon = 'models.dmi'
icon_state = "falien"
if("Human")
icon = 'models.dmi'
icon_state = "female"

I am trying to get the code here to let a player select a gender, then depending on male or female a new list pops up asking what icon.. whats wrong with this?
Thanx for your time.
First off, what errors are you getting? I'll read it over again to see if I can see anything by eye..
if("Alien")
icon = 'models.dmi'
icon_state = "falien"
if("Human")
icon = 'models.dmi'
icon_state = "female"

Shouldn't these, and the male counterpart, be indented?

if("Human")
icon = 'models.dmi'
icon_state = "female"

Do this for the alien and male human/alien as well. I beleive this should work.
In response to Vortezz
On 7/21/01 3:45 pm Vortezz wrote:
First off, what errors are you getting? I'll read it over again to see if I can see anything by eye..

War of Words.dm:20:error:= :expected "if" or "else"
War of Words.dm:21:error:= :expected code block
War of Words.dm:23:error:= :expected "if" or "else"
War of Words.dm:24:error:= :expected code block
War of Words.dm:21:icon_state:warning: statement has no effect
War of Words.dm:21:"malien":warning: statement has no effect
War of Words.dm:24:icon_state:warning: statement has no effect
War of Words.dm:24:"male":warning: statement has no effect
War of Words.dm:29:error:= :expected "if" or "else"
War of Words.dm:30:error:= :expected code block
War of Words.dm:32:error:= :expected "if" or "else"
War of Words.dm:33:error:= :expected code block
War of Words.dm:30:icon_state:warning: statement has no effect
War of Words.dm:30:"falien":warning: statement has no effect
War of Words.dm:33:icon_state:warning: statement has no effect
War of Words.dm:33:"female":warning: statement has no effect

War of Words.dmb - 8 errors, 8 warnings
In response to Vortezz
On 7/21/01 3:47 pm Vortezz wrote:
if("Alien")
icon = 'models.dmi'
icon_state = "falien"
if("Human")
icon = 'models.dmi'
icon_state = "female"

Shouldn't these, and the male counterpart, be indented?

if("Human")
icon = 'models.dmi'
icon_state = "female"

Do this for the alien and male human/alien as well. I beleive this should work.

lol, ok forgot about that :) Thanx.
In response to Vortezz
On 7/21/01 3:47 pm Vortezz wrote:
if("Alien")
icon = 'models.dmi'
icon_state = "falien"
if("Human")
icon = 'models.dmi'
icon_state = "female"

Shouldn't these, and the male counterpart, be indented?

if("Human")
icon = 'models.dmi'
icon_state = "female"

Do this for the alien and male human/alien as well. I beleive this should work.

also, under the Female section, switch these two lines:

switch(i)
var/i = input("Choose a model.","Model") in list("Alien","Human")
In response to Skysaw
On 7/21/01 5:29 pm Skysaw wrote:
On 7/21/01 3:47 pm Vortezz wrote:
if("Alien")
icon = 'models.dmi'
icon_state = "falien"
if("Human")
icon = 'models.dmi'
icon_state = "female"

Shouldn't these, and the male counterpart, be indented?

if("Human")
icon = 'models.dmi'
icon_state = "female"

Do this for the alien and male human/alien as well. I beleive this should work. But what Vortezz said fixed it .. :)

also, under the Female section, switch these two lines:

switch(i)
var/i = input("Choose a model.","Model") in list("Alien","Human")

yea i had those backwards :) switched just after i posted to see if it would fix, it didnt. But what
Just a matter of style here, but since you are doing the same thing in each case, you could slim down the code a little. This will do the same thing, but is a little more readable in my opinion. :)


var/g = input("Your Gender?","Gender") in list("Male","Female")
var/i = input("Choose a model.","Icon") in list("Alien","Human")
icon = 'models.dmi'
switch(g)
if("Male")
switch(i)
if("Alien")
icon_state = "malien"
if("Human")
icon_state = "male"
if("Female")
switch(i)
if("Alien")
icon_state = "falien"
if("Human")
icon_state = "female"
In response to Shadowdarke
On 7/23/01 5:33 am Shadowdarke wrote:
Just a matter of style here, but since you are doing the same thing in each case, you could slim down the code a little. This will do the same thing, but is a little more readable in my opinion. :)


var/g = input("Your Gender?","Gender") in list("Male","Female")
var/i = input("Choose a model.","Icon") in list("Alien","Human")
icon = 'models.dmi'
switch(g)
if("Male")
switch(i)
if("Alien")
icon_state = "malien"
if("Human")
icon_state = "male"
if("Female")
switch(i)
if("Alien")
icon_state = "falien"
if("Human")
icon_state = "female"

Personally, I'd just rename the icon_states to HumanMale, HumanFemale, AlienMale, AlienFemale. Even more simplification:

var/g = input("Your Gender?","Gender") in list("Male","Female")
var/i = input("Choose a model.","Icon") in list("Alien","Human")
icon = 'models.dmi'
icon_state = "[i][g]"

;-)