Compiler - Lightweight Mod Compiler

ModGuy

Content Creator
Joined
Feb 17, 2011
So I decided to put this here as it would only be for advanced use.

Take some AS3 code, place it in the included template and compile.
Don't need Flash or Flex for this AFAIK.

AS3->AS3 SWF Compiler (Includes Vanilla SDT template):
https://hostr.co/FDkUZJyao4GL
http://www.solidfiles.com/d/40b0bfab95/Compiler_Alt.zip

Free SWF decompiler for code analysis:
http://www.free-decompiler.com/flash/

25-08-14 SWF version flag added to match SDT.
19-01-14 Broken links repaired, mirror added.
05-12-13 JPEXS Decompiler added.
23-08-13 haXe compiler removed, useless really.
14-05-13 Dead links update.
08-11-12 Update to conform with new loader mod detection and initialization.
11-11-12 Added alternate compiler for pure AS3.
05-01-12 Alt compiler now supports vanilla SDT.
 

gollum

Avid Affiliate
Joined
Dec 31, 2011
is there some sort of API for the loader?

variables seem to be pretty straightforward, but what about functions like cough, setHands or setColor?
 

ModGuy

Content Creator
Joined
Feb 17, 2011
gollum said:
is there some sort of API for the loader?

variables seem to be pretty straightforward, but what about functions like cough, setHands or setColor?

What?
Think about what it is that you're saying.
If there was an API, one would have had to have been developed for it.
Now why would I do that when there's something like 2 modders here with any AS3 understanding?

No, and it wouldn't make the code any easier than it already is.
Look over the MANY examples on the forum.
And by that I mean all loader SWF mods.
A decompiler makes short work of analysing code.
 

anonymous

Club Regular
Joined
Feb 16, 2011
ModGuy said:
gollum said:
is there some sort of API for the loader?

variables seem to be pretty straightforward, but what about functions like cough, setHands or setColor?

What?
Think about what it is that you're saying.
If there was an API, one would have had to have been developed for it.
Now why would I do that when there's something like 2 modders here with any AS3 understanding?

No, and it wouldn't make the code any easier than it already is.
Look over the MANY examples on the forum.
And by that I mean all loader SWF mods.
A decompiler makes short work of analysing code.
Is there a such way of knowing the names of all of the variables and functions available?
 

Faceless

Content Creator
Joined
Jun 12, 2011
Mm, yes. Definitely have to second Anon. The biggest hangup for me is wondering what the hell the objects are called.
 

ModGuy

Content Creator
Joined
Feb 17, 2011
No.
Although it's clearly time for someone to start indexing them.
You could implement demonsters debugger.
 

gollum

Avid Affiliate
Joined
Dec 31, 2011
I know it's been a while, but I've tried my luck with the haxe compiler and whenever I load a mod compiled with it, it moves the game-frame to the edge of the flashwindow.

Code:
class Mod {
	static var m;
	static function main() {
		var l = flash.Lib.current.stage.getChildByName("root1");
		if( l.toString().indexOf("boot")==-1 ){
			modCode(cast(l));
		}else{
			trace("LOAD IN THE LOADER!");
		}
	}
	public static function modCode(main){
		main.unloadMod();
	}
}
It shouldn't do anything, I stripped it down to see if I screwed something up, so it's the same as the template.

attached is a picture of what it looks like and the swf

maybe someone can help me fix this or tell me how to move the frame back to centre
 

Attachments

superduper2019

Content Creator
Joined
Sep 10, 2012
Ok, as one who can't afford Flash and doesn't want to download it illegally, I'm really interested in this (also for other purposes)

Thanks a lot, but....

I'm a programmer myself, but I'm too stupid right now to find out, how to use this...

So there ist the template:
Code:
class Mod {
	static var m;
	static function main() {
		var l = flash.Lib.current.stage.getChildByName("root1");
		if( l.toString().indexOf("boot")==-1 ){
			modCode(cast(l));
		}else{
			trace("LOAD IN THE LOADER!");
		}
	}
// I have to put my code here, right?
		main.unloadMod();
	}
}
When I use either
flash.Lib.current.stage.getChildByName("Her").something = something;
or
Her.something = something;

