PK
Y scripts/Newscript.jsIR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value)
{
IR.Log("Global Listener Activated: " + name + "\tValue: " + value);
});
// Subscribe
IR.SubscribeTagChange("Server.Channels.Virtual 1");PK
C1H H scripts/Scheme1.jsfunction Scheme1()
{
function TRSBlock_FromTag1()
{
TRSBlock.apply(this, arguments);
extend(TRSBlock, TRSBlock_FromTag1);
this.value = "Server.Tags.Virtual 1";
this.Execute = function(inputlist)
{
this.outparamlist[0].value = IR.GetVariable(this.value);
inputlist.push(this.outparamlist[0].SendValue());
return true;
}
}
function TRSBlock_SendToChannel1()
{
TRSBlock.apply(this, arguments);
extend(TRSBlock, TRSBlock_SendToChannel1);
this.value = "Server.Channels.Virtual 1";
this.Execute = function(inputlist)
{
IR.SetVariable(this.value, this.inparamlist[0].value);
return true;
}
}
var executor;
this.Init = function()
{
executor = new TRSchemeEexecutor;
var block_TRSBlock_FromTag1 = new TRSBlock_FromTag1;
var output_TRSBlock_FromTag1_0 = new TRSOutput;
block_TRSBlock_FromTag1.AddOutput(output_TRSBlock_FromTag1_0);
executor.AddBlock(block_TRSBlock_FromTag1);
var block_TRSBlock_SendToChannel1 = new TRSBlock_SendToChannel1;
var input_TRSBlock_SendToChannel1_0 = new TRSInput;
block_TRSBlock_SendToChannel1.AddInput(input_TRSBlock_SendToChannel1_0);
executor.AddBlock(block_TRSBlock_SendToChannel1);
output_TRSBlock_FromTag1_0.Input = input_TRSBlock_SendToChannel1_0;
executor.Prepare();
}
this.Execute = function()
{
executor.Execute();
}
}
var IRScheme_Scheme1;
IR.AddListener(IR.EVENT_START, 0, function()
{
IRScheme_Scheme1 = new Scheme1;
IRScheme_Scheme1.Init();
IRScheme_Scheme1_StartTimer();
});
function IRScheme_Scheme1_Execute()
{
IRScheme_Scheme1.Execute();
}
var IRScheme_Scheme1_Timer;
function IRScheme_Scheme1_StartTimer()
{
IRScheme_Scheme1_Timer = IR.SetInterval(2000, IRScheme_Scheme1_Execute);
}
function IRScheme_Scheme1_StopTimer()
{
IR.ClearInterval(IRScheme_Scheme1_Timer);
}
PK
#S scripts/ScriptSchemeCore.js// 8569FCBE-18EB-4179-912C-D70819425E64
function TRSInput()
{
this.parent = null;
this.state = 0;
this.value = 0;
this.loop = false;
this.invalue = 0;
}
function TRSOutput()
{
this.parent = null;
this.state = 0;
this.value = 0;
this.Input = null;
this.SendValue = function()
{
if (this.Input == null)
{
return null;
}
if (this.Input.loop == true)
this.Input.invalue = this.value;
else
this.Input.value = this.value;
this.Input.state++;
return this.Input;
}
}
function TRSBlock()
{
this.inparamlist = new Array();
this.outparamlist = new Array();
this.parent = null;
this.work = false;
this.AddInput = function(input)
{
this.inparamlist.push(input);
input.parent = this;
}
this.AddOutput = function(output)
{
this.outparamlist.push(output);
output.parent = this;
}
this.CheckState = function(value)
{
var i = 0;
while (i < this.inparamlist.length)
{
if (
(this.inparamlist[i].state != value) &&
(this.inparamlist[i].loop == false)
)
{
return false;
}
i++;
}
return true;
}
this.Clear = function()
{
this.inparamlist.length = 0;
this.outparamlist.length = 0;
}
this.SetState = function(value)
{
var i = 0;
while (i < this.inparamlist.length)
{
this.inparamlist.state = value;
i++;
}
i = 0;
while (i < this.outparamlist.length)
{
this.outparamlist.state = value;
i++;
}
}
}
function TRSchemeEexecutor()
{
this.currentstate = 0;
this.blocks = new Array();
this.indexOfArray = function(list, value)
{
var i = 0;
while (i < list.length)
{
if (list[i] === value)
return i;
i++;
}
return -1;
}
this.ProcessLoop = function(block, blockslist)
{
var i = 0;
var blist = new Array();
var nextblock;
i = 0;
while (i < block.outparamlist.length)
{
blist = blockslist.slice(0, blockslist.length);
nextblock = block.outparamlist[i].Input.parent;
if (this.indexOfArray(blist, nextblock) >= 0)
{
block.outparamlist[i].Input.loop = true;
}
else
{
blist.push(nextblock);
this.ProcessLoop(nextblock, blist);
}
blist.length = 0;
i++;
}
}
this.Prepare = function()
{
this.blocks.sort(
function(a,b)
{
if (a.inparamlist.length == 0)
return -1;
else
return 1;
}
);
var i = 0;
while (i < this.blocks.length)
{
this.blocks[i].SetState(0);
this.blocks[i].work = false;
i++;
}
var blockslist = new Array();
i = 0;
while (i < this.blocks.length)
{
if (this.blocks[i].inparamlist.length != 0)
break;
blockslist.length = 0;
blockslist.push(this.blocks[i]);
this.ProcessLoop(this.blocks[i], blockslist);
i++;
}
this.currentstate = 1;
}
this.ProcessInputs = function(inputlist)
{
var i = 0;
var ilist = new Array();
while (i < inputlist.length)
{
if (inputlist[i].parent.work == false)
{
if (inputlist[i].parent.CheckState(this.currentstate) == true)
{
ilist.length = 0;
inputlist[i].parent.work = true;
if (inputlist[i].parent.Execute(ilist) == false)
return false;
if (this.ProcessInputs(ilist) == false)
return false;
}
ilist.length = 0;
}
i++;
}
return true;
}
this.Execute = function()
{
var i, j;
i = 0;
while (i < this.blocks.length)
{
this.blocks[i].work = false;
j = 0;
while (j < this.blocks[i].inparamlist.length)
{
if (this.blocks[i].inparamlist[j].loop == true)
{
this.blocks[i].inparamlist[j].value = this.blocks[i].inparamlist[j].invalue;
}
j++;
}
i++;
}
var inputlist = new Array();
i = 0;
while (i < this.blocks.length)
{
if (this.blocks[i].inparamlist.length != 0)
break;
inputlist.length = 0;
this.blocks[i].Execute(inputlist);
this.ProcessInputs(inputlist);
i++;
}
inputlist.length = 0;
this.currentstate++;
}
this.AddBlock = function(block)
{
this.blocks.push(block);
block.parent = this;
}
}
function extend(Child, Parent)
{
var F = function() { }
F.prototype = Parent.prototype
Child.prototype = new F()
Child.prototype.constructor = Child
Child.superclass = Parent.prototype
}
PK
%ʼn Project.irp
this.Execute = function(inputlist)
{
this.outparamlist[0].value = IR.GetVariable(this.value);
inputlist.push(this.outparamlist[0].SendValue());
return true;
}
this.Execute = function(inputlist)
{
IR.SetVariable(this.value, this.inparamlist[0].value);
return true;
}
PK
2:^ ^
Config.xml
PK
Y scripts/Newscript.jsPK
C1H H scripts/Scheme1.jsPK
#S scripts/ScriptSchemeCore.jsPK
%ʼn y Project.irpPK
2:^ ^
( Config.xmlPK < 7,