Gammon Forum
Entire forum
SMAUG
SMAUG coding
Socials
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Neves
USA (78 posts) bio
|
Date
| Wed 07 Aug 2002 04:03 AM (UTC) |
Message
| 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 | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #1 on Fri 09 Aug 2002 02:36 AM (UTC) |
Message
| 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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Neves
USA (78 posts) bio
|
Date
| Reply #2 on Fri 09 Aug 2002 02:58 AM (UTC) |
Message
| 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 | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #3 on Fri 09 Aug 2002 03:23 AM (UTC) |
Message
| Not sure what you mean by "space at the end of an array". |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Neves
USA (78 posts) bio
|
Date
| Reply #4 on Fri 09 Aug 2002 01:48 PM (UTC) |
Message
| 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 | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #5 on Fri 16 Aug 2002 10:50 PM (UTC) |
Message
| 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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
15,073 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.