ID:141168
 
Code:
mob
proc
JoinPolice()
usr.verbs += typesof(/mob/Police_Verbs/verb)
PoliceLeader()
usr.verbs += typesof(/mob/Police_Verbs/verb)
usr.verbs += typesof(/mob/Police_Leader/verb)
NoPolice()
M.verbs -= typesof(/mob/Police_Leader/verb)
M.verbs -= typesof(/mob/Police_Verbs/verb)
M.policerank = ""
M.Police = ""
M.Rank = ""



mob
var
policerank = ""
Police = ""


Problem description:
I have all the vars in but when I compile, it comes down to this:

The Police.dm:10:error:M.verbs:undefined var
The Police.dm:11:error:M.verbs:undefined var
The Police.dm:12:error:M.policerank:undefined var
The Police.dm:13:error:M.Police:undefined var
The Police.dm:14:error:M.Rank:undefined var

I don't know why it doesn't work. Can anyone help?


Rayquaza1903 wrote:
I have all the vars in

Do you? Where the heck is M declared...?
Whatever the cause, this is a problem of a beginner not learning DM/programming fundamentals. I suggest going over the DM Guide.
In response to Kaioken
I know how to code. I'm pretty good at it. It won't work for just this code here. The rest in my source works perfectly fine, and its a big source.
In response to Rayquaza1903
Rayquaza1903 wrote:
I know how to code. I'm pretty good at it.

I won't ask you to explain the clear contradiction to this. Also, BTW, the verb "to code" has quite nothing to do with programming, so you probably shouldn't use it in this context if you want statements like above to appear more credible.

So, then, have you fixed the problem yet, or not? For those errors to go away, the var M needs to be defined (so saying "M" in the code actually makes sense to the compiler), as a /mob type at that (since you're using mob vars with it).

<small>EDIT: Fixed missing closing parenthesis!</small>
In response to Kaioken
There are alot of codes in my source using the M var.
In response to Rayquaza1903
Doesn't look like you know what you're talking about, really, and you've just proved what I've said... but I'll bother explaining. If a var is declared locally to a proc/verb, it's a var that only exists and is only available in that specific procedure. You can't use M everywhere just because you've declared M once in your code in some verb (which is what I'd guess is the case), that M only exists in a specific verb and not all verbs.
proc
One()
var/mob/SomeVar ...
Two()
//the above SomeVar does not exist here.
world << SomeVar //undefined var error

Also, whatever the case, your problem has already been pointed out to you - you might as well disregard that, but then I'd question the creation of this topic. What you need to do is create a M var in your verb that's defined as a /mob type and is assigned to some mob (that you want the verb to affect).
In response to Kaioken
urf. Fine. I just don't exactly know what to put in to define M then. Even though this is the first time I apparently have to actually define M. (I thought it was built in)
In response to Rayquaza1903
Rayquaza1903 wrote:
I just don't exactly know what to put in to define M then.

Hint: There was a link in my previous post. This one should also be of interest. Lastly, there was also an example of how to define a var in my post.

Even though this is the first time I apparently have to actually define M.

=\ So, are you saying you've been programming for a while and never had to make a variable? Seriously, I dunno what's your case, but have you been copying all your code or what.

(I thought it was built in)

Well, it isn't; the only reason you're seeing it very often is pretty much because it's a very popular name to choose for your vars. But you don't have to use M ever, you can name all of your temporary vars "poo" for all it matters.
In response to Kaioken
I make variables. But I never coded in just M.

Also, I haven't been coding that long. Only about 7 months or so...And I'm no pro either. I'm just a decent coder >>

I don't know what you mean by code in JUST M. I can't find in those guides, how to code in just M. It talks about plenty of variables but NOT JUST M
In response to Rayquaza1903
Well, since Kaioken already explained everything to you, i will just give you the solution.
Replace M with src.
Also, -but has nothing to do with the problem you stated- replace usr with src.
In response to Jan90ster9
Thank you very much.
In response to Rayquaza1903
There is nothing specific to the letter M. It's just another variable name. The name doesn't matter, a name can be whatever you want. There is nothing special with M in comparison to other var names, like hp or target or whatever. Got it...?

Simply, you've used the symbol "M" in your code (not that it was required, as was pointed out). For that to mean anything, it needs to refer to something Dream Maker knows; in this case it could only be a variable name. So for M.Police to compile, just like a Police var has to exist, similarly, a M var has to exist. Because it didn't (since you never created it, as far as the proc is concerned), you got an error, which basically says you've tried to use something that doesn't exist/the compiler doesn't know.
Please, do yourself a favor and learn a bit (at least about vars...) before proceeding. Start at the start.
In response to Rayquaza1903
var/mob/omgcookiewhatthehellAPOCALYPSENOWISAGREATMOVIE = src
omgcookiewhatthehellAPOCALYPSENOWISAGREATMOVIE.health = 1


"M" is not a built-in variable. Neither do you have any clue whatsoever what you're doing, neither are you close to becoming a programmer with that attitude. Accept you don't know it all, you know-it-all ;).

Also;
<font size=24>No put 'usr' in proc, ungh.</font>
<font size=1>(Except Click, DblClick & client procs)</font>