I'm on the verge of changing the way my game handles whether a player has a certain skill or not.
Currently they learn a skill and get a verb accordingly. And @ logout their verbs are saved and restored.
The new system Im supposing will give players actual objs when they get a new skill.
Within that: I was wondering what people generally accepted as the best method:
1) attaching the verb to the object itself
2) keeping the verb system the same but adding an if() check to see if the related obj is ion contents
3) something else/better?
ID:266052
![]() Oct 30 2011, 7:17 pm
|
|
The interface should be:
mob (I'd prefer <code>addVerb(PUNCH)</code> where PUNCH = macro for the path to the verb, myself) The activeVerbs list should also be replaced by checking mob.verbs directly, I'd say. |
This is redundant as you would need to list them anyway to save them, meaning either way it's the same amount of programming with no different outcome...
|
Sorry, I'm not sure what you're talking about. What I meant is the proc would work like this:
mob/proc/addVerb(verb1) </dm> |
Hence "interface" and not "algorithm" or "implementation": the point is it's better practice to set it up like that. Otherwise your verbList and actual verbs are not dependent on each other which can cause errors where you accidentally add or remove one to the latter and not the former, for example.
|
No, seriously, in every way, aside from the fact you have lines in a different order to me which makes no difference, our procs are identical.
|
mob/proc/verbPopulate() Is not identical to mob/proc/addVerb(verb1) Because one controls the added verb and the other updates the verb list according to preset data. Neither are the lines the same. I'm really not sure what you're on about. |
What he's trying to point out is that he thinks that supplementing the type path rather than a name of a verb would avoid too much dependency. Hence, dropping the text2path proc and directly supplementing the type path itself.
If you'll be too worked up about your code being "identical" to others, then you shouldn't be giving advice. Don't worry, I don't mean it. I'm not that rude. |
Your description is not very clear.
What are these "actual" objs that you are speaking of? The easiest way it to place the verb in an obj and let the verb have set src in usr. Then place it in the mob's contents. |
I'd set src = usr.contents, myself.
The difference is inputting "punch name-of-punch-skill-card target" vs. "punch target". |
El Wookie wrote:
Personally, when I have verbs that need to be added/removed from a client at runtime, I have a few lists; > mob/var/verbList = new/list() I populate this list with keywords for the verbs; > mob/verb/Learn_Punch() What happens when you add something to verbList but forget to call verbPopulate? It'd be better to have it like this: mob It's harder for the developer to screw that up because add_verb handles all of the details, you don't have to handle the details (calling verbPopulate) every time you add a verb. |
I populate this list with keywords for the verbs;
verbPopulate() will then handling adding the verbs as accordingly;
Then I just save the verbList var, and run verbPopulate() on Login.