ID:260727
May 29 2009, 8:41 am
|
|
Is there a way for a DLL file to respond back to BYOND? Like, call a proc or Topic()? If so, could you show a snippet of how one may achieve this? If not, could I request this as a feature?
|
Copyright © 2024 BYOND Software.
All rights reserved.
I would assume not directly. Byond would have to allow you to pass a function-pointer to the function in the DLL so that the DLL knew where the function was. Not only does Byond not support function pointers, but as far as I have read Byond only allows you to send text strings as DLL function arguments.
However, you could probably set something up to accomplish what you want in a not-nearly-as-easy-as-you-want method.
Either have the DLL function return a text string, then you can use call() a second time to call the appropriate function, or do something similarly crafty.
If you mean open communications with the world as opposed to calling Topic() from inside the world directly (opening communications to talk the same way another world would, for example), then yes, that is something you can do. Just open a normal TCP socket to the running world's address and talk to it using the format that Byond worlds use to talk to each other. That would be the more difficult part, but, fortunately, I recall someone posted the format a long time ago. I don't remember who though, sorry, but it might be something you could dig up.
For having it call a Byond function (this is the easy and obvious one)...
As for making something more complicated, you could have the world and the function in the DLL file talk to each other with an open socket, and you could make functions for handling your own "callback" system.
And the DLL function would open a socket and send the appropriate message.
But then this goes right back to your question about using Topic()...
(edit)
This is not the post I was thinking of specifically, but it is basically the same thing. Someone constructing a message in PHP to send to a Byond world that will cause the Byond world to call Topic() and process a message.
It's not C, but it still demonstrates the message format. This should solve your problem.
(edit of the edit)
OOPS! Would help if I put in the id.
ID:394116
(edit2)
Even better yet...
[link]