ID:1097256
 
(See the best response by Carnage Productions.)
Code:


Problem description:

u press "Create Room" button then a room gets added to a tab called "Rooms", it has the name of the room, amount of numbers out of 5. can some 1 please lead me to the way to making that?
Best response
This is the best asking for advice I have seen in a while, look into lists and datums, thats a good way to go.
This should lead you in the right direction..


var/lRooms=list()
mob
Stat()
statpanel("Rooms")
if(statpanel("Rooms"))
for(var/obj/room/O in lRooms) stat(O) //displays all rooms in a tab
verb
Create_Room() //I was unsure what you meant by button
var/Na=input("What is the name of the room?")as text //If you wanted a literal button you use the Click()
choose_MA //procedure for a object and then redeclare this as a proc
var/MA=input("What is the max amount of people who can join?")as num//instead of a verb
if(MA>5)
alert("A max of 5 people to a room!")
goto choose_MA
else if(MA<2)
alert("A minimum of 2 people must be allowed to join!")
goto choose_MA
new/obj/room(Na,MA)
obj
room
icon='Rooms.dmi'
var/amount
var/max_amount
New(var/Na,var/MA)
..()
name="[Na]-[MA]" //the name is set to the text provided by the user + the amount chosed by the user
max_amount=MA //upon creation sets up max amount and name
lRooms+=src //then adds itself to the global list of rooms currently "open"
Del()
lRooms-=src
..()
DblClick() //Assumes you double click the "room" button to enter
if(amount>max_amount)
usr << "This room is full!" //If it has more than 5 people in it then you cannot join
else
usr << "Welcome to [src.name]!" //otherwise welcomes you to the room and increases amount by 1
amount+=1 //you need to make sure to decrease the amount by 1 when they leave
//This is when the mob enters the room successfully


I tested it out before posting and it handles everything you mentioned. If this does not solve your problem then please provide some details as to which parts you need help with.