ID:1838453
 
(See the best response by LordAndrew.)
Code:
mob
var/list/gm_list = list()
verb
Add_GM_List()
var/gm_name = ckey(input("What key would you like to add?", "Add GM") as text|null)
if((gm_name in gm_list) || !gm_name) return // if the person is already a gm, do nothing

gm_list += gm_name // if the person is not already a gm

world << "[gm_name] is now a gm!"

Remove_GM_List()
var/gm_name = ckey(input("What key would you like to remove?", "Remove GM") in gm_list+"Exit")
if(!(gm_name in gm_list))return // saftey check
gm_list -= gm_name // if the person is a gm
world << "[gm_name] is no longer a gm!"



View_GM_List()
var/gm_name = ckey
if(!(gm_name in gm_list))return
usr<<"[gm_list]"


Problem description:
ok basically what im looking to do, is save any mob to the list "GM list", that way when people relog or the game shuts down, all the people are still in the list. the adding and removing work fine, but whenever i try to view the list of people inside, i either get only myself, or /list

how do i see who all is in this list, and how do i have it so that every person sees the same list?

ive looked at some of the other list help out there but i dont really see what im looking for. would be great if someone could help me out. kinda a newb at this stuff
Have you Tried it like this
        View_GM_List()
var/gm_name = ckey
for(var/x in gm_list) // This should get the items in the list
usr<<"[x]" // this will output x to the usr

This should be able to save your list

client
New()
..()
if(fexists("gm_list.sav"))
var/savefile/F = new("gm_list.sav")
F["GMS"] >> gm_list

Del()
if(myList)
var/savefile/F = new("gm_list.sav")
F["GMS"] << gm_list
..()
In response to Bebi Tuf
thanks guy!

another qustion...since im defining X in gm_list, do i still need to have the var/gm_name? or is X and gm_name basically working as the same thing?
Best response
Why is gm_list a variable of /mob? If you want it to be consistent for everyone, it should be a global variable.
isnt mob the global var for people?

i mean, everythings mob/this mob/that
No, it's a type. The problem that LordAndrew is getting at, is that by defining gm_list on /mob, every /mob object gets it's own (empty) gm_list.

Likewise, you are saving/loading the gm_list from the client side, AKA my PC. So my gm_list is going to be different from your gm_list, or LordAndrew's gm_list. New people logging in in fact will have empty gm_lists! So when they view the the gm_list, they'll see nothing, and when I do it, I'll see some people that I added ... it's all a bit weird!

More likely, I think, you want it as a global variable, like so:

var/list/gm_list = list()

mob
verb
Add_GM_List()
var/gm_name = ckey(input("What key would you like to add?", "Add GM") as text|null)
if((gm_name in gm_list) || !gm_name) return // if the person is already a gm, do nothing

gm_list += gm_name // if the person is not already a gm

world << "[gm_name] is now a gm!"

Remove_GM_List()
var/gm_name = ckey(input("What key would you like to remove?", "Remove GM") in gm_list+"Exit")
if(!(gm_name in gm_list))return // saftey check
gm_list -= gm_name // if the person is a gm
world << "[gm_name] is no longer a gm!"

View_GM_List()
var/gm_name = ckey
if(!(gm_name in gm_list))return
usr<<"[gm_list]"


But now ... the saving/loading also needs to change a bit. Because we don't want to save it on every player's PC really, we want to save it on the PC where the world is running, the host's PC. We could do that like so, for example:

world
New()
..()
if(fexists("gm_list.sav"))
var/savefile/F = new("gm_list.sav")
F["GMS"] >> gm_list

Del()
var/savefile/F = new("gm_list.sav")
F["GMS"] << gm_list
..()
i get a warning with usr<<"[gm_list]"
statement has no effect

would var/x in gm_list be better?
Ah yeah, that's a pre-existing issue from the example above mine. It should be:

       View_GM_List()
for (var/x in gm_list)
usr << "[x]"
so when a var is all by itself

var/whatever=mountains
^ thats a global var?

and

mob/var/whatever=mountains
^thats JUST the mob/users var?
In response to Jugsapoppin
Correct jug
is there a way to negate client verbs?
for example
client
verb
settings()
get()
etc()

is there a way to make it so "etc" can be removed while the others can still be used. would this work:
client
verb
settings()
get()
admin/verb
etc()
In response to Jugsapoppin
Without indentation it's hard to answer your question. I suggest editing your post to put <dm> ... </dm> tags around the code.
If you want to remove several/a specific verb from usage by the common player you should either give the verb to said player once they've reached the requirements needed for said verb, like so:
src.verbs += /mob/secret_verbs/verb/specific_verb

//all verbs from a type of mob

src.verbs += typesof(/mob/secret_verbs/verb)