ID:178828
 
Well se i am gonna put some code below thats given me a problem. When I hit "NO" it executes the things under if yes. I was wondering if anyone could help

turf
station1
icon = 'Turfs.dmi'
icon_state = "spacestation"
density = 1
Click()
input("Would you like to refuel here?","Refuel 50 units for 50 credits") in list ("Yes","No") // ask the player what the variable 'r' is (ask what race they want to be)
if("Yes")
usr.wealth-=50
usr.fuel+=50
usr<<"Thanks for visiting Alpha Station please come again"



if("No")
usr<<"Thanks for visiting Alpha Station please come again"
You forgot to add switch(). If you want to do something like if("Yes") you MUST switch() the input:


switch(varname)
if("Yes")
...


Something like that.
Try this, it also makes it look a bit nicer.

switch(alert("Would you like to refuel here? Refuel 50 units for 50 credits",,"Yes","No"))

if("Yes")
usr.wealth-=50
usr.fuel+=50
usr<<"Thanks for visiting Alpha Station please come again"
if("No")
usr<<"Thanks for visiting Alpha Station please come again"


LJR

ps. In your code your treating the if("Yes") as switches without the switch. Just so you know ;)
In response to Nadrew
thanks i'll try that in a minute
In response to Nadrew
HEY NADREW!

Any ideas on my problem posted in the Code Problems???

LJR
In response to RagnarofBurland
here this is what it looks like now.

Its tellin me my switch is empty

turf
station1
icon = 'Turfs.dmi'
icon_state = "spacestation"
density = 1
Click()
var/r = input("Would you like to refuel here?","Refuel 50 units for 50 credits") in list ("Yes","No") // ask the player what the variable 'r' is (ask what race they want to be)
switch(r)
if("Yes") // the program already knows what it's comparing (r). this was established with the line 'switch(r)'. now the program is checking to see what 'r' equals. just use if("example") to do so, because we've already checked to see what we're looking at
usr.wealth-=50
usr.fuel+=50
usr<<"Thanks for visiting Alpha Station please come again"
return


if("No")
usr<<"Thanks for visiting Alpha Station please come again"
In response to RagnarofBurland
nope indent the if("Yes") and if("No") under the switch once.

LJR
In response to LordJR
OH thank you it works now.

I'll be in the hub
testing the rest of the game about the rigel system and byond
In response to LordJR
Yes. I have an answer... but I'm not in the condition to type it, Alathon knows why. Maybe later.
In response to Nadrew
Nadrew wrote:
Yes. I have an answer... but I'm not in the condition to type it, Alathon knows why. Maybe later.

Hmm strange... I didn't know the forums doubled as a RPG too! :P

Ok where shall I find this Alathon? Maybe I can go on a quest for them and they will provide the answer I need to bring back your condition to type it. You don't need a pair of fingers do you? Cause I know a orge just down the Great Oak forest path about a mile who I can buy some for a bargain! ;)

LJR - at last I have found thy Holy Grail, but its locked away behind this darn Plastic Casing!
In response to LordJR
hey LRJ i was wondering how you did your docking system in Star traders? it would be quite usefull for me!
In response to LordJR
Lol.. Actually I've slept a total of 2 hours and 15 minutes since monday... Code + MushBrain = Trouble...