SDT Loader question (2 Viewers)

ModGuy

Content Creator
Joined
Feb 17, 2011
Code:
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"));
}

You can provide cData if you like, allows targeting subfolders etc. Since cData is set on loading the mod you can have it auto populate then pass it in.
This way it will use the provided path instead of defaulting on the last known path.
 

Bluey5

Potential Patron
Joined
Aug 22, 2013
When I switch the tab to another mod, animtools continues to overlap the others, and I can't access the other tabs any longer...what the hell is this? lol
 

Attachments

  • Overlapping Issue.png
    Overlapping Issue.png
    195.6 KB · Views: 1,096

sby

Content Creator
Coder
Joined
Sep 11, 2012
hmm, didn't realize the loader did pages by toggling visibility

sorry modguy, this one is caused by me xD
i wanted to ensure that the game wasn't rendering those very stressful buttons, so i had some auto hiding and showing when the menu was lowered and raised xD

i think i should be able to fix this by throwing the animtools page movieclip inside another movieclip. so the loader can toggle the master visibility, while animtools can toggle the inside visibility

edit - uploaded a fixed version
 

ModGuy

Content Creator
Joined
Feb 17, 2011
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.
 

sby

Content Creator
Coder
Joined
Sep 11, 2012
MG 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.
just so you know, animtools uses a modified copy of the controls xD
so if you start testing with animtools expecting changes, i don't think you will see any.

also, pretty sure if they are hidden then the controls don't slow things down, this is why i was hiding them in the first place
 

sby

Content Creator
Coder
Joined
Sep 11, 2012
mg, i might be interested in adding a new type of proxy, one that proxies the return value

so we have the pre's that accept the original functions arg's and go first, and roll over the return value
then we have post's that don't get any args and go after the pre's have been processed

i would be interested in a return value proxy, where the input type to the function would be the same as the output type.
these would be ran after the pre's have been done so that way the return value has been rolled over already.
these proxy functions would used to only modify the return value of the function (hopefully in adding additional data to the return value)

this is mostly for supporting multiple mods to support using charcode to save custom mod data. right now, i have moreclothing proxy getsavedatastring to allow saving body mod cofigurations. this function generates the string that represents charcode.
if we could make these new type of proxies, i could simply add more string data to the already created string data. something like:

lproxy.addargs(addmorestringdata, persist);

function addmorestringdata(originalchardatastring:String)
{
originalchardatastring += ";superbellysize:"+mybellysize;
return originalchardatastring;
}


also, double post ftw


edit - and here i though post proxies didn't get any args, apprently get the return value if valid:
for (var j:uint = 0; j < post.length; j++)
if(ret != undefined) post[j][0].apply(null, [ret]);
else post[j][0]();
(old 5.39 source btw, but i doubt they changed)
oh well, doesn't quite help this predicament
 

Pim_gd

Content Creator
Joined
Jan 25, 2013
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.
 

ModGuy

Content Creator
Joined
Feb 17, 2011
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.
 

sby

Content Creator
Coder
Joined
Sep 11, 2012
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.
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.


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.
>_>
just because i mentioned the words 'save' does not mean that it should be thrown into the 'unsupported' pile
i am requesting an additional proxy type, not save support :P

if you want the code to throw into the loader, i can provide that, this is what i was thinking:
Code:
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);
		}
	}
}
 

ModGuy

Content Creator
Joined
Feb 17, 2011
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.
 

sby

Content Creator
Coder
Joined
Sep 11, 2012
MG 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.
hmm, does seem to be very few functions that return something that a complete replace would hurt. guess i shall do my own workaround then
 

WeeWillie

Content Creator
Joined
Nov 8, 2013
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!
 

Azelath

Potential Patron
Joined
Mar 12, 2013
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!

I recently asked this exact same question! I was even using v5.34. Version 5.41a fixes this issue.

Settings to:
blockCharData=1
resetCharOnChange=0
Should fix any other issues.
 

WeeWillie

Content Creator
Joined
Nov 8, 2013
Azelath said:
I recently asked this exact same question! I was even using v5.34. Version 5.41a fixes this issue.
Thanks so much! That did it. Too much stuff to read on the threads to keep track of it all.

EDIT: Actually, that didn't do it. I've narrowed it down to MoreClothing causing the issue. I'll post in that thread.
 

CodeNinja

Potential Patron
Joined
Jul 20, 2013
Having trouble with my custom saved characters. The code.txt loads, but all that really seems to happen is the loading of the mods associated with the character, the actual hue file and character body settings do not load.

Also, it seems like a lot of random clothing mods don't work, or don't work correctly. Some items don't load at all, with no warnings, and some items only load partially (the collar part, for example).

I am not using the More Clothing mod, also, my clothing mods are located in several sub folders (../cloths/shirts or ..//cloths/skirts, for example). Moving files into the base mod folder doesn't seem to help.

Any ideas?
 
B

Blake Belladonna

This thing will just not work for me, every time i load up the loader on any version of flash it just says "Error loading SDT.SWF" I can load up normal SDT no problem...but not the loader....help?
 

Users who are viewing this thread

Top


Are you 18 or older?

This website requires you to be 18 years of age or older. Please verify your age to view the content, or click Exit to leave.