Socials

Posted by Neves on Wed 07 Aug 2002 04:03 AM — 6 posts, 22,554 views.

USA #0
I am trying to change socials so they can be done even if the char isn't in the room. To do this I want to make two seperate functions, one that checks if the first argument after the social is a player name or if the last argument is a players name, and if that is true to go to the function that handles socials directed to chars, and if neither of them are a players name (or they are blank) then go to the function that handles socials in just one room, but I'm not sure how to get from the bool check_socials to the other functions, so if someone can write just a real brief outline for me how to do it, it would be much appreciated.

-Jay
Australia Forum Administrator #1
You might change the part where it cycles through the people in the room to cycling through all connected players. That might be a simple way of doing it.
USA #2
Yep, did that, I had to redo the ignore part since it only checked if you were ignoring the people in the room.

Another thing I need is to remove the space at the end of an array, how can I do this?

-Edge
Australia Forum Administrator #3
Not sure what you mean by "space at the end of an array".
USA #4
OK, I've got char *argument; which contains 'x ' and I want it to only contain x, how would I do it? I'm also wonder how to clear an array, since I am using a for statement to use the same array each time, and it seems to keep whatever was in it previously until I change it, is there any any way to clear it?

-Edge
Australia Forum Administrator #5
Hmmm - you are asking about pointers and it looks like you are not too sure how they work.

One possible way is this:


char * p = "x";


Here is another way:


char * pp;

 pp = malloc (100);  // allocate 100 bytes for the string
 strcpy (pp, "x");   // put "x" in it


Here is how you could "empty" it:


strcpy (pp, "");


However I would not blindly copy this code. Find a book on C and read up on how pointers work.