ID:180756
 
do you have to declare vars that should be used in procs in the same codefile as the specific proc?
On 2/24/01 1:04 pm Kaidorin wrote:
do you have to declare vars that should be used in procs in the same codefile as the specific proc?

Nope; it all gets mashed together in the end, anyway. Separate .dm files are just an easy way to handle things, they aren't a restriction at all.

(Well, not quite true. If you do a #define, you have to have that #define BEFORE any code you use it in. That means that you need to put all your #define's in the earliest alphabetical .dm file. Of course, you have to use #define's in the first place for this to be of any relevance. =)
In response to Spuzzum
ok then whats wrong in this?

door
density = 1
opacity = 1
icon = 'door.dmi'
icon_state = "closed"
var
color = ""
state = "closed"
verb
open()
if(src.state == "closed")
if(color == usr.color)//here
flick("opening",src)
icon_state = "open"
state = "open"
density = 0
opacity = 0
else
usr << "bla bla"
else
usr << "It's already open."

the marked line has usr.color wich is defined in another codefile like this:

mob
player
var
color = ""
In response to Kaidorin
On 2/24/01 1:55 pm Kaidorin wrote:
ok then whats wrong in this?

door
density = 1
opacity = 1
icon = 'door.dmi'
icon_state = "closed"
var
color = ""
state = "closed"
verb
open()
if(src.state == "closed")
if(color == usr.color)//here
flick("opening",src)
icon_state = "open"
state = "open"
density = 0
opacity = 0
else
usr << "bla bla"
else
usr << "It's already open."

the marked line has usr.color wich is defined in another codefile like this:

mob
player
var
color = ""

Usr is always assumed to be of type /mob, not of /mob/player, even if you set world.mob to /mob/player. You would have to use

usr:color

in that place, and it should compile fine.
In response to Spuzzum
one of us has to study more, and his name doesn't start with an S ;>
In response to Kaidorin
On 2/24/01 2:08 pm Kaidorin wrote:
one of us has to study more, and his name doesn't start with an S ;>

Actually, I think that's one of the things the Guide doesn't even mention...