polserver/testsuite/pol/testpkgs/client/clientconnection.src
turleypol c6f957d4fa
Testclient api: listobjects, open backpack, target (#393)
* added api to get information of the internal state of the client
lock cleanup

* test cleanup
added ability to ignore tests
client communication can now be transfered to different scripts
setup script handles now the initial connection

* added api for open backpack and target/targetcoordinates

* helper function to create account with char
fixed signed char range
added testclient timeout for initial connection

* higher timeout
2021-03-28 14:25:56 +02:00

26 lines
559 B
Text

use os;
use uo;
program clientconn(con, testscript)
SetGlobalProperty("#clientcon", getpid());
while (1)
var ev:=Wait_For_Event(10);
if (!ev)
continue;
endif
if (ev.?todo)
var json:=PackJson(ev);
syslog(" to client: "+json,0);
con.transmit(json);
if (ev.todo=="exit")
break;
endif
elseif (ev.?ownership)
testscript:=ev.ownership;
else
syslog(" from client: "+ev,0);
var e:=UnpackJson(ev.value);
testscript.sendevent(e);
endif
endwhile
endprogram