ID:264282
 
Code:
var/list/Master = list("Demon_F0rce") 

mob
proc
AddMasterVerbs() // Adds Master verbs if they are a Master
for(var/V in typesof(/mob/master/verb))
src.verbs += V
src.gmrank = 3


Problem description: I saw another problem like this and checked it out, however they used a different system to me and I can't be sure. Anyway, using this system (learnt through the PI-Admin demo), GM verbs should be loaded onto me. However, for some reason it's not working. I'm using the same thing on another one of my games, and it works fine. I just don't see what's different on this one that doesn't allow it to work.

Do you even know if your add proc is being called? Also, a GM rank var is pretty bad when you have a list of keys (you're just wasting the server's RAM), and even so, you're setting the value many times.

var/list/Master = list("Demon_F0rce") 

mob/Login()
if(key in Master) AddMasterVerbs()
..() //call the parent

mob
proc
AddMasterVerbs()
src.verbs += typesof(/mob/master/verb)) //typesof() returns a list, so you can
//add it directly

IsMaster() return (src.key in Master) //if they are a master (your 3rd GM level)
//this proc will return 1
In response to Jeff8500 (#1)
Found the problem. I looked over your post, and realized I didn't add the parent to another mob/Login() I put in my code. Thanks.
In response to Jeff8500 (#1)
Jeff8500 wrote:
(...)Also, a GM rank var is pretty bad when you have a list of keys (you're just wasting the server's RAM), and even so, you're setting the value many times.

IsMaster() return (src.key in Master)


I hope you do not mind, as this is a bit "off topic", however I got curious... how much RAM/CPU does a proc like this need compared to setting a variable and a switch?
I imagine that a procedure does take some space in the bytecode and executing it would hog up some memory as well, so I wondered, does anyone have actual solid benchmarks on which solution is better?
Asides of the fact that this proc does not seem to allow for ranged checks as easy [if(gm >= 2)].

And how was he setting the value multiple times?
In response to Schnitzelnagler (#3)
The proc will use so little CPU, you could probably run it thousands of times every tick and still use less than 1% of your CPU. As for RAM usage, a GM var would probably still use more (do procs even use RAM?). Even if it didn't, the proc will only last for a fraction of a second, whereas the GM var will be around forever. Besides, you're going to have a GM list either way, so why not use it? I could see it being much more difficult for a player with a hex editor to change the values of a list rather than a simple number, as well.
In response to Jeff8500 (#4)
Hmm, maybe we should start a new topic, as I'm kind of feeling bad to tackle on the subject when it might be to "minimal" interest for the original poster.
Or the pager, if I'm the only nerd curious about this?
In response to Schnitzelnagler (#3)
You shouldn't even use a proc for this, since it's just to shorten a constant, single operation. Not calling a proc would also slightly lower the execution time.
You can use a #define macro instead of a proc to shorten the typing, to still use the statement as if it was a proc, but it will compile substituted with the actual code.
#define IsMasterX(Person) (Person:key in Master) // : not necessary
#define IsMaster(Key) (Key in Master)
mob/verb/am_I_master()
src << IsMasterX(src)
src << IsMaster(src.key)