DOORS
This would go in the Create Event for the door objet.
// Argument 0 is the number of the door
execute_string("global.open"+string(argument0) = false)
If your rooms are not persistant then you need global values.
This would go in the code for when the door is opened (by a button or by walking into the door)
// Argument 0 is the number of the door
if global.keys => 1
execute_string("global.open"+string(argument0) = true)
And this would go in the Step event for the object
// Argument 0 is the number of the door
switch global.open {
case "false" : image_single = 0
case "true" : image_single = 1
}
The sprite for the door would need to be closed on the first frame (0), and open on the second (1). All of these would be scripts, and you'd make argument 0 a different number for each door. Or a codename. eg: foresttemple1, foresttemple 2,...etc.
KEYS
These would be just scripts.
In the collision event between link and the key:
global.keys += 1
instance_destroy(self)
If the key is in a chest, simply put
global.keys += 1
in the chest event for when it's opened.
KEY DISPLAY
Create a persistant object.
Create Event
global.keys = 0
Draw Event
if global.keys < 10
numbertodrawk = "0" + string(global.keys)
else
numbertodrawk = string(global.keys)
if global.rupees = 0
textcolor = sprLettersGray
if global.rupees = 500
textcolor = sprLettersGreen
if global.rupees != 0 and global.rupees != 500
textcolor = sprLettersWhite
draw_sprite_ext(sprkeyicon, 1, view_xview[0]+8,view_yview[0]+182, 1,1, 0, c_white, c_white)
draw_text_sprite2(view_xview[0]+12,view_yview[0]+186,string(numbertodrawk), -1, 4, textcolor, 33, 1)
Thar. That'll do it. If anyone spots errors, tell me.
EDIT: Oh, and if you want to make the key counter invisible while you're not in a dungeon, just make it invisible while outside.