var/level = 1
mob
var/moves //tracks player moves
var/obj/stone/holding //a variable to keep track of held stones
verb
say(msg as text) //what the usr says is passed into "msg" as text
world << "[usr]: [msg]" //the world sees chatroom-like output
obj //new obj prototype,
stone //a stone,
icon = 'stone.dmi' //with the 'stone.dmi' icon assigned
Click() //overrides its Click() proc
if (usr.holding)
usr.holding.loc = loc //puts held stone on clicked stone's square
usr.moves++ //increments usr's move number
if (ColorChange(usr.holding)) //if ColorCheck() returns 1 to ColorChange()
usr << "You beat the level in [usr.moves] moves!"
usr.moves = 0 //resets move count
level++ //increments the level
Reset()
usr << "Level [level]..."
usr.loc = locate(1,1,level) //relocates the player to new coordinates
else
MoveCheck() //if the game wasn't won, see if it's been lost
usr.holding = null //makes it so usr is no longer "holding" anything
else
loc = null //takes the clicked stone off the board
usr.holding = src //but "remebers" it
..() //calls the parent, just in case
New() //overrides its New() proc
icon_state = pick("color1","color2")//set each stone's icon state randomly
turf
square //defines a "square" prototype, a kind of turf...
icon = 'square.dmi' //and has an icon named 'square.dmi'. In single quotes!
world //we set one of our world's characteristics:
turf = /turf/square //its default turf is the square turf.
New() //overrides its New() proc
for (var/turf/square/T in world) //loops through all squares,
new /obj/stone(T) //putting a stone on each
..() //calls the parent
proc
Cleanup()
for (var/obj/stone/O in world) //loops through all stones
del (O) //deletes each
ColorChange(var/obj/stone/thestone) //takes a stone as an argument
for (var/obj/stone/O in world) //loops through all stones
if (O.x == thestone.x || O.y == thestone.y)
O.icon_state = thestone.icon_state //changes those in same row or column
return ColorCheck(thestone.icon_state) //calls the color checking proc
ColorCheck(color) //takes a color as an argument
for (var/obj/stone/O in view(7)) //loops through all stones
if (O.icon_state != color) return 0 //returns 0 if one is a different color
return 1 //returns 1 if the game is won
MoveCheck()
var/maxmoves //new variable for maximum moves
switch (level) //evaluates the level
if (1) maxmoves = 8 //use whatever maxmoves # you want for each level
if (2) maxmoves = 7
if (3) maxmoves = 6
if (usr.moves == maxmoves)
usr << "You've used up all your moves. Game over!"
Cleanup()
else
usr << "You have [maxmoves-usr.moves] move\s remaining."
Reset()
for (var/obj/stone/O in world) //loops through all stones
del (O) //deletes each
for (var/turf/square/T in world) //loops through all squares,
new /obj/stone(T) //putting a stone on each
..() //calls the parent
Problem description:
it insists upon giving me a runtime error whenever i try to play the game and beat the first level, any help? it is related to my Reset() proc somehow, not sure what is wrong there...