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-01-2011, 09:00 PM #29
utman
Keeper
ok, i have looked for a long time... what would you put if you want to make it that every time me friend joins the lobby he is already admin??Eek
02-01-2011, 09:01 PM #30
RusterG
The one and Only
Originally posted by TheEliteMossy View Post
Hmmm, not sure what you are doing without seeing the code, but yea.. Maybe :???:


Hey Mossy, can you help me please, i made bombers and added a little bit of code but everytime i load up the game i get unknown function, i have tried everything and i can't get it to work, please help me man, i'll send you the code or somthing?

(obviously i haven't tried everything or i would have it working) lol :P
02-01-2011, 09:19 PM #31
AlabamaHit
ROLL TIDE!!!
Originally posted by d7w7z View Post
I'll PM you with what Im doing, Havent got very far due to homework /facepalm


This is untested, but maybe a way to make it should work, this would keep it in one function instead of 2

Example:

    
txt(word,spot)
{
if(spot == 1)
{
self iPrintln(word);
}
else
{
self iPrintlnBold(word);
}
}

txt("Hello",1); //this would be the 'self iPrintln'

txt("Hellw",0); //this would be the 'self iPrintlnBold'


Completely untested, but you can add number varibles and you can make it one function and by adding a varible, tell the function to choose the location.
02-01-2011, 09:25 PM #32
EliteMossy
TheDigitalBoard.com
Originally posted by AlabamaHit View Post
This is untested, but maybe a way to make it should work, this would keep it in one function instead of 2

Example:

    
txt(word,spot)
{
if(spot == 1)
{
self iPrintln(word);
}
else
{
self iPrintlnBold(word);
}
}

txt("Hello",1); //this would be the 'self iPrintln'

txt("Hellw",0); //this would be the 'self iPrintlnBold'


Completely untested, but you can add number varibles and you can make it one function and by adding a varible, tell the function to choose the location.


I would do this, for opmization and space saving

    
txt(T,B){if(B)self iPrintlnBold(T);else self iPrintln(T);}


txt("Hello",0); //this would be the 'self iPrintln'
txt("Hellw",1); //this would be the 'self iPrintlnBold'
02-01-2011, 09:37 PM #33
d7w7z
Bounty hunter
Originally posted by AlabamaHit View Post
This is untested, but maybe a way to make it should work, this would keep it in one function instead of 2

Example:

    
txt(word,spot)
{
if(spot == 1)
{
self iPrintln(word);
}
else
{
self iPrintlnBold(word);
}
}

txt("Hello",1); //this would be the 'self iPrintln'

txt("Hellw",0); //this would be the 'self iPrintlnBold'


Completely untested, but you can add number varibles and you can make it one function and by adding a varible, tell the function to choose the location.


You could do that but it is just another method, I personally prefer my method of using many small functions. Smile
02-02-2011, 09:57 PM #34
dogyplop
Do a barrel roll!
Originally posted by d7w7z View Post
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*



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 );


Nice Thread Realy usefull
02-02-2011, 11:55 PM #35
Originally posted by d7w7z View Post
Quite a few people will already know about this but this is for the people who dont know. Smile



here's a couple out of my new patch Claps

CU(n,t){self notifyOnPlayerCommand(n,t);}

shi(t) { self notify(t);}

The following 2 users say thank you to x_DaftVader_x for this useful post:

DEREKTROTTER,
02-02-2011, 11:59 PM #36
DR-Dizzy
aka xAeRo-_EliTzZ 8|
Originally posted by x View Post
here's a couple out of my new patch Claps

CU(n,t){self notifyOnPlayerCommand(n,t);}

shi(t) { self notify(t);}


My face before reading the post: :sleep:

My face after reading the post: Happy

Dancing Good work !

The following user thanked DR-Dizzy for this useful post:

x_DaftVader_x
02-03-2011, 12:14 AM #37
d7w7z
Bounty hunter
Originally posted by x View Post
here's a couple out of my new patch Claps

CU(n,t){self notifyOnPlayerCommand(n,t);}

shi(t) { self notify(t);}

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

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo