ID:162098
 
I am making a chat room "game", and I am making the code to create your own room.

mob/verb/Create_Chat_Room()
set category = "Room"
var/Create = input("What do you wish to call your chat room?")as null|text
switch(alert("Are you sure you want to create a chat room named [Create]?","Verify","Yes","No"))
if("Yes")
usr.lounge = "[Create]"
if("No")
return


I want a stat panel that will show the chat rooms that are made, and who is in them. I made a verb for it, which is:

mob/verb/Check()
set category = "Room"
usr << "The Chat room you are in is: [lounge]"


But I would rather have it in a stat panel, so everyone can see everything.



I also want to give the host of the server, his own set of moderating verbs. But I am not sure how to do that as I have never tried to do it (which means I have no clue =\).
I did have an idea, which worked... kinda... But it is a bad way to do it I head...

mob
Stat()
..()
if(src.online)
if(statpanel("Lounge"))
stat("Player","Lounge")
for(var/mob/M in world)
stat("[M]","[M.lounge]")


Besides, I want it to have the name of the lounge, then the people who are in that lounge.
use lists. when a person creates a chatroom, add it to the list. then display them.
In response to Scizzees
Lists could be my weakest point in programmng. I could use some help. I have tried doing this:

mob/verb/Create_Chat_Room()
set category = "Room"
var/Create = input("What do you wish to call your chat room?")as null|text
switch(alert("Are you sure you want to create a chat room named [Create]?","Verify","Yes","No"))
if("Yes")
var/list/R
R.Add("Create")
usr.lounge = "[Create]"
if("No")
return


Then Adding fo the stat panel:

mob
Stat()
..()
if(src.online)
if(statpanel("Lounge"))
stat("> [R]")//The error accurs on this line <--------------------------------------
for(var/mob/M in world)
stat("[M]")


I get an error of an undefined var, but I the var is the list/R which I put the the Create Chat room Code...

loading E Chat.dme
loading Interface.dmf
E Chat.dm:36:error:R:undefined var

E Chat.dmb - 1 error, 0 warnings (double-click on an error to jump to it)
In response to Howey
you can't call the list called 'R' in the statpanel because its only a list thats created when you use that verb.

var/list/rooms=list()


that will store the rooms. add the room to the list when using the create room verb. then display it in stat() using for(). it will show all the player-made chatrooms. you can also store lists in lists (see: dream tutor: associate lists) to show whos in the chatroom. i'm not to sure though. i dont use associative lists alot. hope you figure it out.

In response to Scizzees
OK, thanks. I will read that insanely long piece of information.

I still have the host gets powers problem... Can I get some information on that?
In response to Howey
when a person starts up a world (not in dream daemon). there address is null so you could

if(!src.client.address)


or check to see if the world.address is the person who logs in (if there hosting in dreamdaemon)

if(world.address == src.client.address)


both of those methods have worked for me.
In response to Scizzees
OK thanks a lot, you been a really good help.