Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mctwist
- {
- function EventScriptClient_save()
- {
- %list = new ScriptObject();
- %events = WrenchEvents_Box.highestOrder;
- if(%events < 2)
- return;
- %list.count = 0;
- for(%a=0;%a<%events;%a++)
- {
- %swatch = WrenchEvents_Box.order[%a];
- if(!isObject(%swatch.outputButton))
- continue;
- %list.count++;
- %list.value[%a, "line"] = %a;
- %list.value[%a, "enabled"] = %swatch.enabledBox.getValue();
- %list.value[%a, "delay"] = %swatch.delayBox.getValue();
- %list.value[%a, "inputEventName"] = %swatch.inputButton.getValue();
- %list.value[%a, "targetName"] = %swatch.targetButton.getValue();
- if(%swatch.targetButton.getValue() $= "Named Brick")
- {
- %list.value[%a, "targetName"] = "";
- %list.value[%a, "NTName"] = %swatch.namedBrickButton.getValue();
- }
- %list.value[%a, "outputEventName"] = %swatch.outputButton.getValue();
- for(%b=0;%b<%swatch.params;%b++)
- %list.value[%a, "params"] = %list.value[%a, "params"] @ getParam(%swatch.param[%b],true) @ "\t";
- }
- return EventScript_toScript(%list);
- }
- function EventScriptClient_load(%script)
- {
- %list = EventScript_fromScript(%script);
- clearWrenchEventsBox();
- WrenchEventsDlg.newEvent();
- for(%a = 0; %a<%list.count; %a++)
- {
- %bottomSwatch = WrenchEvents_Box.order[WrenchEvents_Box.highestOrder-1];
- %bottomSwatch.enabledBox.setValue(%list.value[%a,"enabled"]);
- %bottomSwatch.delayBox.setValue(%list.value[%a,"delay"]);
- %bottomSwatch.inputButton.noFocus = true;
- for(%b=0;%b<$InputEvent_CountfxDTSBrick;%b++)
- if($InputEvent_NamefxDTSBrick_[%b] $= %list.value[%a,"inputEventName"])
- %bottomSwatch.inputButton.setSelected(%b);
- %targets = $InputEvent_TargetListfxDTSBrick_[%bottomSwatch.inputButton.getSelected()];
- %bottomSwatch.targetButton.noFocus = true;
- if(%list.value[%a,"targetName"] $= "" || %list.value[%a,"targetName"] $= " ")
- {
- %bottomSwatch.targetButton.setSelected(999);
- %nameID = -1;
- for(%b=0;%b<ServerConnection.NTNameCount;%b++)
- {
- if(ServerConnection.NTName[%b] $= ("_" @ %list.value[%a,"NTName"]))
- {
- %nameID = %b;
- break;
- }
- }
- if(isObject(%bottomSwatch.namedBrickButton))
- %bottomSwatch.namedBrickButton.setSelected(%nameID);
- }
- else
- {
- for(%b = 0; %b<getFieldCount(%targets); %b++)
- {
- %target = getField(%targets,%b);
- if(getWord(%target,0) $= %list.value[%a,"targetName"])
- %bottomSwatch.targetButton.setSelected(%b);
- }
- }
- %tar = %bottomSwatch.targetButton.getSelected();
- if(%tar == 999)
- %tar = 0;
- %className = getWord(getField(%targets,%tar),1);
- for(%b=0;%b<$OutputEvent_Count[%className];%b++)
- if($OutputEvent_Name[%className,%b] $= %list.value[%a,"outputEventName"])
- %bottomSwatch.outputButton.setSelected(%b);
- %params = getFieldCount(%list.value[%a,"params"]);
- for(%b=0;%b<%params;%b++)
- {
- %element = %bottomSwatch.param[%b];
- %param = getField(%list.value[%a,"params"],%b);
- if(%element.paramType $= "intlist" || %element.paramType $= "string" || %element.paramType $= "int" || %element.paramType $= "float" || %element.paramType $= "bool")
- %element.setValue(%param);
- else if(%element.paramType $= "vector")
- {
- %element.getObject(0).setValue(getWord(%param,0));
- %element.getObject(1).setValue(getWord(%param,1));
- %element.getObject(2).setValue(getWord(%param,2));
- }
- else if(%element.paramType $= "list" || %element.paramType $= "datablock")
- %element.setSelected(%element.entryID[%param]);
- else if(%element.paramType $= "paintColor")
- {
- %element.picked = %param;
- %element.color = getColorI(getColorIDTable(%param));
- }
- }
- %lastCreatedSwatch = %bottomSwatch;
- }
- }
- };
- activatePackage(mctwist);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement