76
Modification Help / Variable for Respawn Time (outside of a minigame)
« on: January 01, 2014, 11:55:36 PM »
Is there a variable for the respawn time of players outside of a minigame?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
//Documents functions in TorqueScript files and exports them to an HTML page.
//@param string mask A mask specifying one or more files. You may use the * wildcard.
//@param string title The project title, which will be displayed at the top of the navigation bar.
function document(%mask, %title)
{
%doc = new scriptGroup()
{
class = TorqueDoc;
projectTitle = (strLen(%title) ? %title : "TorqueDoc");
};
%doc.readFO = new fileObject();
%doc.add(%doc.readFO);
%doc.writeFO = new fileObject();
%doc.add(%doc.writeFO);
%doc.parse(%mask);
%functions = (%doc.numFunctions $= "" ? 0 : %doc.numFunctions);
echo("Documented" SPC %functions SPC "functions successfully.");
%doc.delete();
}
function SimObject::call(%this,%method,%v0,%v1,%v2,%v3,%v4,%v5,%v6,%v7,%v8,%v9,%v10,%v11,%v12,%v13,%v14,%v15,%v16,%v17)
{
%lastNull = -1;
for(%i = 0; %i < 18; %i ++)
{
%a = %v[%i];
if(%a $= "")
{
if(%lastNull < 0)
%lastNull = %i;
continue;
}
else
{
if(%lastNull >= 0)
{
for(%e = %lastNull; %e < %i; %e ++)
{
if(%args !$= "")
%args = %args @ ",";
%args = %args @ "\"\"";
}
%lastNull = -1;
}
if(%args !$= "")
%args = %args @ ",";
%args = %args @ "\"" @ %a @ "\"";
}
}
eval(%this @ "." @ %method @ "(" @ %args @ ");");
}
new scriptObject(test);
$method = "setColor";
$color = 0;
test.call($method, $color);
$ChainBatchSize = 100;
$ChainTimeOut = 10;
function SimGroup::chainMethodCall(%this,%method,%v0,%v1,%v2,%v3,%v4,%v5,%v6,%v7,%v8,%v9,%v10,%v11,%v12,%v13,%v14,%v15,%v16,%v17)
{
%batch = (%this.chain_batchSize $= "" ? $Slayer::Server::ChainBatchSize : %this.chain_batchSize);
%count = %this.getCount();
%index = (%this.chain_index $= "" ? %count - 1 : %this.chain_index);
%endIndex = (%index - %batch < 0 ? 0 : %index - %batch);
for(%i = %index; %i >= %endIndex; %i --)
{
%obj = %this.getObject(%i);
%obj.call(%method,%v0,%v1,%v2,%v3,%v4,%v5,%v6,%v7,%v8,%v9,%v10,%v11,%v12,%v13,%v14,%v15,%v16,%v17);
}
%this.chain_index = %endIndex - 1;
if(%this.chain_index <= 0)
{
if(isFunction(%this,%this.chain_callback))
%this.call(%this.chain_callback);
%this.chain_index = "";
%this.chain_batchSize = "";
%this.chain_timeOut = "";
%this.chain_callback = "";
}
else
{
cancel(%this.chain_schedule);
%time = (%this.chain_timeOut $= "" ? $Slayer::Server::ChainTimeOut : %this.chain_timeOut);
%this.chain_schedule = %this.schedule(%time,"chainMethodCall",%method,%v0,%v1,%v2,%v3,%v4,%v5,%v6,%v7,%v8,%v9,%v10,%v11,%v12,%v13,%v14,%v15,%v16,%v17);
}
}
Requires SimObject::call.brickgroup_11902.chain_batchSize = 100; //this is optional
brickgroup_11902.chain_timeOut = 10; //this is optional
brickgroup_11902.chain_callback = "myCallback"; //this is optional - when the recursive method finishes, brickgroup_11902::myCallback(%this) will be called.
brickgroup_11902.chainMethodCall("setColor", 5);
==>$test = 5.3;
==>echo($test);
5.3
==>echo($test == 5.3);
1
==>echo($test < 5.3);
0
==>echo($test > 5.3);
1
==>echo($test > 5.2);
0
==>echo($test > 5.4);
0
==>echo(5.3 > 5.3);
0
==>echo(5.4 > 5.3);
1
function SimObject::call(%this,%method,%v0,%v1,%v2,%v3,%v4,%v5,%v6,%v7,%v8,%v9,%v10,%v11,%v12,%v13,%v14,%v15,%v16,%v17)
{
%lastNull = -1;
for(%i = 0; %i < 18; %i ++)
{
%a = %v[%i];
if(%a $= "")
{
if(%lastNull < 0)
%lastNull = %i;
continue;
}
else
{
if(%lastNull >= 0)
{
for(%e = %lastNull; %e < %i; %e ++)
{
if(%args !$= "")
%args = %args @ ",";
%args = %args @ "\"\"";
}
%lastNull = -1;
}
if(%args !$= "")
%args = %args @ ",";
%args = %args @ "\"" @ %a @ "\"";
}
}
eval(%this @ "." @ %method @ "(" @ %args @ ");");
}
new scriptObject(test);
$method = "setColor";
$color = 0;
test.call($method, $color);
$ChainBatchSize = 100;
$ChainTimeOut = 10;
function SimGroup::chainMethodCall(%this,%method,%v0,%v1,%v2,%v3,%v4,%v5,%v6,%v7,%v8,%v9,%v10,%v11,%v12,%v13,%v14,%v15,%v16,%v17)
{
cancel(%this.chain_schedule);
%batch = (%this.chain_batchSize $= "" ? $ChainBatchSize : %this.chain_batchSize);
%index = (%this.chain_index $= "" ? 0 : %this.chain_index);
%count = %this.getCount();
%endIndex = (%index + %batch > %count ? %count : %index + %batch);
for(%i = %index; %i < %endIndex; %i ++)
{
%obj = %this.getObject(%i);
%obj.call(%method,%v0,%v1,%v2,%v3,%v4,%v5,%v6,%v7,%v8,%v9,%v10,%v11,%v12,%v13,%v14,%v15,%v16,%v17);
}
%this.chain_index = %index + %batch;
if(%this.chain_index >= %count)
{
if(isFunction(%this,%this.chain_callback))
%this.call(%this.chain_callback);
%this.chain_index = ""
%this.chain_batchSize = "";
%this.chain_timeOut = "";
%this.chain_callback = "";
}
else
{
%time = (%this.chain_timeOut $= "" ? $ChainTimeOut : %this.chain_timeOut);
%this.chain_schedule = %this.schedule(%time,"chainMethodCall",%method,%v0,%v1,%v2,%v3,%v4,%v5,%v6,%v7,%v8,%v9,%v10,%v11,%v12,%v13,%v14,%v15,%v16,%v17);
}
}
brickgroup_11902.chain_batchSize = 100; //this is optional
brickgroup_11902.chain_timeOut = 10; //this is optional
brickgroup_11902.chain_callback = "myCallback"; //this is optional - when the recursive method finishes, brickgroup_11902::myCallback(%this) will be called.
brickgroup_11902.chainMethodCall("setColor", 5);
At the time I posted this, Reddit and the police scanner were the only sources I could find. The Reddit page I linked was basically just a summary of the police scanner.Here is a BBC source: http://www.bbc.co.uk/news/world-us-canada-22212946
new scriptObject(ServerEventTargetSO);
function ServerEventTargetSO::echo(%this,%val)
{
echo(%val);
}
addEventTarget("Server ServerEventTargetSO","","ServerEventTargetSO.getID()");
registerOutputEvent(ServerEventTargetSO,"Echo","string 200 176",0);
This would allow you to create events like onActivate => Server => Echo [Hello, world!]addEventTarget("Team(Client) Slayer_TeamSO","GameConnection","%client.getTeam()");
addEventTarget("Team(Brick) Slayer_TeamSO","fxDtsBrick","%this.getControlTeams()");
registerOutputEvent(Slayer_TeamSO,"BottomPrintAll","string 200 156" TAB "int 1 10 3" TAB "bool 0",1);
v1.1:
- Prevented duplicate entries.
- Added some commenting.