ID:1706977
 
Not a bug
BYOND Version:507
Operating System:Windows 7 Pro 64-bit
Web Browser:Chrome 38.0.2125.104
Applies to:DM Language
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
Tried creating something different with administration being its own datum. When using the code below I'd of expected it to check the datum's level, however in reality it checks the undefined variable "/mob/var/level".

Attempting to use: admin.level of course would return an undefined variable at compile time since it is not associated to the mob until runtime.

And finally, using owner.admin.level also throws a runtime error, because owner is the datum's variable, and attempting to check it when the verb is added to the mob's verblist recreates the error defined at the top, with owner being the culprit.

Numbered Steps to Reproduce Problem:

Code Snippet (if applicable) to Reproduce Problem:
admin
var
mob/owner
level = 1
list/verbs = list()
New(a)
owner = a
grantPowers()
proc/grantPowers()
if(level>=1) verbs+=list(/admin/verb/Announce)
//if(level>=2) verbs+=list()
owner.verbs+=verbs
verb
Announce(t as text)
if(level==2)
world<<t
return
else
world<<"\[Announcement by [src]\] [t]"

mob
var/admin/admin
Login()
admin = new(src)
..()


Expected Results:

verb/Announce to attempt to check the datum admin's level, even after being added to the mob's verblist, instead of the verblist changing the verb parent path to the current mob.

Actual Results:
runtime error: undefined variable /mob/var/level
Kaiochao resolved issue (Not a bug)
What you're seeing, however screwy, is intended behavior. The verbs added to the mob's verbs list are in no way attached to any datum; that is, until you use them, causing the verb's usr to be the mob (as well as src, but that will have the type of the verb and will probably equal usr).

Here's a workaround: define the verbs as objs and place them in your mob's contents. Now you have access, through the src setting, to its verbs, attached to itself.

Or just use usr, usr.admin, usr.admin.level, etc.
Hmm, I see. Thank you for the work around. Any idea how come they lose their datum, after being added to the verblist?
Say if I deleted mob.admin, would the verbs not be eliminated from the verblist though it was removed?
In response to Inuyashaisbest
You can add any verb, from any type, to any mob's verbs list. No instance of the verb's "parent" is required, proving that this is just intended behavior.