ID:143942
 
Code:
        Volume()
input("What do you want to find the volume of?","Volume")in list("Cube","Rectangle","Circle")
if("Cube")
usr << "<font color = green>What is the length of one side?(All sides must be equal to be a cube!)"
var/a = input("Length of side","Lenght")as num
var/b = a*a*a
usr << "<font color = green>The volume of the cube is [b]!"
if("Rectangle")
usr << "<font color = green><img src = http://www.math.com/tables/geometry/rprism.gif>What is the length of side C?"
if("Circle")
return


Problem description:
Well, no matter what I pick in the list, it always does the Cube...

Revojake wrote:
Code:
        Volume()
> input("What do you want to find the volume of?","Volume")in list("Cube","Rectangle","Circle")
> if("Cube")
> usr << "<font color = green>What is the length of one side?(All sides must be equal to be a cube!)"
> var/a = input("Length of side","Lenght")as num
> var/b = a*a*a
> usr << "<font color = green>The volume of the cube is [b]!"
> if("Rectangle")
> usr << "<font color = green><img src = http://www.math.com/tables/geometry/rprism.gif>What is the length of side C?"
> if("Circle")
> return
>


Problem description:
Well, no matter what I pick in the list, it always does the Cube...


What you're doing is only suitable in a switch() situation.
like this.

            switch(input("What do you want to find the volume of?","Volume")in list("Cube","Rectangle","Circle"))
if("Cube")
usr << "<font color = green>What is the length of one side?(All sides must be equal to be a cube!)"
var/a = input("Length of side","Lenght")as num
var/b = a*a*a
usr << "<font color = green>The volume of the cube is [b]!"
if("Rectangle")
usr << "<font color = green><img src = http://www.math.com/tables/geometry/rprism.gif>What is the length of side C?"
if("Circle")
return


</DM>

if not you have to do this ( not recommended unless necessary)

            var/A=input("What do you want to find the volume of?","Volume")in list("Cube","Rectangle","Circle")
if(A=="Cube")
usr << "<font color = green>What is the length of one side?(All sides must be equal to be a cube!)"
var/a = input("Length of side","Lenght")as num
var/b = a*a*a
usr << "<font color = green>The volume of the cube is [b]!"
if(A=="Rectangle")
usr << "<font color = green><img src = http://www.math.com/tables/geometry/rprism.gif>What is the length of side C?"
if(A=="Circle")
return
In response to Kazekage (#1)
Ah, I see. I just haven't used in list in awhile.
What you're halfway to doing is using a switch() statement with an input, I suspect. Except, you're missing the switch.

The below shows you two ways to do something similar to what you are doing:

var/a = input("Test") as num // store value of question in 'a'
switch(a) // Read value of 'a'
if(1) // if 'a' is equal to 1
world << "Badaboom"
if(2)
world << "Allakhazam"
else
world << "Whizbang"


var/a = input("Test") as num
if(a == 1) world << "Badaboom"
else if(a == 2) world << "Allakhazam"
else world << "Whizbang"


The two above are close to completely equivelant, as far as you should be concerned.
In response to Kazekage (#1)
Kazekage wrote:
if not you have to do this ( not recommended unless necessary)

>             var/A=input("What do you want to find the volume of?","Volume")in list("Cube","Rectangle","Circle")
> if(A=="Cube")
> usr << "<font color = green>What is the length of one side?(All sides must be equal to be a cube!)"
> var/a = input("Length of side","Lenght")as num
> var/b = a*a*a
> usr << "<font color = green>The volume of the cube is [b]!"
> if(A=="Rectangle")
> usr << "<font color = green><img src = http://www.math.com/tables/geometry/rprism.gif>What is the length of side C?"
> if(A=="Circle")
> return
>

That is not equivelant. The above code will test A three times, no matter what. The appropriate way to do the above would be using the second example I posted, using "else if" so that the second comparison is only done if the first fails.

This might be unimportant here, but in cases where the value of what is being compared can change it is very important to understand.