Register forum user name Search FAQ

Gammon Forum

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.
 Entire forum ➜ MUSHclient ➜ General ➜ mushclient to aim

mushclient to aim

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Goumy   (7 posts)  Bio
Date Wed 13 Jan 2010 08:11 AM (UTC)
Message
I'm trying to send text from mushclient to aim and get a response from aim to mushclient. This way I can have all my scripts and triggers running in mushclient on my main pc, and have the output sent to whatever computer i'm on through aim.

I tried setting up a telnet service and a console aim client, and that kind of works only mushclient chokes on the telnet connection.

I could usa a script to open a command prompt and executing the console aim client, but then I don't know how I'd get messages from aim back to mushclient.

Or I could set up a mud server to connect to and somehow run console commands from within the mud in mushclient and send messages between worlds. I would need to write an object to handle io which i dont know where to begin with.

I could also use netcat to pipe the aim client to a port i can connect to with mushclient, but that's pretty much the same idea as the telnet server. Its possible to write a script to make it look like a mud so it wont glitch up mushclient.

Anyway, what I wanted to know is if there's other, better ways to accomplish what I want, or maybe get some help on the ideas i couldn't finish on my own.

Thanks in advance.
Top

Posted by Rakon   USA  (123 posts)  Bio
Date Reply #1 on Wed 13 Jan 2010 07:57 PM (UTC)
Message
To accomplish such a task, you'd be better off writing a small proxy for your localhost, for MUSHclient to connect to.

This is what I've done on my Linux computer. I have a localhost program/proxy running, which I have MUSHclient connect to. The proxy server/program then connects to my MUD and translates and sends all commands from MUSH, to the MUD. The proxy also intercepts the MUD output, and routes it to MUSH.

However, within the proxy code, I have a few messages (input lines) 'triggered' to interact a different way. The way I handle these messages, is through a DBUS interface. EX. I have my music player (Banshee) playing music. Each time the song changes, the proxy is polled for the banshee DBUS message:

public interface IPlayerEngineService : IDBusExportable
{
    event DBusPlayerEventHandler EventChanged;
    event DBusPlayerStateHandler StateChanged;

    void Open (string uri);
    
    void Close ();
    void Pause ();
    void Play ();
    void TogglePlaying ();
    
    IDictionary CurrentTrack { get; }
    string CurrentUri { get; }
    
    string CurrentState { get; }
    string LastState { get; }

    ushort Volume { get; set; }
    uint Position { get; set; }
    bool CanSeek { get; }
    bool CanPause { get; }
    uint Length { get; }
}


And from that code, the proxy then inserts a telnet coded line into the output stream of the connection ('Banshee:Now playing <song info>'). It outputs the message to the MUSH incoming stream, so that the above message is displayed to the MUSH output window.

In the same manner, I also 'trigger' an incoming tell from my MUD 'So and so tells you, "Blah."' . If mushclient does not have focus (status determined again, from dbus windowfocus event) then dbus will insert a sound into the also stream.

I really do not know how you'd do this from a Windows machine, but I gather at the least you'd need a programming library and language that has WSH/com scripting available to it.


Yes, I am a criminal.
My crime is that of curiosity.
My crime is that of judging people by what they say and think, not what they look like.
My crime is that of outsmarting you, something that you will never forgive me for.
Top

Posted by Goumy   (7 posts)  Bio
Date Reply #2 on Wed 13 Jan 2010 08:33 PM (UTC)
Message
I've done something similar before with netcat on cygwin, I was able to make a little one line proxy out of netcat where I basically connected to my mud with netcat, piped it to a file, then listened with netcat and when i connected with mush to the listening port, got my mud's connection piped over to me. But I could never get inputs working correctly. And the whole thing is kinda messy.

What I'm trying now is using lua to control a command window. The aim client has a log for each screen name on the buddy list. The login is handled by a config file so all i really need to do from mush is execute aim, and then on a trigger, send 'm name trigger text', then i can check the log file to see that my message was sent and I can poll every 5 seconds or so for a response to come through the log file. The problem I'm having though, again, is inputs.

What I'm trying to do is execute aim.exe < in.txt and then send input through in.txt. But even with a static in.txt with a test message, the program ignores the infile. All the pipe redirection references I looked at say that command < file pipes file's contents into command's input stream. So I'm not understanding why this wont work.
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #3 on Wed 13 Jan 2010 09:20 PM (UTC)
Message
It possible does not accept it from the 'input stream' and is only a FAKE console program, accepting a command line parameter.

This could be possible using Autoit3, it can create a listening socket on local host, and then do a Run() and parse the file itself into it, if that is what you want. I know it is an option to look at, and I made a telnet echo program using it, so you can test triggers and things easier.

Just my 2 cents.

-Onoitsu2
Top

Posted by Goumy   (7 posts)  Bio
Date Reply #4 on Wed 13 Jan 2010 10:25 PM (UTC)
Message
That would work, but then thats also like the netcat and the proxy idea. I would like to not use too many programs outside of mushclient because it'd be nice to make this into a plugin.

