function modSettingsLoader(settingsName:String, f:Function, cData:String=null)
{
addEventListener("settingsLoaded",f);
this.cData = cData;
retDict = null;
modSettingsName = settingsName;
settingsName = settingsName.split(".txt").join("");
mSL.addEventListener(Event.COMPLETE,onModSettings);
mSL.addEventListener(IOErrorEvent.IO_ERROR,retryModSettings);
mSL.load(new URLRequest("Mods/" + ((cData == null) ? loader.cData : cData) + "/" + modSettingsName + ".txt"));
}
just so you know, animtools uses a modified copy of the controls xDMG said:If I remove the fading effect it will probably make them a lot less taxing.
Even easier, if the menu is closed then all modPages will be rendered hidden and if the Control is hidden/disabled I'll have it skip its draw events.
We'll see how that goes.
(old 5.39 source btw, but i doubt they changed)for (var j:uint = 0; j < post.length; j++)
if(ret != undefined) post[j][0].apply(null, [ret]);
else post[j][0]();
that works fine for 1 mod, but trying to do this with multiple mods. i would need to be able to grab the return result from another mod's proxy.Pim_gd said:unhook original, call original, get response, return result. I don't see the problem.
You'll want to use a pre for this.
If you're not the last one to proxy the method you might be skipping some pre functions though. You can always check if you're last, and if not, push yourself into the array and then remove yourself from the array when you're called again later. Yeah, it's pretty nasty.
>_>MG said:While I can see the utility, built in save is unsupported. Feel free to take Pim's suggestion.
The loader aims to use files as a means to save/load data and settings are provided for mods. Using the vanilla code will result in disaster, I can feel it.
package Modules
{
import flash.utils.Dictionary;
public class lProxy
{
public static var proxies:Dictionary = new Dictionary();
public var methodName:String;
public var original:Function;
public var target:Object;
public var hooked:Boolean = true;
public var pre:Array = new Array();
public var post:Array = new Array();
public var argarray:Array = new Array();
public function lProxy(e:Object, f:String)
{
target = e;
original = e[f];
methodName = f;
if(!proxies[e])
proxies[e] = new Dictionary();
proxies[e][f] = this;
e[f] = forwardMethod;
}
public static function createProxy(e:Object, f:String):lProxy{
var parentProxy:lProxy = checkProxied(e, f);
if(parentProxy) return parentProxy;
return new lProxy(e, f);
}
public function addPre(f:Function, p:Boolean):void{
pre.push([f, p]);
}
public function addPost(f:Function, p:Boolean):void{
post.push([f, p]);
}
public function addarg(f:Function, p:Boolean):void{ //sby changes here
argarray.push([f, p]);
}
public function forwardMethod(... args):* {
var ret = undefined;
var temp = undefined;
for (var i:uint = 0; i < pre.length; i++){
temp = pre[i][0].apply(null, args);
if(temp != undefined) ret = temp;
}
if(hooked && ret == undefined){
temp = original.apply(target, args);
if(temp != undefined) ret = temp;
}
for (var k:uint = 0; k < argarray.length; k++) //sby changes here
{
if(ret != undefined)
{
temp = argarray[k][0].apply(null, [ret]);
}
else
{
temp = argarray[k][0]();
}
if(temp != undefined) ret = temp;
}
for (var j:uint = 0; j < post.length; j++)
if(ret != undefined) post[j][0].apply(null, [ret]);
else post[j][0]();
if(ret != undefined) return ret;
}
public static function checkProxied(e:Object, f:String):lProxy{
if(proxies[e]) return proxies[e][f];
return null;
}
public function removePre(f:Function):void{
for (var i:uint = 0; i < pre.length; i++)
if(pre[i][0] == f){
pre.splice(i, 1);
break;
}
}
public function removePost(f:Function):void{
for (var i:uint = 0; i < post.length; i++)
if(post[i][0] == f){
post.splice(i, 1);
break;
}
}
public function removeArg(f:Function):void{ //sby changes here
for (var i:uint = 0; i < argarray.length; i++)
if(argarray[i][0] == f){
argarray.splice(i, 1);
break;
}
}
public function restoreProxy(force:Boolean = false):void{
if(force){
pre = new Array();
post = new Array();
argarray = new Array();
}else{
for (var i:int = pre.length-1; i >= 0; i--)
if(!pre[i][1])
pre.splice(i, 1);
for (var j:int = post.length-1; j >= 0; j--)
if(!post[j][1])
post.splice(j, 1);
for (var k:int = argarray.length-1; k >= 0; k--) //sby changes here
if(!argarray[k][1])
argarray.splice(k, 1);
}
if (pre.length + post.length + argarray.length == 0 ){ //sby changes here
target[methodName] = original;
delete proxies[target][methodName];
}
}
public static function restoreProxies(force:Boolean = false):void{
for (var i in proxies)
for each (var lp:lProxy in proxies[i])
lp.restoreProxy(force);
}
}
}
hmm, does seem to be very few functions that return something that a complete replace would hurt. guess i shall do my own workaround thenMG said:Provide for me three distinct, useful examples of this proxy extension (discounting charcodes) and I'll add it.
Of course, addargs sounds rubbish so suggest a better name.
WeeWillie said:Help! On Loader 5.34, I could load a series of body mods I made that have overwrite set to false (in my example, whip marks). They would all load on top of one another. Now on Loader 5.40, the body mods replace the last one. How can I get the behavior of additive mods back? Is there a property within the mod I need to set? Thanks!
Thanks so much! That did it. Too much stuff to read on the threads to keep track of it all.Azelath said:I recently asked this exact same question! I was even using v5.34. Version 5.41a fixes this issue.