Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Area Flags
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Malti
USA (55 posts) Bio
|
| Date
| Thu 27 Apr 2006 04:04 PM (UTC) |
| Message
| I have searched high and low for the abit/qbit snippet and I have yet to find anyone that has it. Here is my vision:
I want a flag to be set in the pfile. When someone plans to enter the area, I want the flag to be checked first. I also want Mobiles and IMMs to be able to set these flags.
I think the flag would could/should look something like this
A<area> 0/1 - one will grant access, 0 will deny it
So, I understand this is going to be a huuuuge overhaul on the code, but I think I have enough coding expirence to take it on piece by piece. The only problem is, I dont know where to really start. | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #1 on Thu 27 Apr 2006 04:47 PM (UTC) |
| Message
| What you'd want to do is find every point in the code that a character can use to enter an area, or rather, change from one area to another. Such points would be: moving around, transportation spells, etc. You'd want to check things that characters can do (e.g. walk, teleport) but also things that can be done to characters (e.g. be summoned) and block both of these. This will probably be the trickiest part because you might miss one or two subtle places. I'd make sure to only prevent area changes, so that if the player does somehow wind up in the area, they can still walk around and leave it and won't be completely stuck.
(This is one place where you feel a lacking aspect of SMAUG's design. If there were one common gateway function for permission checking, a function playing the role of can_enter of sorts, then every movement function could check the same function, and it'd be much easier to do the kind of thing you're talking about. As it is, it's tricky business because you might forget something somewhere, or you might add new ways of moving around and forget to have them check for this flag!)
As for adding bits to the character file, that's really not too hard. Look around in save.c for how things are loaded using KEY. What you would do is default the entire array of flags to zero, and then read in for a character which areas to set to one. You could store the array as a linked list, where each element has the name of the area in addition to the flag, that way you have a way of mapping area name to flag.
And finally, letting mudprogs change/read the variables is also pretty straightforward. Changing is just a matter of having commands that NPCs can use that interface to this flag system. And for reading, you would add a new ifcheck, which is also relatively straightforward, since you'll have the entire helper function setup done already. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | 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.
10,888 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top