If i could get a pointer for the stdin and stdout of the console, I should be able to open them up with lua and just write to it as i like, shouldn't I? If I write a program that executes before aim in the same console window that just returns those pointers in a file and terminates, then I load them from the file and start aim, will those pointers be valid, or are they only for that application that called them? That is to say, does stdin and stdout remain constant until the shell terminates, or does it change....

If that doesn't work, I'll be writing a proxy server next =/
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #5 on Thu 14 Jan 2010 10:29 PM (UTC)
Message
Goumy said:


What I'm trying now is using lua to control a command window.


Have you seen this?

Template:post=6581 Please see the forum thread: http://gammon.com.au/forum/?id=6581.


In the download there you can do a windows_utils.shell_execute to execute any command.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Goumy   (7 posts)  Bio
Date Reply #6 on Fri 15 Jan 2010 07:24 PM (UTC)

Amended on Fri 15 Jan 2010 07:25 PM (UTC) by Goumy

Message
Yes, I did see this. But it's not any more helpful than using os.execute(). I still have no way to get access to the program's stdin. I'm not sure on the details but basically, I dont think it's possible on xp because of the protected memory space of each program. I wrote a script that would display the stdin and stdout of the console, and ran it like 3 times (3 consols simultaneously) and each time I got the same pointer. Its basically an offset. If it was win95, i could probably do it like that.

Once the console executes the program, it has control. The console passes keyboard input to stdin, and stdout to the console window. I need something that could a) find the process, or execute a program and return it's id. and b) get an absolute pointer to stdin and stdout, and c) I anticipate if I try to write directly to another program's memory space, windows will flip a s**t, so I may need to take care of that too.

Maybe a replacement to windows console that can give me that functionality exists. But I think controlling a process directly like this is beyond the scope of mushclient. Though if someone knows of a way, do let me know because i'd like to keep this as neat and clean as possible and I'd rather add a small dll to this plug in than install servers and consoles and applications to do this one thing.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #7 on Fri 15 Jan 2010 08:15 PM (UTC)

Amended on Fri 15 Jan 2010 08:19 PM (UTC) by Twisol

Message
I'm not sure if this was mentioned before, but you could write a script for MUSHclient that utilizes UdpListen() to listen for UDP packets to execute, and UdpSend() to transmit the ouput elsewhere. Then you'd write a relatively simple console program in some other language (could be C, could be Lua, doesn't matter), which takes your input and sends it as a UDP packet to the port MUSHclient's listening on, and listens for output from MUSHclient to display on-screen.

EDIT: At that point, you could try your hand at turning that console program into an AIM bot to interface with your graphical AIM client. [1]

[1] http://dev.aol.com/aim/bots

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Goumy   (7 posts)  Bio
Date Reply #8 on Fri 15 Jan 2010 10:08 PM (UTC)
Message
Rakon said:

To accomplish such a task, you'd be better off writing a small proxy for your localhost, for MUSHclient to connect to.


Onoitsu2 said:

create a listening socket on local host, and then do a Run() and parse the file itself into it


Twisol said:

UdpListen() to listen for UDP packets to execute, and UdpSend() to transmit the ouput elsewhere.


So yea, i'm working on the proxy. I'm trying to script it with netcat. The console aim client is bsflite, the win32 binary is a little weird as redirection doesn't redirect stdin, but the linux version works correctly. So I have cygwin, bash, netcat, and bsflite installed and I'm now working out a script that will listen on a port and pipe to bsflite. I'm having the same problem as I did last time with netcat in that I can only pipe one way. So I'm reading help files and tutorials and trying to figure out how to do something like

bsflite | nc -l -p 3000 - That pipes the client's output to port 3000

and i can telnet in and see it, but anything i send goes to bash's stdout, not the client's. So I need to do something like

nc -l -p 3000 | bsflite | nc localhost (port that i'm connecting to 3000 with)

Well thats what i'm working on anyway
Top

Posted by Goumy   (7 posts)  Bio
Date Reply #9 on Sat 16 Jan 2010 08:19 PM (UTC)
Message
I've run into another problem, and I'm just about at the end of this project.

I modified the aim client to print better through mushclient to make it easy to write triggers, but now now I see that there's no function to print from one world to another.

I need to do something like
trigger on *IM:* *
SendToWorld ("worldid", "m %2 %3")

I'm playing around with external files now to pass data, this whole project is a bloated mess, lol
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #10 on Sat 16 Jan 2010 08:58 PM (UTC)
Message
otherworld = GetWorldByID("world ID here")
otherworld.Note("stuff here")


Something like that.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Goumy   (7 posts)  Bio
Date Reply #11 on Sat 16 Jan 2010 09:36 PM (UTC)
Message
Thank you so much, my mud is now IM capable.
Now i need to clean up the source code of the aim client, i butchered this guy's code in order to figure out how it works.
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.


33,713 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.