mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-01-19 18:14:44 +00:00
Added script
This commit is contained in:
parent
fa724913e3
commit
18cccdeb7f
35
Mod Sources/TSExtension/TSExtension/script/tsExtension.cs
Normal file
35
Mod Sources/TSExtension/TSExtension/script/tsExtension.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
function tsExtensionLoop()
|
||||
{
|
||||
if (!$TSExtension::isActive)
|
||||
{
|
||||
error("TSExtension.cs - Unable to run loop! Is the DLL installed?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isEventPending($TSExtension::LastUpdateHandle))
|
||||
cancel($TSExtension::LastUpdateHandle);
|
||||
|
||||
tsExtensionUpdate();
|
||||
|
||||
$TSExtension::LastUpdateHandle = schedule(32,0,"tsExtensionLoop");
|
||||
}
|
||||
|
||||
if (!$TSExtension::isActive)
|
||||
loadMod("TSExtension");
|
||||
tsExtensionLoop();
|
||||
|
||||
// Test
|
||||
function Whatever::onSocketCreationFailed(%this){ error("Failed to create Socket"); }
|
||||
function Whatever::onConnectFailed(%this, %wsaError){ error(%wsaError); }
|
||||
function Whatever::onConnected(%this){ echo("GOOD"); }
|
||||
function Whatever::onDNSFailed(%this){ error("DNS Failed"); }
|
||||
function Whatever::onDisconnect(%this){ echo("Disconnected"); }
|
||||
|
||||
function Whatever::onLine(%this, %line)
|
||||
{
|
||||
echo(%line);
|
||||
%this.buffer = %this.buffer @ %line;
|
||||
|
||||
//if (trim(%line) $= "")
|
||||
// %this.altDisconnect();
|
||||
}
|
||||
Loading…
Reference in a new issue