Jump to content
exinferis

Is there some way for external communication

Recommended Posts

I am looking for a way to let the server communication with external applications, for example let an external application handle some workload.
Right now the only way of "communication" I found is over reading and writing JSONs.... Write a request for example in a JSON, make the applications take  the request and write the answer back in a JSON to let that be read by the server.

But this is a very inperformant way of using it.

 

To be more clear, I want to extend the actions and decission making of the AI to an external application... first to get the engine more "lightweight" and to have more ways to configure or define the actions / reactions.

 

An API or event driven trigger would be nice on that.

Share this post


Link to post
Share on other sites

Idk how it is used, if it works or if it generally is but there is a REST API.
Just use the script editors Find Symbol subwindow and search for "rest"

Share this post


Link to post
Share on other sites

Thanks, was not thinking of searching like this... so far it just delivers the context, but there are more "API" results so I will check if there is something I can use.

Share this post


Link to post
Share on other sites


via ArkensoR (https://discord.com/channels/105462288051380224/976155351999201390/996058255010832525 )

 

class TestCallback : RestCallback
{
    override void OnSuccess( string data, int dataSize )
    {
        Print(" !!! OnSuccess() size=" + dataSize );
        if( dataSize > 0 )
            Print(data); // !!! NOTE: Print() will not output string longer than 1024b, check your dataSize !!!
    };
}
...
auto ctx = GetGame().GetRestApi().GetContext("https://webhook.site/XXXX-YOUR-GUID-XXXXX");
TestCallback callback();
//ctx.POST(callback,"RequestPath?Argument=Something", "Hello World");
ctx.POST(callback,"RequestPath?Argument=Something", "{\"someVar\": 1337}");

 

Edited by jerryhopper
code formatting

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×