it doesn't work, as Haxe can't find "Her"...

I guess this is the case, because when compiling Haxe doesn't know about the SDT.swf's variables, but how can I make it know,

respectively, how am I supposed to use this? Am I misunderstanding it?

Anyway, thanks to ModGuy for his emphasis!
 

gollum

Avid Affiliate
Joined
Dec 31, 2011
superduper2019 said:
When I use either
flash.Lib.current.stage.getChildByName("Her").something = something;
or
Her.something = something;

it doesn't work, as Haxe can't find "Her"...
try main.her.something

€dit @modguy:

could you spare some time and help me with registering the mods to be unloaded once the unload button is clicked/the char is reloaded?

I tried something I found in another mod:

Code:
class Mod {
	static var m;
	static var z = new MovieClip();
	static function main() {
		var l = flash.Lib.current.stage.getChildByName("root1");
		if( l.toString().indexOf("boot")==-1 ){
			modCode(cast(l));
		}else{
			trace("LOAD IN THE LOADER!");
		}
	}
	public static function modCode(main){
		m = cast(main);
		main.registerUnloadFunction(undo);
		main.updateStatus("Mod enabled");
		z.addEventListener(Event.ENTER_FRAME, update);
		main.unloadMod();
	}
	public static function update(e){
		m.updateStatus("updating");
	}
	public static function undo(){
		m.updateStatus("Mod disabled");
		z.removeEventListener(Event.ENTER_FRAME, update);
	}
}
but that's not working :/

also: I found where I had to tweak to mess up the penis and body sliders, but I can't find the breastslider. any hints? :)
 

ModGuy

Content Creator
Joined
Feb 17, 2011
superduper2019 said:
Ok, as one who can't afford Flash and doesn't want to download it illegally, I'm really interested in this (also for other purposes)

Thanks a lot, but....

I'm a programmer myself, but I'm too stupid right now to find out, how to use this...
Use...

Code:
class Mod {
	static function main() {
		var l = flash.Lib.current.stage.getChildByName("root1");
		if( l.toString().indexOf("boot")==-1 ){
			modCode(cast(l));
		}else{
			trace("LOAD IN THE LOADER!");
		}
	}
	public static function modCode(main){
		//CODE HERE!
		//Her would be: main.her
		flash.Lib.current.stage.align = cast("");
		main.unloadMod();
	}
}
EDIT:

Fix for alignment included above:

Code:
flash.Lib.current.stage.align = cast("");
Basically resetting the align to center.
 

gollum

Avid Affiliate
Joined
Dec 31, 2011
ModGuy said:
EDIT:

Fix for alignment included above:

Code:
flash.Lib.current.stage.align = cast("");
Basically resetting the align to center.
thanks, you are awesome :D
 

ModGuy

Content Creator
Joined
Feb 17, 2011
gollum said:
could you spare some time and help me with registering the mods to be unloaded once the unload button is clicked/the char is reloaded?
If you're just trying to delete an object on unload, this should be sufficient:

Code:
registerToRemove(mc);
From the dev guide, make sure to call that function from the loader object.
 

gollum

Avid Affiliate
Joined
Dec 31, 2011
ModGuy said:
If you're just trying to delete an object on unload, this should be sufficient:

Code:
registerToRemove(mc);
From the dev guide, make sure to call that function from the loader object.
having some problems there. probably just me being tired, but anyway:

