who()
set desc = "Check to see who is online"
set category = "Comm."
var/mob/M
usr << "***| The Trinity Star |***"
for(M in world)
if(M.key) usr << "([M.level] [M.classmin][M.pkillwho]) [M.afkwho][M.name] [M.title]"
I was wondering how I could make this sort by character level?
ID:150000
Jan 9 2002, 12:51 pm
|
|
In response to Air _King
|
|
Air_King's a good coder i think you should do what he says it sound's like a good idea
|
Polatrite wrote:
who() You might check my List library for sorting routines...I should make a demo for that soon: byond://Deadron.List |
In response to SSJ4_Gohan_Majin
|
|
SSJ4_Gohan_Majin wrote:
Air_King's a good coder i think you should do what he says it sound's like a good idea\ Didn't sound to me like he understood the question at all. Did you? |
In response to Deadron
|
|
I looked over the list thing, but my who command doesn't have a list, could you show me the correct way to use the dd_sortedObjectList() proc, in conjunction with my who command?
|
In response to Polatrite
|
|
When you do your for() loop, just add everything it finds to a list.
var/list/Players = list() for(var/mob/M in world) if(M.client) Players += M Then sort Players however you want. |
In response to SSJ4_Gohan_Majin
|
|
SSJ4_Gohan_Majin wrote:
Air_King's a good coder i think you should do what he says it sound's like a good ideaThank you for the compliment, but i didn't fullt understand what he meant by "I was wondering how I could make this sort by character level?" I think, hmmm sort sort the users in the world with their vars = a level? What level explain in detail next time. |
Still having problems, this is my new who code.
who() set desc = "Check to see who is online" set category = "Comm." var/mob/M usr << "***| The Trinity Star |***" var/list/Players = list() for(M in world) if(M.client) M.level += Players dd_sortedObjectList(Players) for(var/mob/P in Players) usr << "([P.level] [P.classmin][P.pkillwho]) [P.afkwho][P.name] [P.title]" Using Deadron's list library for the dd_sorted proc, but I get this readout, runtime error... runtime error: type mismatch proc name: who (/mob/pc/verb/who) usr: Polatrite (/mob/pc/warrior) src: Polatrite (/mob/pc/warrior) call stack: Polatrite (/mob/pc/warrior): who() Maybe if the error was more specific I could figure it out, but alas, maybe I am just stupid. |
In response to Polatrite
|
|
It probably won't solve all your troubles, but you do need to set the line
M.level += Players to be Players += M.level |
In response to Skysaw
|
|
Skysaw wrote:
It probably won't solve all your troubles, but you do need to set the line M.level is probably not a player, so the code isn't going to do much when he then loops through mobs in the Players list. To use the sorted list from my object, you need to specify what to sort on in the dd_SortValue() function. Since you're sorting mobs, add this: mob Then in your who() verb do this: var/list/Players = new() You could make this whole thing simpler and more efficient by including my Players library, which tracks players for you. byond://Deadron.Players Then the who() code would look like:
var/list/Players = dd_sortedObjectList(base_PlayerMobs())
|
In response to Deadron
|
|
Deadron wrote:
Skysaw wrote: Thanks, I didn't want to get into all of that, which is why I just warned that it wasn't going to solve the troubles. My main point was that M.level certainly wasn't a list. |
whatever? Is that what you mean?