ID:262576
 
The doors won't open! It never calls the open() proc...what am I doing wrong?

Player bumps door
    Bump(atom/O) 
if(istype(O,/turf/door))
call(/turf/door/proc/open)()



door code
    door
icon = 'turf.dmi'
icon_state = "closed"
density = 1
opacity = 1
proc/open()
density = 0
opacity = 0
flick("opening",src)
icon_state = "open"
sleep(40)
flick("closing",src)
icon_state = "closed"
density = 1
opacity = 1



--Vito
Um..

   Bump(atom/O) 
if(istype(O,/turf/door))
O.open()


try that

EDIT: Does it matter if you make it var/atom/O, as well?
In response to Justin Knight
EDIT: Does it matter if you make it var/atom/O, as well?


Shouldn't, and thanks... I guess that was dumb.


EDIT: error: O.open: undefined proc... why me???

--Vito
In response to Vito Stolidus
I would tell you to :: cough :: use the : operator :: cough :: because it's already defined, but people would yell at me.

You have to 'type cast' the var, whatever that means.
In response to Justin Knight
??????
[confuzement]
umm... o...k... sure...
[/confuzement]

EDIT: even with your (cough cough) suggestions, the doors remain welded shut. grrrrrr.....

--Vito
In response to Vito Stolidus
Vito, to unconfuse you. I would have said to just simply make it "O:open()" but people would yell at me.

To have 'robust coding' you must 'type cast the var', I don't know how to do that off hand.. let me search for it.
In response to Justin Knight
wait... don't bother. I've found a way to get it working... except that, while the flick proc runs the animation, whatever is behind it goes black. when the animation ceases, the background returns. What would cause that?

--Vito
In response to Vito Stolidus
That has to do with your use of opacity, I believe.

Use opacity = 0 and density = 0 AFTER the flick of the door opening.
In response to Justin Knight
Don't think so...

door
icon = 'turf.dmi'
icon_state = "closed"
density = 1
opacity = 1
Click()

flick("opening", src)
icon_state = "open"
density = 0
opacity = 0
sleep(45)
density = 1
opacity = 1
flick("closing", src)
icon_state = "closed"


EDIT: whoops....

--Vito
    Bump(O) 
if(istype(O,/turf/door))
var/turf/door/d=O
d.open()

You also may want to make the doors objs. :|
In response to Vito Stolidus
It has to do with the fact that you don't understand the order these things are going in. You have to do it like this:

 door
icon = 'turf.dmi'
icon_state = "closed"
density = 1
opacity = 1
Click()

flick("opening", src)
density = 0
opacity = 0
sleep(20) // how long your animation is exactly
icon_state = "open"
sleep(45)
density = 1
opacity = 1
flick("closing", src)
sleep(20) // again
icon_state = "closed"
In response to Ol' Yeller
I was going to suggest that as well, but didn't get around to it.
In response to Justin Knight
Nope... doesn't work...

--Vito
In response to Ol' Yeller
that doesn't work...


--Vito
In response to Vito Stolidus
Your door is a turf object. It would be more handy if your door was an obj, like Ol' Yeller said.

~~> Dragon Lord
In response to Unknown Person
OK already!!!!!!! fine, it's an object now.


--Vito
In response to Vito Stolidus
ARRRRRRRRRRRGGHHH!!!!!!!!!

I changed it to an obj, and the background now appears!

--Vito
In response to Vito Stolidus
THIS is confusing me. I thought you tried that already, and it didn't work? :/