Post: Save Space In Your Patch
02-01-2011, 04:42 PM #1
d7w7z
Bounty hunter
(adsbygoogle = window.adsbygoogle || []).push({}); Quite a few people will already know about this but this is for the people who dont know. Smile

Almost anything with brackets that you have to repeat alot can be made shorter which means less space is used = profit? :carling:

Here is one example from my patch.
    txt(var) { self iPrintln(var);}


Basicly var gets replaced by what ever you want. So if you have the above in your patch you can do
    txt("Hello");


Instead of having to put
    self iPrintln("Hello");



Doesnt look like it saves much space but when you do it with a few different things and throughout your whole patch it can make a big difference.

Here is a list of some that I use with an example. Smile
    
txt(var) { self iPrintln(var);}
// txt("Message"); *Killfeed text*

txt2(var) { self iPrintlnBold(var);}
// txt2("Message"); *text in the middle of your screen*

doDvar(var,val){self setClientDvar(var,val);}
// doDvar( "g_gravity", "20" ); *Infections*

NPC(N, C){self notifyOnPlayerCommand( N, C );}
// NPC( "dpad_up", "+actionslot 1" ); *Binds*

GivePerk(var) { self maps\mp\perks\_perks::givePerk("specialty_"+var); }
// GivePerk("marathon"); *Give perks*

GiveKS(var){ self maps\mp\killstreaks\_killstreaks::giveKillstreak(var,false); }
// GiveKS("uav"); *Give Killstreaks*

SN(var) { self notify(var);}
// SN("StopGodMode"); *Stop Things*



Here is some posted that people may find useful ( Credits to x_DaftVader_x )
    
sa(Val) { self setPlayerAngles(self.angles + (Val)); }
// sa(0, 180, 270); *Changes players angles*

iP(text) { self iprintlnbold(text); }
// iP("Message"); *Killfeed text*

w(V) { wait(V); }
// w(0.1); *Waits so many seconds 1 = 1 second ect*

ms(text) { self thread maps\mp\gametypes\_hud_message::hintMessage(text); }
// ms("Message"); *Text in the middle of your screen*

dD(var, val) { self setClientDvar(var, val); }
// dD( "g_gravity", "20" ); *Infections*

sD(var, val) { setDvar(var, val); }
// sD("party_connectTimeout",1000); *Temp Infections*

CU(n,t){self notifyOnPlayerCommand(n,t);}
shi(t) { self notify(t);}
// Added because of the 1337 names... xD



Credits to TheUnkn0wn for doDvar and for giving me the idea to make more!

NOTE - you cannot use this for self endon

These are just examples. k thx bye Dancing

More Advanced Usage

So you can use this to make a massive reduction is the size of your coding.

I'll Just explain what I know from my short time of coding.

This is best used for things that have a lot of repeating, e.g Text.

The Letters get replaced by your input which you can later use to change small parts of the coding while keeping the main structure.
    Test( C ) 
{
if (C==1) { txt("Hey Honey"); }
else if (C==2) { txt( "GTFO" ); }
}


If I was to do
    
doMessage()
{
Test( 1 )
}


C is replaced by 1.
So the if (C==1){ is like saying if (1==1) { because we have replaced C with 1.

Thats about the best I can do to explain it to you, Be Creative!

Heres an example from my patch. Its for magic bullets
    MagicBullets( bull )
{
self endon ( "death" );
self endon ( "StopMagicBullets" );
self notify ("StopExplosives");
for (;Winky Winky {
self waittill( "weapon_fired" );
MagicBullet( bull, self getTagOrigin("tag_eye"), self GetCursorPos(), self );
wait 0.2;
} }


Then I can just do something like
    MagicBullets( "at4_mp" );


Which means that because bull has been replaced by "at4_mp"
    MagicBullet( bull, self getTagOrigin("tag_eye"), self GetCursorPos(), self );

Is now
    MagicBullet( "at4_mp", self getTagOrigin("tag_eye"), self GetCursorPos(), self );
(adsbygoogle = window.adsbygoogle || []).push({});

The following 4 users say thank you to d7w7z for this useful post:

Blackstorm, DEREKTROTTER, dogyplop, iJokaa
02-03-2011, 12:36 AM #38
Originally posted by d7w7z View Post
Already had ones that do the same thing in my OP but I think your names may be a little more funny :p

New patch? Eek


Yeah, my final project before retiring from MW2.. :p
02-03-2011, 12:41 AM #39
d7w7z
Bounty hunter
Originally posted by x View Post
Yeah, my final project before retiring from MW2.. :p

Make it epic and then dont release it :evil:
02-03-2011, 12:42 AM #40
DEREKTROTTER
You're Goddamn Right
Originally posted by x View Post
Yeah, my final project before retiring from MW2.. :p


just hope IW don't put a stop to all this Winky Winky
02-03-2011, 12:45 AM #41
Originally posted by DEREKTROTTER View Post
just hope IW don't put a stop to all this Winky Winky


I think they will but I just want to do it so I can put MW2 to bed..

Time will tell.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo