Author Topic: 1024 byte scripting contest  (Read 19090 times)

They are "place holders" for the actual code which is then put it by the decoder.(If I'm right)
So you can have different symbols, and have them decoded as different things.

I wrote a ruby script to check what unused character would save the most bytes if it was used to replace a certain string in the file. I kept doing this until I got the code + the decompiler to 1024 bytes. Here's the list I made as I went along (note I ran out of characters on my keyboard so I had to snag some accented A's and E's):

Code: [Select]
q ction
z ::onhitobject(%a,%b,%c,%d,%e,%f)
6 funq
7 brick
# 2 0 0
^ .chatmessage("\c3You
& (%a)
~ player
> );
' parent
` %b
| plant
À @%a.a
Á ::ondeath&
 6servercmd
à a.kill7(>
Ä ::spawn~&
Å position
È ge
É ;%g
Ê 1@"
Ë colorid
ø ){

A few entries have trailing spaces, which you can't see unless you highlight it.

I should take the build to survive gamemode script and do this.
EDIT: Dam it's 5000 bytes, I'm going to need to know what I'm doing to make this work.
« Last Edit: January 19, 2011, 09:52:09 PM by DrenDran »

I was about to say "Wtf there is no "q" in "function"
Then I realized you seem to have compressed it a couple of times.
Thats cheating :c

I think Flaw/bauklotz version removed consideration for the fact that the keybind triggers the function on key press and release.
I didn't? %val.
Oh nevermind, didn't read.
« Last Edit: January 20, 2011, 08:56:08 AM by Bauklotz »

You should keep the original one too since it's a better example of what the actual code should be like instead of unintelligible garbage.

Who`s space talking to?

Uh, Truce at replacing the example in the first post.

Who`s space talking to?
Hey, the quote key is beside the enter key.

I got it down to 1.77kb so far from 5.8kb.
Quote
$e="$cb=1;$mpb=60;package ob{Âøplantbrick(){}};Âøbuild(%c){Ê%cÁ)$cb=!$cb;Ê$cb)deË(ob);äË(ob);}Âeb(){Å%a=0;%a<$noe;%a++){%ve=$ea[%a];initContainerBoxSearch(%ve.position,\"5 5 5\",$TypeMasks::FxBrickAlwaysïType);while(%so=containerSearchNext()){Ê!(%so.inv||%so.ie))%so.killbrick();}}schedule(250,0,eb);}eb();Âøclo(%cl){Å%a=0;%a<$noe;%a++){%ve=$ea[%a];%ld=50000;%ps=-1;Å%b=0;%b<clientgroup.getcount();%b++){%p=clientgroup.getï(%b).player;Êisï(%p)){%pos=%p.getö();Êabs(getword(%pos,0)-getword(%ve.getö(),0))+abs(getword(%pos,1)-getword(%ve.getö(),1))<%ld){%dist=%ld;%ps=%p;}}}Êisï(%ps)){%dxÈ(%pos,0)-getword(%ve.getö(),0);%dyÈ(%pos,1)-getword(%ve.getö(),1);Ê%dy==0)%dy=1;%sl=mabs(%dx)/mabs(%dy);%ooo=%ve.getö();Ê%dx>0)%nxÈ(%ooo,0)+(2*%sl);ä%nxÈ(%ooo,0)-(2*%sl);Ê%dy>0)%nyÈ(%ooo,1)+2;ä%nyÈ(%ooo,1)-2;%ve.setö(%nx SPC %ny SPC getword(%ooo,2));}}}Âøce(%cl){Ê!%clÁ)return;Å%a=0;%a<$noe;%a++)$ea[%a].delete();$noe=0;}Âøse(%cl){Ê%clÁ){Å%a=0;%a<$nw;%a++){%br=$ep[%a];Êisï(%br)){$ea[$noe]=new WheeledVehicle(){À=BallVehicle;};MissionCleanup.add($ea[$noe]);$ea[$noe].setö(%br.position);$ea[$noe].ik=1;$noe++;}}}}package bts{ÂWheeledVehicleData::onCollision(%ve,%obj,%col){Êisï(%col))Ê%col.getclassname()$=\"Player\")%col.kill();}ÂfxDTSBrick::onPlant(%br){%cl=%br.getGroup().client;Parent::onPlant(%br);Ê%br==$LastLoadedBrick)return;Ê%cl.se){$ep[$nw]=%br;$nw++;%br.ie=1;}äÊ%cl.si)%br.inv=1;äÊ%br.À.brickSizeZ*0.3*%br.À.brickSizeY*%br.À.brickSizeX>$mpb)%br.killbrick();}};Ë(bts);Âøeater(%cl){Ê%clÁ)%cl.se=!%cl.se;}Âøinv(%cl){Ê%clÁ)%cl.si=!%cl.si;}";function r(%s,%e){$e=strreplace($e,%s,%e);}r("Ê","if(");r("Á",".isSuperAdmin");r("Å","for(");r("Â","function ");r("ø","servercmd");r("È","=getword");r("À","dataBlock");r("Ë","activatepackage");r("ä","else ");r("ö","transform");r("ï","object");eval($e);
(quote blocks so it will linebreak it)
I need to shave off ~600 more bytes, it would seem.
 :cookieMonster:

I got it down to 1.77kb so far from 5.8kb.(quote blocks so it will linebreak it)
I need to shave off ~600 more bytes, it would seem.
 :cookieMonster:
There's still some things that can be replaced and compressed, like those local variables that is bigger than one character or the getWords you haven't replaced(More than 5 of them.).

There's still some things that can be replaced and compressed, like those local variables that is bigger than one character or the getWords you haven't replaced(More than 5 of them.).
brick getword return
will probably be replaced next

I made another Ruby script to super-compress 100% on its own when it's passed a file.
(If any of you actually do this outside of this contest / idea circle I will hunt you down.)



DungeonGenII.cs - 12,269 bytes
DungeonGenII_c.cs - 2,674 bytes

Code: [Select]
//¥aØÃŒc³Ž0:%cË1««  0Õ1¹ 1  90Õ2¹ 1 180Õ3¹Ô  90îÎ=new fxdts£(³datablocka;posiáb;rotaác;coloridd;isÒed¢±e.settrusted(Äe.Ò(žlocalclientconnecá.£group.addŒež}¥bØÁ%a*%bº›ff@Î@" "g[Î]ËMî%f=trimŒf)eã=0;Á6º›iŠ0,¼countŒf)Ôž‹=¼Ði)f=removewordÐižÃŒe³Ž0¨SÕ1¨WÕ2¨B";default¨Tî} eÉeÈbº³for(‹¢;‹Èa;‹Ü³‹w×céc-2ž‹h×déd-2ž‹xŠ2”c-‹wž‹yŠ2”d-‹hž‹r¸x+‹wÔ;‹b¸y+‹hԍrè)sß“™$Ë")%™èž“u$Ë")%uß vÉvÈdvܳ wÉwÈcwܳ“e!bÇírÏÛb`k!aÏísÇÛr`e!=Úy`k!=–Úxì=¸x-ÈuÏëyì=¸r+ÈsÏëyê=¸y-–È™Çëxê=¸b+–ÈrÇëxìÚx-åuìÛr+åsêÚy-–å™êÛb+–årìÚx-–>™ÇÚxìÛr+1ÏísÇÈ™ÇÛrêÚy->uÏÚyêÛb+1ÇírÏÈuÏÛb`v=¢¶víd¶w=¢¶wíc)Ñ"X";æ “v>¸yÏëbÇ>¸xÇër)Ñ%g[Îã];æÑ"#îÎdx=ŒeÔ)*%d+Œv-Äçç@%xxËî%™ruseãܱ%uËîÁ%b*%dº)%aaaa@%z[Î]@"\n";return trimÂaž}¥c›bÍ c˜cåbcÜ›d=äc)eÖdž f˜f<΍fÜ›g’Œd”f,1žÃ$Œg³Ž"X©=7¾#©=7¾.©¢5¾S©=3¾W©=2¾B©¢6¾T©¢¾M©=0±usespraycan'”hžÒ£'ž·0,Ôž}·Ô”ež}}¥d›b˜c˜dÍÁ%dº›f=äe)gÖfž h˜håghÜ›i’Ðh,Äjb€%c€0.1;“i$ËX"›b-=4;continue±%z=6l=„"”iž“l!ª›iË "z=¼("3 2 16 1 0"”lž}%m’(äeÔ)”h,Än’ÐhÔ,Äo’Ðh+1,Äp’(äe+1)”h,1ž“i$Ë "¶i$Ë."³µData"”j,0,6žÞ4‡Þ6"),0”zž¬mÀq¢;¬nÀr¢;¬oÀs¢;¬pÀtÉqd˜rd˜sd˜td=0;if¦qœmÊqÉqd¿rœnÊrÉrd¿sœoÊsÉsd¿tœpÊtÉtd¢±“q¶r½ƒ-¡ƒ-§ƒ-´“q¶s½Ù-¡Ù-§Ù-´“t¶r½ƒ¡ƒ§ƒ´“t¶s½Ù¡Ù§Ù´%yq+%r+%s+%t; z˜zåyzÜ›aa»qâ˜c~ªÝq»q¤râ¢År»r¤sâªÅs»s¤tâ˜c~¢Ýt»td)%aa¿aa³6‘0.š6‘š‰1^2‘1ˆ1°­¯­^‰Ó^2‘ÓˆÓ°2.8¯2.8^²­^­®}æ{6‘š²0.š0.š‚1^1^‚­^­^‚Ó^Ó®“qŸÌÙÆ1à“rŸ ƒÌÆ0à“sŸÙÌÆ2à“tŸÌ ƒÆ3à}}}%b-=4±%b˜c+=4±}
new fileobject(a).openforread($con::file);$a=a.readline();a.close();while($b++<119)$a=strreplace($a,getsubstr(" îíìëêéèçæåäãâáàßÞÝÜÛÚÙØ×ÖÕÔÓÒÑÐÏÎÍÌËÊÉÈÇÆÅÄÃÂÁÀ¿¾½¼»º¹¸·¶µ´³²±°¯®­¬«ª©¨§¦¥¤£¢¡ Ÿžœ›š™˜—–•”“’‘ŽŒ‹Š‰ˆ‡†…„ƒ‚€~`_^?/",$b,1),getfield("\"±\t=\t`™\t<¸\t`u\t*0.5)”\tŠ‹x,‹r\tz[Îdx]\telse\t<%\t—”\tndex\t›b~\ttion\t,8ž\tŠ‹y,‹bž\tµ?\"0«4.\t.75adÉ\t++\t>‹\t<‹\t-ƒ\t”b”c”d³\tŠmfloorŒ\t=strlenŒ\t\";Ž\t-1\t2.2\tplant\t%xx@\tŒf”\t…v\t%e\t=—countž\t«   \t=\"\t)!ª›\t¢\t<\t…w\t­\"),\t.75c~˜ad˜\t1)\tswitch\tŒa\t e˜e<\t)=ª)%\t¢±if¦\t;Ž\"\t³1?\"\tgetword\t=0;“\te++\t:%c=\"0«\t=‹\tsupershift£',\t||%\ta(\"£8x8f\tƒ4  ‡}\t){\t‰3.4^2‘3.4ˆ3.4^‚\t;}\t^2?%b~+¦b•%c~+¦c•\t^2?%b~-¦b•%c~-¦c•\t^‚2.8^2.8)”ad,5ž\t1.6\tif(„.\"”\t 0 \t=-1\t\":%h\t:%g[‹]=\"\tƒ2.2‡1?\"\t(!%\tfunction \td)%aa¢;}else “\tbrick\t=1\tƒ0.4‡1x5?\"\tforŒ\td)a(\"c†Œj,\"\t);\t=%\t…i$=\".\"&&„\"”\t){%\t4)”ad,6);\tt[‹]\t=0\tgetrecord\t1…v==%u…w\t~)*0.5€\t,%\tifŒ\t=getsubstr\t?%b~€%c~€\tcommandtoserver('\t1…w==%t[‹]…v\tcase \t;%\t(%\t%k\t=getrandom(\t2?%b~+(!%b~)*1€%c~+(!%c~)*1€\t^2?%b~-(!%b~)*1€%c~-(!%c~)*1€\t\"),0,6);\tontentBrickCabinDoor\",vectoradd\t&&%\tstrpos(\"SWBTM\t1.75 \t1?%b~+(!%b_%c~+(!%c_\t1?%b~-(!%b_%c~-(!%c_\t SPC \ta(\"brick1x\toff\t)%x=%x@\".\";else if(%\toff)*1.25 SPC \t),%ad,5);a(\"brick1x\tData\",vectoradd(%j,",$b-1));eval($a);

File is only 21.8% of its original size and executes perfectly*.
*Assuming neither of our ends removed any "weird" characters in the copy and pasting to/from a file.

Whew that was fun :cookieMonster:


EDIT: Apparently it does remove some when pasting. Oh well.
« Last Edit: January 20, 2011, 05:55:50 PM by Truce »

-snippers-
Time to make DSO-like files that few people can decode :D

Time to make DSO-like files that few people can decode :D
You'd only need a simple script to decode such files.

You'd only need a simple script to decode such files.

Code: [Select]
echo($a);
(Decoded but everything has short names so not 100% clear.)