main.registerToRemove(mc), mc being the mod-object ("this" basically) didn't work due to modCode being static. so I extracted another class "Nested"
Code:
var nested:Nested = new Nested(main) { 
	public function new(main) { 
		main.updateStatus("Mod enabled");
		main.him.max_penis_size = 10; 
	}
main.registerToRemove(nested);
main.registerUnloadFunction(disable() { main.updateStatus("Mod disabled"); }
was compiled (by now I screwed up Nested so badly I can't reconstruct it, I'll try again tomorrow to give you the proper code, above is an example) caused both messages to appear on loading the mod (resetcharonchange=1 in settings), but the mod remaining in memory
 

ModGuy

Content Creator
Joined
Feb 17, 2011
gollum said:
ModGuy said:
If you're just trying to delete an object on unload, this should be sufficient:

Code:
registerToRemove(mc);
From the dev guide, make sure to call that function from the loader object.
having some problems there. probably just me being tired, but anyway:

main.registerToRemove(mc), mc being the mod-object ("this" basically) didn't work due to modCode being static. so I extracted another class "Nested"
Code:
var nested:Nested = new Nested(main) { 
	public function new(main) { 
		main.updateStatus("Mod enabled");
		main.him.max_penis_size = 10; 
	}
main.registerToRemove(nested);
main.registerUnloadFunction(disable() { main.updateStatus("Mod disabled"); }
was compiled (by now I screwed up Nested so badly I can't reconstruct it, I'll try again tomorrow to give you the proper code, above is an example) caused both messages to appear on loading the mod (resetcharonchange=1 in settings), but the mod remaining in memory
If I understand correctly you just want the compiled mod to unload after doing stuff.
Yeah, that's what main.unloadMod(); does, you don't need to do anything else.
The mod remains in memory because I don't bother unloading SWFs after use in the event of costumes etc.
Resetting should remove them, probably.
 

gollum

Avid Affiliate
Joined
Dec 31, 2011
ModGuy said:
If I understand correctly you just want the compiled mod to unload after doing stuff.
Yeah, that's what main.unloadMod(); does, you don't need to do anything else.
The mod remains in memory because I don't bother unloading SWFs after use in the event of costumes etc.
Resetting should remove them, probably.
not quite. since I'm stuck with static methods, I'd like to get rid of the objects completely.
if you load the mod, then reload the loader without killing the (standalone) player and load another haxe mod again, you get an error message.
my current guess is that the stage-casts in main() produce a nullpointer since they only load the stage once, but when you reload the game, the stage changes.

€dit:

nevermind, I can simply check for null and prevent the crash. I'll try to figure something out tomorrow :)
 

ModGuy

Content Creator
Joined
Feb 17, 2011
gollum said:
ModGuy said:
If I understand correctly you just want the compiled mod to unload after doing stuff.
Yeah, that's what main.unloadMod(); does, you don't need to do anything else.
The mod remains in memory because I don't bother unloading SWFs after use in the event of costumes etc.
Resetting should remove them, probably.
not quite. since I'm stuck with static methods, I'd like to get rid of the objects completely.
if you load the mod, then reload the loader without killing the (standalone) player and load another haxe mod again, you get an error message.
my current guess is that the stage-casts in main() produce a nullpointer since they only load the stage once, but when you reload the game, the stage changes.

€dit:

nevermind, I can simply check for null and prevent the crash. I'll try to figure something out tomorrow :)
Huh, I've never tried > 1 test at a time. I like to keep things separate.

EDIT: Noticed I'm still using stupid detection for Compiler mods, I'll fix that soon.

EDIT2: Performed some fixes, old haXe mods will hopefully still work.

Start using this template:

Code:
class Mod {
	static function main() {
	}
	public static function initl(main){
		//CODE HERE!
		flash.Lib.current.stage.align = cast("");
		main.unloadMod();
	}
}
Expect fix in next loader.

EDIT3:

New Compiler and Loader released, weird bug but should be sorted (avoided).
 

gollum

Avid Affiliate
Joined
Dec 31, 2011
I hate to repeat myself, but I must:

gollum said:
thanks, you are awesome :D
:D

I'll test it later

edit:

old haxe mods still work. under the above mentioned circumstances they don't reload, but at least the error message vanished.
new mods work perfectly
 

gollum

Avid Affiliate
Joined
Dec 31, 2011
ModGuy said:
A decompiler makes short work of analysing code.
can you recommend a good decompiler?
currently I'm stuck with the trial version of sothink swfdec and that's pretty punishing, since I have to search line for line cause the searchfunction is disabled. but it's the only one able to give me the sdt-source...
 
Top Bottom