Sending events from sessions to uplink

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
Jon100
Non-Subscriber
Posts: 32
Joined: Wed Nov 24, 2004 1:38 pm

Sending events from sessions to uplink

Post by Jon100 » Mon May 12, 2008 4:53 am

I'm currently building a controller script to run on the uplink that loads up game sessions as needed. I can get the controller to send events to its local sessions, but not the other way around.

Code: Select all

function main() 
{
	LavishScript:RegisterEvent[My_Event]
	Event[My_Event]:AttachAtom[MyEventExecuted]

	while (1) 
		waitframe 
} 

atom(script) MyEventExecuted(string mydata)
{
	echo "Event detected! ${mydata}"
}
The command

Code: Select all

Relay is1 -event My_Event "some data here"
works from uplink to session.

But when I try sent events from the sessions to the uplink....

Code: Select all

uplink -event My_Event "some data here"     is invalid
relay uplink -event My_Event "some data here"     does nothing.
relay all -event My_Event "some data here"    does nothing
Am I missing the right command or is this just not possible?
Jon100 / Dorset
"No of course I don't use that macro thingy to 6 box... I just use 6 keyboards at once..."

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Mon May 12, 2008 9:29 am

To relay to the uplink with the relay command, you must refer to the uplink by its given name, which defaults to your computer name.

You can alternatively execute the event as a command:
uplink Event[My_Event]:Execute["some data here"]

The -event switch is a convenience to reduce the amount of escaping you need to do in certain circumstances, and is not available on the uplink command

Jon100
Non-Subscriber
Posts: 32
Joined: Wed Nov 24, 2004 1:38 pm

Post by Jon100 » Mon May 12, 2008 9:56 am

Fantastic!

By the way, is there a way to get your computer's name in LS?
Jon100 / Dorset
"No of course I don't use that macro thingy to 6 box... I just use 6 keyboards at once..."

eqjoe
GamingTools Subscriber
Posts: 221
Joined: Wed Oct 13, 2004 2:34 pm

Post by eqjoe » Mon May 12, 2008 12:42 pm

Do a "Uplink RemoteUplink -list"

-j

Jon100
Non-Subscriber
Posts: 32
Joined: Wed Nov 24, 2004 1:38 pm

Post by Jon100 » Tue May 13, 2008 6:12 am

Hi Joe. :)

No, I mean a scripted way of getting the name. I currently have to create a servername.xml file on each of my computers containing the name of the current server so that my scripts know the server's name.

I can manually work out the name of my computers easily enough by looking at the big sicky label on the front case with their names printed on :wink:

Is there something like ${System.SystemName} that I could use instead?
Jon100 / Dorset
"No of course I don't use that macro thingy to 6 box... I just use 6 keyboards at once..."

eqjoe
GamingTools Subscriber
Posts: 221
Joined: Wed Oct 13, 2004 2:34 pm

Post by eqjoe » Tue May 13, 2008 11:21 am

Ah.. sorry. Sounds like a feature request :)

-j

eqjoe
GamingTools Subscriber
Posts: 221
Joined: Wed Oct 13, 2004 2:34 pm

Post by eqjoe » Tue May 13, 2008 11:44 am

Or, you could write a quick extension that adds a SystemName command that returns the Windows local hostname. Use ISXDK and MKISX.exe, modify the resulting project.

After you add your command

Code: Select all

pISInterface->AddCommand("Sysname",Sysname,true,false);) 
and its return

Code: Select all

int __cdecl Sysname(int argc, char *argv[])
{
	printf("szHostName");
	return 0;
}
Something along the lines of..

Code: Select all

#include <winsock2.h>
WSADATA WSAData;

if&#40;&#58;&#58;WSAStartup&#40;MAKEWORD&#40;1, 0&#41;, &WSAData&#41; == FALSE&#41;

// Get local host name
char szHostName[128] = "";
-j

eqjoe
GamingTools Subscriber
Posts: 221
Joined: Wed Oct 13, 2004 2:34 pm

Post by eqjoe » Tue May 13, 2008 11:51 am

Ok.. that would never work. You dont want szHostName in quotes and you would have to add error handling after checking WSAStartup, but you get the idea...

-j

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Tue May 13, 2008 11:58 am

it would be much easier to use System:APICall to call GetComputerName, but you can grab the name of the uplink via lavishscript.

Copied from DefaultUplinkUI.XML:

Code: Select all

$&#123;SettingXML[InnerSpace.XML].Set[Remote].GetString[Name].Escape&#125;

eqjoe
GamingTools Subscriber
Posts: 221
Joined: Wed Oct 13, 2004 2:34 pm

Post by eqjoe » Tue May 13, 2008 1:32 pm

Networking dudes like me use WinSock :(


Thanks Lax.


-j

Jon100
Non-Subscriber
Posts: 32
Joined: Wed Nov 24, 2004 1:38 pm

Post by Jon100 » Tue May 13, 2008 1:40 pm

Clueless guys like me faint at winsocks API calls. Thanks guys :)
Jon100 / Dorset
"No of course I don't use that macro thingy to 6 box... I just use 6 keyboards at once..."

Post Reply