ID:144425
 
Code:
client/New()
for(var/mob/M in world) if(M.key==key) mob=M
if(!mob)
if(ckey in game_mods) mob=new/mob/player/game_mods
else if(ckey=="Animay3") mob=new/mob/player/animay
else
choose_team:
switch(alert(src,"Which team would you like to be on?","Team selection :: Team pick", "blah","blah2","Logout"))
if("blah2")
if(alert(src,"You've chosen the blah2's","Team Selection :: Confirmation","No","Yes")=="No") goto choose_team
mob=new/mob/player/blah2
blah2list += src.key

if("blah")
if(alert(src,"You've chosen the blah's","Team Selection :: Confirmation","No","Yes")=="No") goto choose_team
mob=new/mob/player/blah
blahteamlist += src.key



second block(seperated for clearness):

var/list/blahteamlist = list("")
var/list/blah2list = list("")

mob/player/verb
listplayers()
usr << "Blah's: [blahteamlist] blah2's: [blah2list]


Problem description:

every time i use the verb listplayers() i get back:

Blah's:/list blah2's:/list


whats wrong? And no, being that i called if the key is animay3(which is mine) and it doesn't add to the list because of that does not affect it, if you were thinking that.

If you are using ckey the key cannot be capatalized.
In response to Xx Dark Wizard xX
Xx Dark Wizard xX wrote:
If you are using ckey the key cannot be capatalized.

just using keys so the players can see the numbers and all, i use ckey for gm stuff


anyways, I'm diverting from the main problem, when i hit list players it comes up with /list instead of user key's
In response to Animay3
else if(ckey=="Animay3")

your ckey is animay3
In response to Xx Dark Wizard xX
Xx Dark Wizard xX wrote:
else if(ckey=="Animay3")

your ckey is animay3


I know, but that's nothing for administrator's, i have that on a different code file, can you help me with the /list thing?
In response to Animay3
Animay3 wrote:
...can you help me with the /list thing?

Well, from what I can gather, the code is doing exactly what you're asking it to do, but not what you want it to do.
What you're asking it to do is display the thing named 'blahteamlist' (in text), and what you want it to do is display what's INSIDE 'blahteamlist' (in text).
It helps if you think of every variable as a drawer or box, holding a value that you calculate or assign. A list is a group of these 'drawers', or to extend the metaphor, a 'chest of drawers' (or 'a holder of things that hold values'). By telling DM to
usr << "Blah's: [blahteamlist] blah2's: [blah2list]

you're basically asking it to 'show me the thing that's named blahteamlist'. It's saying, 'OK, blahteamlist is a /list'. What you want, I think, is to ask it to 'look inside blahteamlist and show me everything held inside it', or
for(var/teammemberKey in blahteamlist)
usr << "Blah's: [teammemberKey]"

This should give you all the keys contained inside the list blahteamlist.
Your lists should be defined with list(), not list(""). Using the latter will add a fake entry to the list which does nothing but cause trouble.
In response to TheMonkeyDidIt
TheMonkeyDidIt wrote:
Animay3 wrote:
...can you help me with the /list thing?

Well, from what I can gather, the code is doing exactly what you're asking it to do, but not what you want it to do.
What you're asking it to do is display the thing named 'blahteamlist' (in text), and what you want it to do is display what's INSIDE 'blahteamlist' (in text).
It helps if you think of every variable as a drawer or box, holding a value that you calculate or assign. A list is a group of these 'drawers', or to extend the metaphor, a 'chest of drawers' (or 'a holder of things that hold values'). By telling DM to
> usr << "Blah's: [blahteamlist] blah2's: [blah2list]

you're basically asking it to 'show me the thing that's named blahteamlist'. It's saying, 'OK, blahteamlist is a /list'. What you want, I think, is to ask it to 'look inside blahteamlist and show me everything held inside it', or
> for(var/teammemberKey in blahteamlist)
> usr << "Blah's: [teammemberKey]"

This should give you all the keys contained inside the list blahteamlist.


Ok, Serious problem with that, For an unknown reason, I get undefined var even though its clearly defined. So i decide to put in the listplayers verb var/teammemberKey...and it said duplicate definition....But when i remove it it says not defined -_- HELP!!!! ugh..Annoying.
In response to Animay3
I think you would want a list2text proc so you dont need to loop thrugh them constantly.
proc
list2text(list/L)
if(!islist(L))return
for(var/a in L)
.+="<br>"
.= a
islist(L)
return istype(L,/list)
In response to Xx Dark Wizard xX
Xx Dark Wizard xX wrote:
I think you would want a list2text proc so you dont need to loop thrugh them constantly.
> proc
> list2text(list/L)
> if(!islist(L))return
> for(var/a in L)
> .+="<br>"
> .= a
> islist(L)
> return istype(L,/list)


so i call that instead of all that stuff with for(var/teamkey in list/blahteamlist) then usr << "blah's: [teamkey]
In response to Animay3
like
src<<"[list2text(list)]"
In response to Xx Dark Wizard xX
Xx Dark Wizard xX wrote:
like
> usr<<list2text(list)



Ill try it but I'm getting some problems(hopefully it will clear up) with duplicate and previous definitions in the proc.
In response to Animay3
Animay3 wrote:
Xx Dark Wizard xX wrote:
like
> > usr<<list2text(list)

Ill try it but I'm getting some problems(hopefully it will clear up) with duplicate and previous definitions in the proc.

EDIT:: nvm
In response to Animay3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IT WORKS!!!!!!!!

THANK YOU SO MUCH!!!!
In response to Animay3
No problem.
In response to Xx Dark Wizard xX
Bah Humbug!

When another player logs in it deletes the first one! So it only displays 1 player, the latest one to log in! GRRR!!! ITS STILL NOT FIXED. HELP.
In response to Animay3
Yeah, it doesn't work because he gave you an incorrectly coded proc... DarkWizard, if you're not sure some code will work, test it before posting.
What that proc is doing is indeed looping threw the list. Then it adds a newline to the return value, then it's SETTING the return value to the item...which of course means the return value ends up as the last item.
Fixed version:
#define islist(L) istype(L,/list) //No need to make a new proc if it's just straightly calling another one...somewhat a matter of preference, though
proc/kk_list2text(list/L,sep="\n")
if(!islist(L)) return
for(var/item in L) . += "[item][sep]"
return copytext(.,1,lentext(.)-lentext(sep)+1) //don't include the last separator


That should do it. Also, you can specify a customized separator instead of a newline; like "," if you will, specify it as the second argument, if wanted.