[Solved] Sending messages out of AGS

Started by MtS, Wed 08/10/2014 15:36:47

Previous topic - Next topic

MtS

Ok, I'm thinking about doing a project in AGS studio, but first I need to know, if there's a way how to send some sort of messeges from the studio. I couldn't find anything in the manuals. I would like to trigger other things (projections on other screens and stuff) depending on some in-game triggers. Being able to send MIDI messages out of the studio would do the trick, or at least making some key pressed for a while (that would also be enough). I mean something like:
   
      IsKeyPressed(eKeyK)= true;
      Wait(50);
      IsKeyPressed(eKeyK)= false;

I know IsKeyPressed doesn't work that way and is only a condition checker, but I hope you get the idea of what I need. Unfortunately I couldn't find anything so far, but I really hope it would be possible.

EDIT: I'm starting to think it might be impossible to send any kind of information out of the program (if it is not directly associated with the current input). Basically all I need to do is send some kind of information (like a key input) that would not be dependant on the actual input... I hope I make some sense. English is not my native language, but I hope my question is clear. I can use key inputs or midi messages to trigger things in different programs but I would like to be able to send them from AGS directly through scripting so I can trigger for exmple a video on another screen when player perform some action. I know it's not a common need but if anyone has some idea, I would appreciate it.

Crimson Wizard

#1
Do you mean, you want to send a message to another program?

If the other programs are written by you too, or act as client/server themselves, then the most natural way I can think of is to use Sockets plugin and converse with other programs via TCP/UDP connection:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=48937.0

You could also use ShellExecute plugin to run other programs (may be unsafe):
http://www.adventuregamestudio.co.uk/forums/index.php?topic=30948.msg397988#msg397988

You could also write to a file (doeable with AGS script), and have other program check if it is updated and read from it.

MtS

#2
Quote from: Crimson Wizard on Thu 09/10/2014 08:21:40
Do you mean, you want to send a message to another program?

If the other programs are written by you too, or act as client/server themselves, then the most natural way I can think of is to use Sockets plugin and converse with other programs via TCP/UDP connection:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=48937.0

You could also use ShellExecute plugin to run other programs (may be unsafe):
http://www.adventuregamestudio.co.uk/forums/index.php?topic=30948.msg397988#msg397988

You could also write to a file (doeable with AGS script), and have other program check if it is updated and read from it.
Thanks for the suggestions where to look. I'll go over it during the weekend and let you now about what worked for me. The third option (saving and reading from a text file) actually seems like a solution, that could work :D I'll try to write another program to read from the file and sending the messages.

To clarify, the project I'm working on is an installation project and the user won't be using keyboard inputs at all. Thats why I thought the easiest way to do it would be sending key inputs directly from AGS (unfortunately that's probably impossible).

RickJ

Quote
To clarify, the project I'm working on is an installation project and the user won't be using keyboard inputs at all. Thats why I thought the easiest way to do it would be sending key inputs directly
You may want to look into AutoIt and AutoHotKey as these were designed to do exactly what you describe.

https://www.autoitscript.com/site/
http://www.autohotkey.com/

MtS

#4
Oops I accidently removed my previous reply, but anyway...

I've managed to write a looped program to read the txt output from AGS in AutoHotkey. The program than sends key inputs depending on the output it reads. After searching through the AutoHotKey documentation for a while it was pretty easy. In AGS I first had a small problem because I didn't realize AGS is using it's own encoding, but fortunately the WriteRawLine() function helped with that. Now everything is solved and prepared as I am able to simulate key inputs. So thank you all!

MtS

#5
This topic can now be closed as solved I think.

SMF spam blocked by CleanTalk