ID:173166
 
Well, I kinda stole Digi's idea of the world message thing, but I can't get it to work.
//In my "Messaging" world
world/Topic(T,Addr,Master,Key)
..()
var/list/href_list = params2list(T)
switch(href_list["action"])
if("regworld")
var/newaddress = href_list["address"]
var/newport = href_list["port"]
for(var/addy in server_list)
if(addy == newaddress && server_list[addy] == newport)
return
server_list += newaddress
server_list[newaddress] = newport
var/global/server_list

proc
WorldsOutput()
for(var/place in server_list)
if(place)
world.Export("byond://[place]:[server_list[place]]?message=message=This+is+a+test+message.")

world/OpenPort()
while(1)
WorldsOutput()
sleep(100)

//In my recieving world, the actual game
world/OpenPort()
..()
world.Export("24.239.185.221:12?action=regworld&address=[world.address]&port=[world.port]")
world/Topic(T)
var/list/href_list = params2list(T)
if(href_list.Find("message"))
world << "SERVER WIDE ANNOUNCEMENT: [href_list["message"]]"
..()
//I know, there's no check to see if it's really me...Aw well, I'll add another param later.


Well, the thing is simply, nothing happens. Can someone please help?
I'm actually re-creating the exact set up I was describing in digi's post, and I am also hitting a roadblock. It would seem that it has to do with the OpenPort proc. Currently I have it set up with some debugging messages that are not being displayed, like so:

world
OpenPort()
. = ..()
if(.)
reg_world()

proc/reg_world()
world<<"REGWORLD CALLED"
world.Export("byond://127.0.0.1:1300?action=regworld&address=[world.address]&port=[world.port]")


That should take next to no time to export since it's going to the loopback address. However, it seems that reg_world is never being called, as I never see the REGWORLD CALLED output. Since I know Lummox is working directly with the DM source, I was wondering if he could provide some insight.
In response to sapphiremagus
Thanks to OneFishDown, I got it working:
//Messaging project
world/Topic(T,Addr,Master,Key)
..()
var/list/href_list = params2list(T)
switch(href_list["action"])
if("regworld")
var/newaddress = href_list["address"]
var/newport = href_list["port"]
for(var/addy in server_list)
if(addy == newaddress && server_list[addy] == newport)
return
server_list += newaddress
server_list[newaddress] = newport
var/global/list/server_list=list()

proc
WorldsOutput()
world<<"outputs"
for(var/place in server_list)
world<<"for"
if(place)
world<<"place"
world.Export("byond://[place]:[server_list[place]]?message=<font size=3><center>------<br>Annoucement by Host:<br>[ServMess]<br>------</center></font>")
world/New()
sleep(10)
..()
while(1)
if(world.port)
WorldsOutput()
sleep(6000)
var/global/ServMess="This server is hosted by Airjoe Services!"

//The game to recieve the message
world/New()
..()
while(1)
if(world.port)
world.Export("24.239.185.221:12?action=regworld&address=[world.address]&port=[world.port]")
break
sleep(10)
world/Topic(T)
var/list/href_list = params2list(T)
if(href_list.Find("message"))
world << "SERVER WIDE ANNOUNCEMENT: [href_list["message"]]"
..()


Thanks also to Spuzzum and sapphiremagus for making the base code.

<-Airjoe->
In response to Airjoe
*beams proudly for instigating this line of thought!*

good work guys!
In response to digitalmouse
Actually, I've been working on a litte piece that seems to be exactly what you all are looking for. It helps to keep track of and communicate with worlds created on the same server as well as worlds located on other servers that you designate as "associates".
In response to digitalmouse
Yeah, but now you're gonna steal their code :-).