I'm making a chat channel script, and I was wondering if how I set it up is a good way.
I created a script object called chatchannelmod.
I set chatchannelmod.chatchannellis t = new simgroup(chatchannels){}; with nothing special.
I then created a function for creating new script objects of the class chatchannel and added them to the simgroup chatchannelmod.chatchannellis t.
Each channel has an array of scriptobjects, called users, which hold values of the users ID and users Name, and a bool like variable to see if the player should send messages to the channel(if they can't send messages to the channel, they can still receive them if they are a member of the channel).
I created functions to remove players from the array, add players, get the count of the array, etc.
If a user is removed from the array, here is an example of what happens: Array Length: 5. Element 3 is needed to be removed. If element 5 is not null, set element 3 equal to element 5. Set element 5 to null.
When ever a message is sent, its sent to each chat channel. If a client is a member of the channel, it sends them the message.
Sorry if I'm not very clear on what I'm doing. If anyone wants to look at the code, I'll post it here.
Some of my problems are:
1. that chatchannelmod.delete(); doesn't delete the script object chatchannelmod, but deletes all the channels in the sim group chatchannellist.
2. is there a way to delete a variable attached to a script object... like my user array off of a channel sooo... channel.channeluser[%i].delete(); so that the variable is wiped completly.
3. I feel like I made this to complicated lol.