ID:159663
 
Is there a way to quickly send a message from one local server to another?

Like, not actually connecting the two messages but just sending some output like, "Hi" or ,"I LIKE JAM!"
Look up world/Export() and world/Topic().
In response to Jeff8500
It'll take me a bit to figure out what to do with them since it took me 20 minutes staring at topic to figure it out, and the fact that the DM guide has "fantasmically" insane grammar makes it even harder isn't helping
In response to Choka
Nevermind for some reason reading the DM guide seems "fantasmically" easier to read. <----------- Is getting better grades in Comm. Skills =D
In response to Jeff8500
Oh gawsh sorryy for all the posts but how am I going to retrieve the address of the recipient?
In response to Choka
What do you mean? How is the sender going to get the receiver's address? You either have to hard code it, use user input, or grab it from a webpage/other server.

For example(s) (these will not be valid addresses):

The recipient's address will always be byond://392332..234232
You send it to byond://39whateverIwrote. The server at byond://whateverIwrote then uses the address arg in world/Topic() to get the sender's address, and they are connected.

User input is self explantory.

If you take a hub address (ex. http://byond.com/games/jeff8500/RealTimeDefense) and add ;format=text to the end of the url, it will present data from the hub in an easy to read-by-computers format. You just parse the data using findText() and copytext() and you're set.

If you wish to have one central server connecting all the other servers, that would probably be the best move. It would kind of look like this:

.......[].........
...../.|.\........
...[]..[].[]......

Where [] is a computer, . is blank space, and lines (|, \, and /) are connections.
In response to Jeff8500
I'm probably going to say something annoying but:
You're assuming that I know how to use Topic fully..when I don't at all. The most I can do is something like a link that starts the game. I don't know how I'm going to define the address in the world/Topic() and yush I've just tried.
In response to Choka
Define the address? It's a predefined arg, no work required.
In response to Jeff8500
I know..but how am I supposed to get the actual address into world/Topic() I'm deathly sure you just don't type: "The arg is predifined as byond://xx.xxx.xxx.xx:xxxx", And what is the T in Topic supposed to mean..? I mean, it's obviously predefined but nothing anywhere explains it.
In response to Choka
World/Topic is called when a message is received from another server, so there's no need to know an address when using that proc.

Also, from the reference:
T: The topic text string specified by the remote server (everything following ? in the URL).
In response to Choka
You send the message with world.Export(), world.Topic() receives the message.
In response to Choka
From the reference: "Topic(T,Addr,Master,Key)".

var/greeting_response = "G'day, mate!"

world/Topic(recievedstring,senderaddress,forgetwhatthisis,forgetwhatthisis2)
if(recievedstring == "Hello") world.Export("[senderaddress]?[greeting_response]")
In response to Falacy
I know that...but that still didn't tell me how I'm supposed to do it. That just tells me what each of them would do in this situation.
In response to Jeff8500
Oh my, finally you've revealed what I wanted to know. I kept staring at that Addr but I wasn't paying attention.
In response to Jeff8500
'forgetwhatthisis' is 1 if the server is sending a message to itself. This can be done from Dream Daemon by hitting Alt+T.

I think 'forgetwhatthisis2' is the key of the host of the sender.
In response to Jeff8500
Actually..what I Was looking for wasn't the senders address. But the address being sent to. Like, does it have to be defined in world.Topic() or can I just post a direct port from options&messages
In response to Choka
Your server's address is world.internet_address.
In response to Choka
Choka wrote:
Actually..what I Was looking for wasn't the senders address. But the address being sent to. Like, does it have to be defined in world.Topic() or can I just post a direct port from options&messages

The part you're having trouble understanding has nothing to do with Topic(), what you're getting confused about is the world.Export() portion of the code. Since you apparently didn't understand me before, lets try this again:

I know..but how am I supposed to get the actual address into world/Topic() I'm deathly sure you just don't type: "The arg is predifined as byond://xx.xxx.xxx.xx:xxxx", And what is the T in Topic supposed to mean..? I mean, it's obviously predefined but nothing anywhere explains it.

//use this proc on the sending server/game
proc/SendMessage(var/Msg)
Msg="Pants" //of course, in actual use; you wouldn't want this line here
//you may however want arguments available for IP/Port, assuming you're sending to multiple places
world.Export("byond://xxx.xxx.xxx.xxx:xxxx?[Msg]") //sends a message to a server
//to get an actual address, you either have to know it in advance, or use one of the methods Jeff mentioned

//use this on the receiving server/game
world/Topic(T,Addr)
world<<"[Addr] sent message: [T]"
//this will output the message "Pants" to the world, from whoever sent you the message

//Note: Both functions could be used on the same server/game; if they're meant to communicate with eachother

EDIT: I fixed the mistake of having : instead of ? in world.Export
In response to Choka
If you want to send a message to another BYOND world hosted on the same computer (which is how it seems from your first post), you can simply use 127.0.0.1 as the address. This IP address is a special one that always translates to the local computer, ie the same one it's being used on - so for anyone, it will reach their own computer. The port is of course the port the destination BYOND world is listening (hosting) on (by the way, the sending world doesn't have to be hosted).
In response to Nickr5
Nickr5 wrote:
'forgetwhatthisis' is 1 if the server is sending a message to itself. This can be done from Dream Daemon by hitting Alt+T.

That might work too, but the purpose for that variable is to check whether the master world sent it.

For example, if you start Server A and this uses the startup() proc to start Server B... then if Server A sends a command to Server B, the "forgetwhatthisis" ("Master") variable will be set.

Rule of thumb: if the "Master" variable is set, the server should completely trust the command and obey it.

There are two default topic calls -- Del and Reboot -- which will only work if the variable is set.