Server Help

Bot Questions - Bot give creds via another bot

Anonymous - Mon Nov 28, 2005 9:37 am
Post subject: Bot give creds via another bot
Can a TWCore bot give creds via another bot? I already have a bot that gives out creds and I am going to use a twcore bot to run an event that has a reward of creds and I want to give out the creds with the twcore bot but i'm not sure if it can do the cred command for the other bot?

thax
Cerium - Mon Nov 28, 2005 3:00 pm
Post subject:
I assume 'creds' is short for 'credits' as in a generic term for 'money', probably to buy something in your arena.

I also assume the 'creds' bot has an operator command which allows zone/arena staff to grant players x number of credits. If this is the case, simply have your other bot use this command, as it will be the easiest way to add it.

Another option would be to transfer the data through the TWCores InterProcessCommunicator class. Ill let Distort describe this one, as I have never used it myself. I do know that this will require both bots to run from the same hub, but will be a far more reliable/safe method of doing what I assume youre trying to do.

For future reference, when you request technical help on a programming related forum, it would be best to use as little AOL-sp33k as possible.
D1st0rt - Mon Nov 28, 2005 5:20 pm
Post subject:
Oooook. IPC basics. First thing you have to do is establish a channel. This is done with
Code: Show/Hide
m_botAction.ipcSubscribe("channel name");
//This cannot be done in the constructor, btw (doing it on LoggedOn works though)

Once both bots have joined the channel, you can send Objects (such as the IPCMessage class) back and forth with
Code: Show/Hide
m_botAction.ipcTransmit("channel name", object);

To receive them, you have to handle the InterProcessCommunicatorEvent. You do not have to request that event, you just have to be subscribed to the channel it will be sent from.

When you kill a bot that is connected to a channel, be sure to unsubscribe it as part of the pre-death tasks with
Code: Show/Hide
public void ipcUnSubscribe("channel name");

All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group