var
stayLosses = 0
stayWins = 0
switchLosses = 0
switchWins = 0
tmp
stage = 1 //The game has two basic stages, and stage 3 occurs when the game is over.
doors[3] //A list of all doors in the world---necessary to ensure that the door with the car does not open.
obj/Door
carDoor
openDoor //The first door that the host opens.
firstChoice //The first door that the user picks.
mob
Login() //Assign door numbers and call new_game.
var
n = 1 //Assigns each door its door number.
obj/Door
doorOne = new(3, 3, 1)
doorTwo = new(3, 5, 1)
doorThree = new(3, 7, 1)
for(var/obj/Door/D in world)
D.doorNumber = n
n++
new_game()
return ..()
verb
new_game() //Set game variables to initial values.
firstChoice = null
carDoor = null
openDoor = null
var/obj/Door/D
for(D in doors)
doors.Remove(D)
for(D in world)
doors.Add(D)
stage = 1
obj/Door
var/doorNumber
icon = 'door.dmi'
New()
icon_state = "closed"
return ..()
verb
select() //Pick a door.
if(src == openDoor && stage < 3) //If it's the third stage, the game will restart anyway.
usr << "That door is already open."
else
switch(stage)
if(1) //Open a random door
src.icon_state = "selected"
firstChoice = src
carDoor = doors[rand(1, 2)]
doors.Remove(carDoor) //To ensure that the car door is not opened.
if(src != carDoor) //Otherwise, a runtime error could occur.
doors.Remove(src) //To ensure that the door the user picked is not open.
openDoor = doors[rand(1, doors.len)]
openDoor.icon_state = "goat"
usr << "You pick Door [src.doorNumber]. Monty Hall opens Door [openDoor.doorNumber] to reveal a goat. Do you switch or stay?"
stage = 2
if(2) //Open the door the user picks and see if he wins. Increment the appropriate variable.
carDoor.icon_state = "car"
usr << "You open Door [src.doorNumber] and find . . . "
if(src == carDoor)
usr << "a car! You'll be cruising in style from now on."
for(var/obj/Door/D in world) //This is necessary to open the remaining door.
if(D.icon_state == "closed")
D.icon_state = "goat"
if(src == firstChoice)
stayWins++
else
switchWins++
else
usr << "a goat! (And you don't actually get to keep it, either.)"
src.icon_state = "goat"
if(src == firstChoice)
stayLosses++
else
switchLosses++
stage = 3
else //Restart.
usr << "Game is completed, so restarting now . . ."
return usr.new_game()
Click()
if(stage < 3)
select()
else
return usr.new_game()
Problem description:
All of the relevant code is basically at and before the Door.New() method. When I start the game, all I see is a blank screen. What am I doing wrong?