You are viewing our Forum Archives. To view or take place in current topics click here.
Educate Yourself's! Stop The Leech's!
Posted:
Educate Yourself's! Stop The Leech's!Posted:
Status: Offline
Joined: Apr 29, 200915Year Member
Posts: 4,420
Reputation Power: 1211
Status: Offline
Joined: Apr 29, 200915Year Member
Posts: 4,420
Reputation Power: 1211
This thread contains several tutorials from several thread's from various websites i do not take credit for all of this work.
Since thetechgame started getting huge as it is to this day, there have been many leech's, noob's or whatever you want to call them, asking stupid question making stupid topics and threads for many questions that may seem very obvious to some.
Well i want to see that stopped. 90% of the posts in this section are to do with MW2 codes's patch's and the likes. What im going to do here is help educate the not so educated into becoming a rather good modder. So let's get started.
The following tut is all thanks to K Brizzle and is a tut on the most basic programming that goes in the patch_mp.ff file. The file is written in the C++ programming language.
Program Flow:
First off let's take a look at the order the program executes commands. Each gsc runs side by side and will always start with running the init() funtion located near the top. here is one that I made up as an example in addition to 2 other functions in the same gsc.
Alright so the program starts by running the init() function. First it will execute the "self.variable = 100;" line. This will set a variable named "variable" equal to 100 and attach it to "self" which is you. Next it moves to the next line "self thread doCommands();". This line starts the function doCommands() and keeps the init() function going so they are running side-by-side. Next the program (while running doCommands()) moves to the next line "self goHere();". Notice that this line does not have the thread command in the middle. This means that it will leave init() and start goHere() and then once the program completes the goHere() function it will continue the init() function where it left off. Now after going through the init() function we have set self.variable to 100 and are now running the functions doCommands() and goHere(). Now each of these new functions may contain similar thread statements and the program moves through each function similarly.
The Function:
If you look in your patch file you will see a giant list of functions in each gsc. The general form of a function look like this:
Most of the functions you see in the gsc do not have arguments, but you should know what they are for when you write you own code. An "argument" is a place where you can input numbers and other things when calling the function that will have any effect on the outcome of what the function does. for example:
This function iniNuke() is what I use in my patch for initiating nuke variables. You see that the function is called in init(). and has 4 arguments days,hours,minutes, and seconds. The days is 1, the hours is 12, the minutes is 20, and the seconds is 5. Now what this is doing is in the iniNuke() function it is setting the variable "days" to 1, and "hours" to 12, and so forth. Then, later in the function, the variables can be used. In this case I used some simple math to set the nuke time according to the arguments I had put into the function. this line sets the length that the nuketimer will last by setting the Dvar "scr_nuketimer": setDvar( "scr_nuketimer", seconds nuke timer will last );
Now this part of the function is what tells the function when to stop. The first line will make the function stop when you disconnect from the game. The second line will end the function when you die. Most functions will need the first line. Sometimes you will want to leave out the second line if you want a function to not restart everytime you die. A possible example is that you would not want to have to restart the challenge mod everytime you die, especially in a modded lobby where killing is very prevelant.
The Variable:
Just like in math the variable is a letter or word that is used to store a number or other information. In this example we are storing some information in to these variables.
In this example first we set the variable self.coolnessLevel to 100. The "self." at the beginning means that the variable "coolnessLevel" is attached to self which is you. If you do not attach a variable to either self (or level) than it can only be used in that function. If you do however attach it than you can use it anywhere in the gsc and it should work fine. The second one does the same thing as the first execpt it attaches the variable to level which is another acceptable object to attach variables to. The last line sets a normal variable as a "string". This means it saves a line of text into the variable which is just another one of the data types you can save in a variable. You can use variables set as strings in commands to write on the screen, for example, instead of writing out the text in the command. Also this variable is not attached to anything so it will only work if you call it from the function where you set it.
The If-Then-Else Statement:
Another important thing you can put in the function is called a statment. Statements use logic to do things. One such statemeent if the If-then-else statment modeled here:
What this does is it compares self.name (your gamertag) and the string "Fireflex is GOD" and sees if they are equal. Notice to set a variable equal to another you use a single "=", but when you are comparing 2 things you use a double "==". The If statement checks if the statement 'self.name=="Fireflex is GOD"' is true. If it is, then it will do what is contained within the {} brackets after it. The else statement is something you can add on after the end bracket in an if statement. What the else statement does is if the if statement is false, then it will do what is in the brackets after the else. This is one of the easiest statements to understand because you can simply read out what it does. If (this is true) {do this} else {do this other thing}.
The "==" can be interchanged with other logic statements as follows:
With these statements along with others coming up later you can add my then one thing into the (). By using "and" (&&) or "or" (||) you can have multiple things inside the same if. Here is an example:
So what this says is if (this=this or this=this or this=this) then {do this}. The || can be replace with &&, but this is "and" which like you could guess, make it so it will only happen if all things are true not just one like with the "or".
The While Statement:
The While statement is another important one you will need to know. Here is an example from the Rain Money code.
The while statement is like saying while (this is true) {do this}. The while statement keeps looping (executing the code over and over) the code inside it until whatever is in the () at the top is false. In this example we put simply put a "1" in the (). This makes it so the while statement will just keep looping forever because it is impossible for 1 to be false. False=0 True=1. Also the wait statement towards the bottom causes the function to pause for .05 seconds. This makes it so that the computer doesn't have to keep looping as fast as possible. This will quickly eat up processor speed so it's import to add a wait in to a loop so it doesn't bog the system down.
Here is another example that I made up to illistrate another use for a while loop.
This code first starts in the dowhile() function and then from there starts waitA() along side of it. Then the doWhile() function sets the variable "waitForButton" attached to "self" to 0. The function then goes into the while statement and keeps waiting for .05 seconds until it sees that self.waitForButton is not equal to 0. Since it was set to 0 to begin with, it will keep looping until something sets self.waitForButton to something other than 0. That's where the waitA() function comes in. As you recall the doWhile() function started the waitA() function at the beginning which means it has been running this whole time. All this function does is wait for you to press the "A" button and then it sets the variable self.waitForButton to 1. So there you go this is your outside force changing the variable. Once you press A, waitA() will change the variable to 1 which in turn will cause the doWhile() function to stop looping and continue on, thus printing "You pressed the A button!" on the screen.
Next is a tut by deep3r on how to modify the default.xex.
How To Decompile An XEX in IDA!
Requirements:
XEX Loaders (Xorloser)
IDA 5.2+
XEX File
XEX Tool
XEX modding does take some practice and isn't easy but with a bit of time and research you'll get it done. You'll need to look at it and Learn as much as you can about PPC there is also an Auto-Comment feature in IDA which helps out in looking at mnemonics.
STEP One
First open CMD and follow the directory in which you XEX and XEX Tool is in.
Now you'll need to type the following into CMD make sure your XEX file is default.xex if you're going to copy and paste my example.
STEP Two
Now leave CMD open as the Load address is important when coming to IDA.
Now what you'll need to do is open IDA and open the default.exe file you just created it should be in the same folder as you XEX file. Once you've opened this and it's on a setup kind of screen. Now you'll need to click on Binary. Once you've click on binary change the processor type to PowePc: PPC and click ok and click yes.
STEP Three
Now you're on a screen with Addresses, now in CMD the address if you opened Halo 3 .xex is 0x82000000 you type this into two boxes "Rom start address" and "Loading Address" and now click ok.
Now click file, open and click IDC file and open the default.idc you just created and now it'll ask you would you like to analyze, click yes.
Once this is completed you've successfully opened you XEX into IDA.
Now you'll also need a good idea of PowerPC assembly language to understand how everything works in the XEX without knowing PPC this is almost impossible so I've posted some really nice link to some great tutorials.
Very good basics tutorial:
[ Register or Signin to view external links. ]
Harder:
[ Register or Signin to view external links. ]
Makes the harder tutorial Easier to understand:
[ Register or Signin to view external links. ]
The Default.xex is written in machine code which is hard to understand and modify but if you take the time to read the very good tutorial's on them you should be modifying your default.xex in no time.
The main thing i'd advise you to learn first and foremost is C++:
What is C++?:
C++ (pronounced "See plus plus") is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features. Read more...
What is C++ used for?
For big software projects that require high performances. Most major applications and games are made in C++.
Examples: Photoshop, Firefox, Winamp, Counter Strike...
Short list of C++ compilers:
For Windows:
Borland C++ 5.5
Microsoft Visual C++ Express
DevCPP
For Linux:
G++(contained in GCC which comes preinstalled in most distros)
Intel C++ (free for noncommercial use only)
For Mac OS X:
Apple C++
Xcode
GCC
The following is a list of good and free tutorials on learning C+= that i myself found very useful.
C++ Video tutorials:
This is only the most basic start to get you on the way to bettering yourself at modding and coding which is rather essential in this business. And i take no credit for the first two tutorials i did not write them
Since thetechgame started getting huge as it is to this day, there have been many leech's, noob's or whatever you want to call them, asking stupid question making stupid topics and threads for many questions that may seem very obvious to some.
Well i want to see that stopped. 90% of the posts in this section are to do with MW2 codes's patch's and the likes. What im going to do here is help educate the not so educated into becoming a rather good modder. So let's get started.
The following tut is all thanks to K Brizzle and is a tut on the most basic programming that goes in the patch_mp.ff file. The file is written in the C++ programming language.
Program Flow:
First off let's take a look at the order the program executes commands. Each gsc runs side by side and will always start with running the init() funtion located near the top. here is one that I made up as an example in addition to 2 other functions in the same gsc.
init()
{
self.variable = 100;
self thread doCommands();
self goHere();
}
doCommands()
{
//commands
}
goHere()
{
//commands
}
Alright so the program starts by running the init() function. First it will execute the "self.variable = 100;" line. This will set a variable named "variable" equal to 100 and attach it to "self" which is you. Next it moves to the next line "self thread doCommands();". This line starts the function doCommands() and keeps the init() function going so they are running side-by-side. Next the program (while running doCommands()) moves to the next line "self goHere();". Notice that this line does not have the thread command in the middle. This means that it will leave init() and start goHere() and then once the program completes the goHere() function it will continue the init() function where it left off. Now after going through the init() function we have set self.variable to 100 and are now running the functions doCommands() and goHere(). Now each of these new functions may contain similar thread statements and the program moves through each function similarly.
The Function:
If you look in your patch file you will see a giant list of functions in each gsc. The general form of a function look like this:
function(argument1,argument2,argument3...)
{
//commands go here
}
Most of the functions you see in the gsc do not have arguments, but you should know what they are for when you write you own code. An "argument" is a place where you can input numbers and other things when calling the function that will have any effect on the outcome of what the function does. for example:
init()
{
self thread iniNuke(1,12,20,5);
}
iniNuke( days, hours, minutes, seconds )
{
self endon ( "disconnect" );
self endon ( "death" );
setDvar( "scr_airdrop_nuke", 0 );
setDvar( "scr_nuketimer", days*24*60*60+hours*60*60+minutes*60+seconds );
}
This function iniNuke() is what I use in my patch for initiating nuke variables. You see that the function is called in init(). and has 4 arguments days,hours,minutes, and seconds. The days is 1, the hours is 12, the minutes is 20, and the seconds is 5. Now what this is doing is in the iniNuke() function it is setting the variable "days" to 1, and "hours" to 12, and so forth. Then, later in the function, the variables can be used. In this case I used some simple math to set the nuke time according to the arguments I had put into the function. this line sets the length that the nuketimer will last by setting the Dvar "scr_nuketimer": setDvar( "scr_nuketimer", seconds nuke timer will last );
self endon ( "disconnect" );
self endon ( "death" );
Now this part of the function is what tells the function when to stop. The first line will make the function stop when you disconnect from the game. The second line will end the function when you die. Most functions will need the first line. Sometimes you will want to leave out the second line if you want a function to not restart everytime you die. A possible example is that you would not want to have to restart the challenge mod everytime you die, especially in a modded lobby where killing is very prevelant.
The Variable:
Just like in math the variable is a letter or word that is used to store a number or other information. In this example we are storing some information in to these variables.
self.coolnessLevel = 100;
level.modded = 1;
functionName = "Modded Lobby";
In this example first we set the variable self.coolnessLevel to 100. The "self." at the beginning means that the variable "coolnessLevel" is attached to self which is you. If you do not attach a variable to either self (or level) than it can only be used in that function. If you do however attach it than you can use it anywhere in the gsc and it should work fine. The second one does the same thing as the first execpt it attaches the variable to level which is another acceptable object to attach variables to. The last line sets a normal variable as a "string". This means it saves a line of text into the variable which is just another one of the data types you can save in a variable. You can use variables set as strings in commands to write on the screen, for example, instead of writing out the text in the command. Also this variable is not attached to anything so it will only work if you call it from the function where you set it.
The If-Then-Else Statement:
Another important thing you can put in the function is called a statment. Statements use logic to do things. One such statemeent if the If-then-else statment modeled here:
if (self.name=="Fireflex is GOD") {
self thread iniHost();
} else {
self thread maps\mp\gametypes\_hud_message::hintMessage( "Welcome to K Brizzle's Lobby" );
}
What this does is it compares self.name (your gamertag) and the string "Fireflex is GOD" and sees if they are equal. Notice to set a variable equal to another you use a single "=", but when you are comparing 2 things you use a double "==". The If statement checks if the statement 'self.name=="Fireflex is GOD"' is true. If it is, then it will do what is contained within the {} brackets after it. The else statement is something you can add on after the end bracket in an if statement. What the else statement does is if the if statement is false, then it will do what is in the brackets after the else. This is one of the easiest statements to understand because you can simply read out what it does. If (this is true) {do this} else {do this other thing}.
The "==" can be interchanged with other logic statements as follows:
== //equal to
> //greater than
< //less than
!= //not equal to
With these statements along with others coming up later you can add my then one thing into the (). By using "and" (&&) or "or" (||) you can have multiple things inside the same if. Here is an example:
if (self.name=="Fireflex is GOD" || self.name=="CoreTony" || self.name=="I K Brizzle I") {
self thread iniHost();
} else {
self thread maps\mp\gametypes\_hud_message::hintMessage( "Welcome to K Brizzle's Lobby" );
}
So what this says is if (this=this or this=this or this=this) then {do this}. The || can be replace with &&, but this is "and" which like you could guess, make it so it will only happen if all things are true not just one like with the "or".
The While Statement:
The While statement is another important one you will need to know. Here is an example from the Rain Money code.
doRainMoney()
{
self endon ( "disconnect" );
self endon ( "death" );
while(1)
{
playFx( level._effect["money"], self getTagOrigin( "j_spine4" ) );
wait 0.5;
}
}
The while statement is like saying while (this is true) {do this}. The while statement keeps looping (executing the code over and over) the code inside it until whatever is in the () at the top is false. In this example we put simply put a "1" in the (). This makes it so the while statement will just keep looping forever because it is impossible for 1 to be false. False=0 True=1. Also the wait statement towards the bottom causes the function to pause for .05 seconds. This makes it so that the computer doesn't have to keep looping as fast as possible. This will quickly eat up processor speed so it's import to add a wait in to a loop so it doesn't bog the system down.
Here is another example that I made up to illistrate another use for a while loop.
doWhile()
{
self endon ( "disconnect" );
self endon ( "death" );
self thread waitA();
self.waitForButton = 0;
while(self.waitForButton==0)
{
wait 0.05;
}
self iPrintlnBold( "You pressed the A button!" );
}
waitA()
{
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand( "aButton", "+gostand" );
self waittill( "aButton" );
self.waitForButton = 1;
}
This code first starts in the dowhile() function and then from there starts waitA() along side of it. Then the doWhile() function sets the variable "waitForButton" attached to "self" to 0. The function then goes into the while statement and keeps waiting for .05 seconds until it sees that self.waitForButton is not equal to 0. Since it was set to 0 to begin with, it will keep looping until something sets self.waitForButton to something other than 0. That's where the waitA() function comes in. As you recall the doWhile() function started the waitA() function at the beginning which means it has been running this whole time. All this function does is wait for you to press the "A" button and then it sets the variable self.waitForButton to 1. So there you go this is your outside force changing the variable. Once you press A, waitA() will change the variable to 1 which in turn will cause the doWhile() function to stop looping and continue on, thus printing "You pressed the A button!" on the screen.
Next is a tut by deep3r on how to modify the default.xex.
How To Decompile An XEX in IDA!
Requirements:
XEX Loaders (Xorloser)
IDA 5.2+
XEX File
XEX Tool
XEX modding does take some practice and isn't easy but with a bit of time and research you'll get it done. You'll need to look at it and Learn as much as you can about PPC there is also an Auto-Comment feature in IDA which helps out in looking at mnemonics.
STEP One
First open CMD and follow the directory in which you XEX and XEX Tool is in.
Now you'll need to type the following into CMD make sure your XEX file is default.xex if you're going to copy and paste my example.
xextool -b default.exe -i default.idc default.xex
STEP Two
Now leave CMD open as the Load address is important when coming to IDA.
Now what you'll need to do is open IDA and open the default.exe file you just created it should be in the same folder as you XEX file. Once you've opened this and it's on a setup kind of screen. Now you'll need to click on Binary. Once you've click on binary change the processor type to PowePc: PPC and click ok and click yes.
STEP Three
Now you're on a screen with Addresses, now in CMD the address if you opened Halo 3 .xex is 0x82000000 you type this into two boxes "Rom start address" and "Loading Address" and now click ok.
Now click file, open and click IDC file and open the default.idc you just created and now it'll ask you would you like to analyze, click yes.
Once this is completed you've successfully opened you XEX into IDA.
Now you'll also need a good idea of PowerPC assembly language to understand how everything works in the XEX without knowing PPC this is almost impossible so I've posted some really nice link to some great tutorials.
Very good basics tutorial:
[ Register or Signin to view external links. ]
Harder:
[ Register or Signin to view external links. ]
Makes the harder tutorial Easier to understand:
[ Register or Signin to view external links. ]
The Default.xex is written in machine code which is hard to understand and modify but if you take the time to read the very good tutorial's on them you should be modifying your default.xex in no time.
The main thing i'd advise you to learn first and foremost is C++:
What is C++?:
C++ (pronounced "See plus plus") is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features. Read more...
What is C++ used for?
For big software projects that require high performances. Most major applications and games are made in C++.
Examples: Photoshop, Firefox, Winamp, Counter Strike...
Short list of C++ compilers:
For Windows:
Borland C++ 5.5
Microsoft Visual C++ Express
DevCPP
For Linux:
G++(contained in GCC which comes preinstalled in most distros)
Intel C++ (free for noncommercial use only)
For Mac OS X:
Apple C++
Xcode
GCC
The following is a list of good and free tutorials on learning C+= that i myself found very useful.
C++ Video tutorials:
http://www.youtube.com/antirtfm
http://www.youtube.com/user/reconnetworks
This is only the most basic start to get you on the way to bettering yourself at modding and coding which is rather essential in this business. And i take no credit for the first two tutorials i did not write them
The following 58 users thanked CoNdEmR for this useful post:
BENDZY (08-12-2013), Bladedance (08-04-2013), UCF (08-03-2013), MariahCarey (07-31-2013), Barn (07-08-2013), EG6 (07-01-2013), Greg (06-09-2013), Lewis_Mods (05-12-2013), Seed (04-25-2013), ssd (04-15-2013), Lich (04-14-2013), Adamu (04-11-2013), TuM (04-07-2013), Hypethemodder (01-30-2013), kylethedude (12-19-2012), Larph (10-16-2012), Yoshitsune (08-21-2012), CPR (08-16-2012), xPapa (07-19-2012), xDRxPAINKILLERx (07-19-2012), Marluxia (07-13-2012), Appze (07-04-2012), Insigma (04-21-2012), Linx (03-26-2012), -Rukus (03-08-2012), ANS (02-04-2012), GeehZ (01-26-2012), HUSSIEN323 (01-26-2012), -Vertex- (12-29-2011), -RiddLe (12-06-2011), FameModz (09-02-2011), Matt (08-22-2011), WalidBarakat (08-21-2011), KnownAsGold (07-07-2011), sp0rts (05-11-2011), 5KMods (05-11-2011), Fabel213 (05-01-2011), iPatobo (04-02-2011), chicaritto (03-18-2011), dingdongwill (03-15-2011), CyberSin (03-14-2011), SARG3NT (03-08-2011), Cinnamon (02-20-2011), Jakenavy (01-03-2011), -iTaY (12-13-2010), RaVaGe_LeGenD (11-03-2010), schnipdip (10-31-2010), Secrets (10-16-2010), TTG_TuRKz (10-09-2010), xMrEagle (10-03-2010), Neil (09-20-2010), WCDT- (09-16-2010), NinjaNoFear (09-12-2010), THECARJACKER (09-09-2010), zrueda (09-08-2010), 0141 (09-08-2010), BlackMagik (09-05-2010), Trolling (09-05-2010)
#2. Posted:
Status: Offline
Joined: Dec 22, 200914Year Member
Posts: 2,708
Reputation Power: 126
Status: Offline
Joined: Dec 22, 200914Year Member
Posts: 2,708
Reputation Power: 126
Very confusing, but very good post, I skimmed over it after the first paragraph.
- 56useful
- 2not useful
#3. Posted:
Status: Offline
Joined: Feb 07, 201014Year Member
Posts: 2,622
Reputation Power: 309
Status: Offline
Joined: Feb 07, 201014Year Member
Posts: 2,622
Reputation Power: 309
wow nice long topic will help users out
- 1useful
- 13not useful
#4. Posted:
Status: Offline
Joined: Feb 15, 201014Year Member
Posts: 1,240
Reputation Power: 49
Status: Offline
Joined: Feb 15, 201014Year Member
Posts: 1,240
Reputation Power: 49
This needs a sticky...
- 3useful
- 9not useful
#5. Posted:
Status: Offline
Joined: Apr 30, 201014Year Member
Posts: 4,463
Reputation Power: 228
Status: Offline
Joined: Apr 30, 201014Year Member
Posts: 4,463
Reputation Power: 228
Nice thread this is very usefull for the new members and some members who have difficult in editing a patch.
~Unnknown
~Unnknown
- 3useful
- 8not useful
#6. Posted:
Status: Offline
Joined: Jun 27, 201014Year Member
Posts: 1,021
Reputation Power: 43
Status: Offline
Joined: Jun 27, 201014Year Member
Posts: 1,021
Reputation Power: 43
Good idea man, thiswill help.
- 1useful
- 3not useful
#7. Posted:
Status: Offline
Joined: May 02, 201014Year Member
Posts: 404
Reputation Power: 16
Status: Offline
Joined: May 02, 201014Year Member
Posts: 404
Reputation Power: 16
i haved been waiting fore someone to make this topic
- 1useful
- 4not useful
#8. Posted:
Status: Offline
Joined: May 17, 201014Year Member
Posts: 6,839
Reputation Power: 311
Status: Offline
Joined: May 17, 201014Year Member
Posts: 6,839
Reputation Power: 311
very good post
this should help a lot of people
must of took you aged
this should help a lot of people
must of took you aged
- 1useful
- 3not useful
#9. Posted:
Status: Offline
Joined: Mar 26, 201014Year Member
Posts: 4,793
Reputation Power: 226
Status: Offline
Joined: Mar 26, 201014Year Member
Posts: 4,793
Reputation Power: 226
wow very cofusing dont know computer language looks like a great tut for people that can understand
- 2useful
- 3not useful
#10. Posted:
Status: Offline
Joined: Aug 14, 200915Year Member
Posts: 1,291
Reputation Power: 65
Status: Offline
Joined: Aug 14, 200915Year Member
Posts: 1,291
Reputation Power: 65
Thanks soooooooo much, omg, i no understnd patch coding so much more now. I didnt really understand the self stuff and the self endon ("disconnect"); thanks a bunch
- 1useful
- 7not useful
You are viewing our Forum Archives. To view or take place in current topics click here.