Problem description:
Well, there are a few forms of staff in this game I work for. The RPM Team(Levels 1 and 2), The GM Team(Levels 1 and 2), The Board Executives, And The Partners.
Currently, the View Online Staff verb works as simple, if a staff member is online, it'll say "Osiris(GM1)" but if they're not on, they won't show up at all. I want a code that straight up lists it all out. Like..
GM Lv. 1
Osiris(Online)
Marko999(Offline)
GM Lv. 2
Kia_2fly(Online)
If you get what I mean?
I think it has something to do with lists, I just have no clue how to even begin.
You're right on that you'll have to use list.
You could do something along the lines of var/list/list1=list("Key1"="Offline","Key2"="Offline")//Make a list of keys relating to who's status you want to view and set their status to "Offline" |
How do I add names to that list?? Like, could you add some //'s? I really don't understand it all too well. :(
|
In response to Osiris1997
|
|
I added comments right after posting, I realized that it might not have been easy to read.
To add names to the list, as in more keys while in-game or the names of the mobs attached to the key? |
Well keys. Like, I don't want to have to change the code every time there are firings and hiring, because the lower levels(GM/RPM) are not coded in. Instead, there is a Grant GM and Grant RPM Verb that the higher levels have. Like, when someone is hired, I need a code to add them to their respective list, or fired, taken off.
|
In response to Osiris1997
|
|
You could use list operators to get the effect you're asking;
http://www.byond.com/docs/ref/info.html#/list/operators .Add() and .Remove() or += and -= should do you fine. |
Bah. I've looked in the list thing. I thought it'd be something simple. I need like a var/list/list1+=usr.key. I thought that'd work. It didn't XD
|
In response to Osiris1997
|
|
var/list/list1=list("Key1"="Offline")//This is just a re-hash from before |
runtime error: illegal use of list2args() or named parameters
proc name: AddKey (/mob/verb/AddKey) usr: Osiris1997 (/mob) src: Osiris1997 (/mob) call stack: Osiris1997 (/mob): AddKey() |
In response to Osiris1997
|
|
Yeah, .Add() isn't meant for this, just had high hopes I guess.
mob/verb/AddKey() Not sure how to comment that. |
In response to NNAAAAHH
|
|
The DM reference clarifies that when you associate a key in the list to something, it is automatically added to the list. Also, you can check if a key's in the list by checking it's associated value, since both "offline" and "online" are true values. If a key's not in the list, you get null.
|
In response to Kaiochao
|
|
My bad, been awhile since I touched on this stuff.
|
Why not just keep a global list of admins? This prevents creating a new list every time someone wants to see..
var/list/Admins = new/list() Of course, that doesn't order them by category nor does it detect whether they're online or not, I'll leave that out. All you have to do is save their admin type in the admin file, and then you can handle it in the Admins list. As far as the online/offline thing goes, simply loop through all the clients and check for the key. Hope I helped~ |
ex:
GM Lv. 1
Osiris (Offline)
Marko999 (Online)