ID:168664
 
How can I reroute client.Center() to some sort of mob command, without changing code in the client? I have an interface mob (/mob/clay) who's movment proc takes care of moving around a cursor in a window with different choices. I'd like to have client.Center() select one of the choices. Unlike the client movment procs (Center() isn't really a movment proc, I guess) it doesn't send any command to the mob. Instead, it calls walk(mob,0), which doesn't send a command to the mob, either (or does it?).

So, as I said, I'm looking for a way to have client.Center() send a command to the mob, without my having to rewrite any of the client's code. Anyone have any ideas?
I wouldnt know how to do that.
But I do know of a way so that instead of over ride it adds to the clients code.
client/Center()
{
..()//call walk(mob,0);
src<<"You rang?";
};




Itanium
In response to Itanium
I could do the above, but the clay mob is used just for the log in process; I don't want log in specific code being carried by the client for the rest of the players time connected, even if that code was made to do nothing outside of the log in process.

[edit: Kudos on the use of brackets and semicolons; I use them as well, and used to get flak for it.]
In response to IainPeregrine
Why don't you do an if() check for the src.mob, and do .=.() at the beginning. I am pretty sure that will make it do what it is supposed to do, after the if().
In response to IainPeregrine
Then set a variable for it.
var still_checking=1;
mob/clay
{
Login()
{
//do work
still_checking=0;
};
};
client/Center()
{
..();//call walk(mob,0)
if(still_checking)
{
src<<"You rang?"
};
};

Just to give you an idea of how that could be implemented.

itanium
In response to Itanium
This is still an extra if() statment being executed everytime the center key is pressed (something that is going to be done quite often in my game). This is something that is going to be used once durring gameplay, and is specific to the mob, not the client. For that reason, I don't want to consider any code placed inside the client.

Basically, I'm asking if I've overlooked something, if there's some sort of background command or handshake that's being passed around that I don't know of. It's the sort of thing Lummox JR or Deadron normally know about, either that or it doesn't exist. :/

P.S. Thanks for trying to help out, though. :)
In response to IainPeregrine
Depending on how strict you are about editing Center() you could always try this.

client/var/centerhooks[]
client/Center()
for(var/h in centerhooks)
call(mob,h)()


Then just dynamically add the desired proc in the list or remove one already in.
In response to Theodis
That's the catch, I'm absolutely strict. My design philosophy is to never misplace functionality; if a certain function belongs to one object, it should not be placed in another object. So, though I could write up a working system very quickly using the client.Center() proc, I don't allow myself to do that sort of thing. So, any code here belonging to the client doesn't really help me at all. :/
In response to IainPeregrine
The only other thing I can think of is setting the Center key macro to some other verb :P.
Any chance you'd be able to just go with a simple:
mob/proc/Center()
walk(src,0)

mob/clay/Center()
//Select the choice.

client/Center()
src.mob.Center()


It's not what you want, but I'm extremely confident that there's no way you'll get client.Center() to send a command to the mob without changing the client.Center() proc.

Unless you assign a keyboard macro to .center that goes directly to the mob.Center() proc, and completely cut out the call to client.Center(). Although I doubt that's up your ally either.