diff --git a/bin/Console.swc b/bin/Console.swc index 876d320..89288fe 100644 Binary files a/bin/Console.swc and b/bin/Console.swc differ diff --git a/bin/SampleBasic.swf b/bin/SampleBasic.swf index c3b8437..1472dc0 100644 Binary files a/bin/SampleBasic.swf and b/bin/SampleBasic.swf differ diff --git a/bin/consoleRemote.swf b/bin/consoleRemote.swf index b344af5..29965f2 100644 Binary files a/bin/consoleRemote.swf and b/bin/consoleRemote.swf differ diff --git a/bin/sampleAdvanced.swf b/bin/sampleAdvanced.swf index a6fb1cb..9dd87c7 100644 Binary files a/bin/sampleAdvanced.swf and b/bin/sampleAdvanced.swf differ diff --git a/bin/sampleStyle.swf b/bin/sampleStyle.swf index b7f513a..29ccf60 100644 Binary files a/bin/sampleStyle.swf and b/bin/sampleStyle.swf differ diff --git a/build/project.properties b/build/project.properties index f0b11c5..a7af271 100644 --- a/build/project.properties +++ b/build/project.properties @@ -1,5 +1,6 @@ +#Tue, 11 Oct 2016 22:50:56 +0300 #Wed Feb 22 00:11:41 GMT 2012 -build.number=611 -build.date=2012/02/22 00\:11 +build.number=614 +build.date=2016/10/11 22\:50 build.version=2.6 build.stage= diff --git a/src/com/junkbyte/console/Cc.as b/src/com/junkbyte/console/Cc.as index 09c80cf..2533377 100644 --- a/src/com/junkbyte/console/Cc.as +++ b/src/com/junkbyte/console/Cc.as @@ -473,9 +473,10 @@ package com.junkbyte.console { * @param alwaysAvailable If set to false this command will NOT be avaviable when Cc.config.commandLineAllowed is false; default = true * @param endOfArgsMarker Marker string used to determine end of command argument so that remaining string can be parsed as next line. * null = whole string always passed as argument. default = ";" + * @param addCommandNameAsArg If true, name will be passed to call back as the first argument */ - public static function addSlashCommand(name:String, callback:Function, description:String = "", alwaysAvailable:Boolean = true, endOfArgsMarker:String = ";"):void{ - if(_console ) _console.addSlashCommand(name, callback, description, alwaysAvailable, endOfArgsMarker); + public static function addSlashCommand(name:String, callback:Function, description:String = "", alwaysAvailable:Boolean = true, endOfArgsMarker:String = ";", addCommandNameAsArg:Boolean = false):void{ + if(_console ) _console.addSlashCommand(name, callback, description, alwaysAvailable, endOfArgsMarker, addCommandNameAsArg); } // // Memory management tools diff --git a/src/com/junkbyte/console/Console.as b/src/com/junkbyte/console/Console.as index 228a869..bdfffaf 100644 --- a/src/com/junkbyte/console/Console.as +++ b/src/com/junkbyte/console/Console.as @@ -57,8 +57,8 @@ package com.junkbyte.console public static const VERSION:Number = 2.6; public static const VERSION_STAGE:String = ""; - public static const BUILD:int = 611; - public static const BUILD_DATE:String = "2012/02/22 00:11"; + public static const BUILD:int = 614; + public static const BUILD_DATE:String = "2016/10/11 22:50"; // public static const LOG:uint = 1; public static const INFO:uint = 3; @@ -501,8 +501,8 @@ package com.junkbyte.console /** * @copy com.junkbyte.console.Cc#addSlashCommand() */ - public function addSlashCommand(name:String, callback:Function, desc:String = "", alwaysAvailable:Boolean = true, endOfArgsMarker:String = ";"):void{ - _cl.addSlashCommand(name, callback, desc, alwaysAvailable, endOfArgsMarker); + public function addSlashCommand(name:String, callback:Function, desc:String = "", alwaysAvailable:Boolean = true, endOfArgsMarker:String = ";", addCommandNameAsArg:Boolean = false):void{ + _cl.addSlashCommand(name, callback, desc, alwaysAvailable, endOfArgsMarker, addCommandNameAsArg); } // // LOGGING diff --git a/src/com/junkbyte/console/core/CommandLine.as b/src/com/junkbyte/console/core/CommandLine.as index 09acba2..bc8a2e4 100644 --- a/src/com/junkbyte/console/core/CommandLine.as +++ b/src/com/junkbyte/console/core/CommandLine.as @@ -167,15 +167,15 @@ package com.junkbyte.console.core public function get scopeString():String{ return config.commandLineAllowed?_scopeStr:""; } - public function addCLCmd(n:String, callback:Function, desc:String, allow:Boolean = false, endOfArgsMarker:String = ";"):void{ + public function addCLCmd(n:String, callback:Function, desc:String, allow:Boolean = false, endOfArgsMarker:String = ";", addCommandNameAsArg:Boolean = false):void{ var split:Array = n.split("|"); for(var i:int = 0; i0) _slashCmds.setPropertyIsEnumerable(n, false); } } - public function addSlashCommand(n:String, callback:Function, desc:String = "", alwaysAvailable:Boolean = true, endOfArgsMarker:String = ";"):void{ + public function addSlashCommand(n:String, callback:Function, desc:String = "", alwaysAvailable:Boolean = true, endOfArgsMarker:String = ";", addCommandNameAsArg:Boolean = false):void{ n = n.replace(/[^\w]*/g, ""); if(_slashCmds[n] != null){ var prev:SlashCommand = _slashCmds[n]; @@ -184,7 +184,7 @@ package com.junkbyte.console.core } } if(callback == null) delete _slashCmds[n]; - else _slashCmds[n] = new SlashCommand(n, callback, LogReferences.EscHTML(desc), true, alwaysAvailable, endOfArgsMarker); + else _slashCmds[n] = new SlashCommand(n, callback, LogReferences.EscHTML(desc), true, alwaysAvailable, endOfArgsMarker, addCommandNameAsArg); } public function run(str:String, saves:Object = null):* { if(!str) return; @@ -266,9 +266,9 @@ package com.junkbyte.console.core } } if(param.length == 0){ - slashcmd.f(); + slashcmd.nameArg ? slashcmd.f(slashcmd.n) : slashcmd.f(); } else { - slashcmd.f(param); + slashcmd.nameArg ? slashcmd.f(slashcmd.n, param) : slashcmd.f(param); } if(restStr){ run(restStr); @@ -433,12 +433,14 @@ internal class SlashCommand{ public var user:Boolean; public var allow:Boolean; public var endMarker:String; - public function SlashCommand(nn:String, ff:Function, dd:String, cus:Boolean, permit:Boolean, argsMarker:String){ + public var nameArg:Boolean; + public function SlashCommand(nn:String, ff:Function, dd:String, cus:Boolean, permit:Boolean, argsMarker:String, nameAsArg:Boolean){ n = nn; f = ff; d = dd?dd:""; user = cus; allow = permit; endMarker = argsMarker; + nameArg = nameAsArg; } } \ No newline at end of file