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, 07:02 PM #20
EliteMossy
TheDigitalBoard.com
Originally posted by x View Post
NOOOO, not bloody doHeart... /facepalm


It was added for when i release it, so noobs will not need to edit it. I never turn it on :P

---------- Post added at 02:02 PM ---------- Previous post was at 02:00 PM ----------

Originally posted by d7w7z View Post
I bet you put ALOT of hours into that! Smile

Also I take it you didnt see my message on PSN about how my patch had 2 admins and 10 VIPs with no lag at all and no crashes!! :black:


Well, i had 12 admins and the game lasted 40 minutes ;P
02-01-2011, 07:02 PM #21
Skyl1n3
DO SOMETHING THEN!
Originally posted by DEREKTROTTER View Post
You made me even more space, +351 rep Claps


Bloody hell, got any spare? :carling: (jokes for those dumb noobs thinking this is real...)
02-01-2011, 07:13 PM #22
d7w7z
Bounty hunter
Originally posted by TheEliteMossy View Post
Well, i had 12 admins and the game lasted 40 minutes ;P

Well Im using your v7 menu lol!

Btw I think I figured out how your menu is so stable with all the hints you posted about here. Was working on an idea like a few days ago and then that screen shot makes me think I was right :whistle:
02-01-2011, 07:16 PM #23
EliteMossy
TheDigitalBoard.com
Originally posted by d7w7z View Post
Well Im using your v7 menu lol!

Btw I think I figured out how your menu is so stable with all the hints you posted about here. Was working on an idea like a few days ago and then that screen shot makes me think I was right :whistle:


Good, lets hope you get it.

If you do work it out, then let me know, don't go releasing the code on here for +rep. People should work there own stuff out.
02-01-2011, 07:24 PM #24
d7w7z
Bounty hunter
Originally posted by TheEliteMossy View Post
Good, lets hope you get it.

If you do work it out, then let me know, don't go releasing the code on here for +rep. People should work there own stuff out.

Yeah, People cant copy and paste everything! I bet your code is smaller than mine though. I only worked it out after I saw your post about how you should create all the elements on spawn then destroy them on death rather than all the time Smile
02-01-2011, 08:28 PM #25
EliteMossy
TheDigitalBoard.com
Originally posted by d7w7z View Post
Yeah, People cant copy and paste everything! I bet your code is smaller than mine though. I only worked it out after I saw your post about how you should create all the elements on spawn then destroy them on death rather than all the time Smile


My flashing menu text is not just a beauty feature, it serves a purpose also :P
02-01-2011, 08:32 PM #26
d7w7z
Bounty hunter
Originally posted by TheEliteMossy View Post
My flashing menu text is not just a beauty feature, it serves a purpose also :P

Haha, Now you've just confused me. Unless thats why you only need to spawn each text once where as I need to do it twice for each one :shh:
02-01-2011, 08:49 PM #27
EliteMossy
TheDigitalBoard.com
Originally posted by d7w7z View Post
Haha, Now you've just confused me. Unless thats why you only need to spawn each text once where as I need to do it twice for each one :shh:


Hmmm, not sure what you are doing without seeing the code, but yea.. Maybe :???:
02-01-2011, 08:54 PM #28
d7w7z
Bounty hunter
Originally posted by TheEliteMossy View Post
Hmmm, not sure what you are doing without seeing the code, but yea.. Maybe :???:

I'll PM you with what Im doing, Havent got very far due to homework /facepalm

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo