MMORPG BOT

Discussions Related to Game Hacking and Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

MMORPG BOT

Postby Torero » Thu Jan 04, 2007 10:30 am

Oh yes。

The very thing everybody wants in a MMORPG is to be UBER.


In any MMOs, the primary challenge, for a single player, is to acquire help from other players.

That takes a lot of time; that's a lot of hassle and the process is so time-consuming a lot of people call it the essese of MMORPGS.
Last edited by Torero on Fri Apr 06, 2007 2:44 am, edited 1 time in total.
Torero
NULL
 
Posts: 191
Joined: Thu Jan 04, 2007 10:14 am

Postby Torero » Thu Jan 04, 2007 10:35 am

I want to take this so called Bot to the next level however.
Last edited by Torero on Fri Apr 06, 2007 2:44 am, edited 1 time in total.
Torero
NULL
 
Posts: 191
Joined: Thu Jan 04, 2007 10:14 am

Postby L. Spiro » Thu Jan 04, 2007 12:24 pm

I have posted a tutorial on how to do this (using keyboard input to control your game.

Tutorial

This is a simple script that you can copy and paste into your own scripts and test.
Then modify as you desire to manipulate your own games.

Note the use of “extern” values so you don’t have to export files or use complicated ReadProcessMemory() sets to get the data from your game.


This will do everything you want and you can modify it at any time in the future as your needs grow.

You will need Demo #6 (posted in the General Related Discussions forums).


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby Torero » Thu Jan 04, 2007 9:52 pm

For me, though, I play my MMORPG on 3 computers, and I have to do that because 3 games can't be run on the same computer.

The problem arises: I want to be able to play as many MMO characters simultaneously at the same time, and I want all the characters run by Bot to collaborate.

I want them to work together, therefore, I need the values obtained sent off to a central Bot AI to computer next moves, and then send the instructions by to right computers.

Yeah, I am asking for that function even before I finish the Minesweeper tutorial :lol:
Torero
NULL
 
Posts: 191
Joined: Thu Jan 04, 2007 10:14 am

Postby Torero » Thu Jan 04, 2007 9:54 pm

I think it can be done this way:

the LSS.exe can export values to a .txt file every 50 ms, and then I ll figure out a way to send them to the central AI, for now I ll call it 192.168.1.1 (the AI computer on my LAN)
:oops:
Torero
NULL
 
Posts: 191
Joined: Thu Jan 04, 2007 10:14 am

Postby Torero » Thu Jan 04, 2007 10:28 pm

Decode The Mine Array
This is quite simple and doesn’t even need its own section.
After playing with things a bit, you will find that mines have the highest bit set (they appear as values 0x80 and above in the Hex Editor).
In other words, if ([Square] & 0x80) returns non-zero, there is a mine there, and we don’t want to click it.




I am such a noob I don't know understand this part.
Is it possible for you to elaborate a little?

How do I find the array and how to check ([Square] & 0x80) ?
Torero
NULL
 
Posts: 191
Joined: Thu Jan 04, 2007 10:14 am

Postby Torero » Fri Jan 05, 2007 1:54 am

Ok, I am so noob at programming, and should I actually lean LSS, that would be my first programming language :lol:


Well, I had Programming 101 at my college just to satisfy my degree requirement, so I can read this:






VOID SolveMinesweeperBoard() {
HWND hWnd = FindWindow( "Minesweeper" );
if ( !hWnd ) { return; }

// Put the Minesweeper board in front if possible.
ShowWindowAsync( hWnd, SW_SHOW );
SetForegroundWindow( hWnd );

// Get its position.
INT iX;
INT iY;
GetWindowPos( hWnd, &iX, &iY );
PrintF( "Minesweeper board located at %d %d.", iX, iY );
if ( iX < 0 || iY < 0 ) {
PrintF( "Minesweeper board is out of range!" );
return;
}


extern struct BOARDSIZE {
INT iWidth;
INT iHeight;
} e_bwSize = { "winmine.exe", 0x5334 }; // The width and height of the board.
extern BYTE e_pbBoard[32*32] = { "winmine.exe", 0x5361 }; // The board array itself.
// Note that 32*32 here is meaningless, except to show us how
// large the array is in the target process (it does not actually
// declare the array in the target process; it already exists).




POINT pClick;
// To calculate the final click positions we need the screen
// resolution.
INT iScreenW = GetPrimScreenWidth();
INT iScreenH = GetPrimScreenHeight();

// System settings change the location of mines on the board, so
// get the settings needed to know where to click.
INT iBorderHeight = GetSystemMetrics( SM_CYEDGE ); // Window border (height).
INT iCaptionHeight = GetSystemMetrics( SM_CYCAPTION ); // Title bar height.
INT iMenuHeight = GetSystemMetrics( SM_CYMENU ); // Menu height.
INT iFinalYOffset = iBorderHeight + iCaptionHeight + iMenuHeight;
INT iFinalXOffset = GetSystemMetrics( SM_CXEDGE ); // Window border (width).

// Save the externs to locals. This makes it faster to scan the
// board.
INT iBoardWidth = e_bwSize.iWidth;
INT iBoardHeight = e_bwSize.iHeight;

// Run through the board and click on each square that has no mine.
for ( INT J = 0; J < iBoardHeight; J++ ) {
for ( INT I = 0; I < iBoardWidth; I++ ) {
if ( (e_pbBoard[(32*J)+I] & 0x80) == 0 ) {
GetClickPos( iFinalXOffset, iFinalYOffset, iX, iY, &pClick, I, J );
// Translate the click position into the actual screen coordinates (Windows® forces us to do this).
pClick.x = pClick.x * 65535.0f / iScreenW;
pClick.y = pClick.y * 65535.0f / iScreenH;

// Move there.
MouseEvent( MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
pClick.x, pClick.y,
0 );

// Click there (down and up).
MouseEvent( MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN,
0, 0, // X and Y positions aren’t used.
0 );
MouseEvent( MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP,
0, 0,
0 );

// Optionally sleep for a bit in case you like to see the action unfold.
//Sleep( 10 );
}
}
}

}

// Constants that tell us the dimensions of the board.
const INT iSquareSize = 16;
const INT iXOff = 14;
const INT iYOff = 56;
const INT iFinalX = iXOff + (iSquareSize / 2);
const INT iFinalY = iYOff + (iSquareSize / 2);
VOID GetClickPos( INT iScreenOffX, INT iScreenOffY, INT iPosX, INT iPosY, POINT * ppRet, INT iX, INT iY ) {
// The window is at (iPosX, iPosY). From there, go to the corner of the board
// and then offset based on which square we are hitting.
ppRet->x = iPosX + iX * iSquareSize + iFinalX + iScreenOffX;
ppRet->y = iPosY + iY * iSquareSize + iFinalY + iScreenOffY;
}







my question is, though, can I learn LSS without know C first?
Torero
NULL
 
Posts: 191
Joined: Thu Jan 04, 2007 10:14 am

Postby Torero » Fri Jan 05, 2007 4:05 am

There is a part I don't understand


extern struct BOARDSIZE {
INT iWidth;
INT iHeight;
} e_bwSize = { "winmine.exe", 0x5334 }; // The width and height of the board.
extern BYTE e_pbBoard[32*32] = { "winmine.exe", 0x5361 }; // The board array itself.
// Note that 32*32 here is meaningless, except to show us how
// large the array is in the target process (it does not actually
// declare the array in the target process; it already exists).







Does it tell the HMS to scan values or to read from the table of locked values?

This is what I need to write:

I figured the bot should start out getting a local array and then use pre-defined terms to locate addresses of wanted values, since manually scanning for 15 variables related to a single character is just bad design.

So I need to pre-define terms somehow.

Aside from infomation related to the character itself, the bot also has to scan for nearby enemies.

Although interesting problem comes into play: Is the bot going to be aware of situations supposedly unseen from, say, the front of the character, or am I going to allow the bot to know its surrunding more than it really should know.


L. Spiro, Do you have a sample of the code that updates local variables from the table of found values?

That would be very useful
Torero
NULL
 
Posts: 191
Joined: Thu Jan 04, 2007 10:14 am

Postby L. Spiro » Fri Jan 05, 2007 6:01 pm

Torero wrote:I am such a noob I don't know understand this part.
Is it possible for you to elaborate a little?

How do I find the array and how to check ([Square] & 0x80) ?

It is not code, it is just the concept (with code used to make the concept clearer).
“[Square]” means “the value of the square you want to check”, which, as you can see in the actual code, is e_pbBoard[(32*J)+I].
0x80, in binary, is 10000000, which means the highest bit is set (the 1).
This is how we check if there is a mine. No explanation will be any good unless you actually know how to program.





Torero wrote:my question is, though, can I learn LSS without know C first?

Probably not. L. Spiro Script is C plus some advanced features (extern).

However with both C and L. Spiro Script you can get away with only learning what you need, at least at the start.

You typically don’t need to know “advanced” operators such as &, |, ^, etc., and you probably don’t need to know much about pointers.

But what you don’t know will prove to be your limitations and what you are willing to learn will prove your determination.




Torero wrote:Does it tell the HMS to scan values or to read from the table of locked values?

Neither.
As per the documentation, “extern” variables are variables that are declared inside the target process rather than inside your own script, or inside MHS.exe.
This is an advancement over C and is a new concept as far as programming languages go.
Normally, you will declare variables that are local inside your script or inside your program. In all other languages, all variables are stored within the RAM of the actual process that was created.

“extern” variables are exactly the same as any other variables, except they are not in your own process. They are in another process running on your computer.



Read the code more carefully and you will see how e_bwSize and e_pbBoard are being used just like any other variable.

So they are not being read from any list or to scan for anything.
If you read from the variable, the value is obtained from the target process instead of your own.
If you write to the variable, the value will be written in the target process instead of your own.



Understanding this concept fluently is key to getting the most power from your bots.

In the past, people have had to read from the target process by using ReadProcessMemory() which was a real pain in the ass.
You would have to create a local buffer and read into it, then use it after that, and following pointers in the target meant creating many buffers and many function calls and many if/else blocks.
Now, all of that can be done in one command (even “e_pbBoard[(32*J)+I]” itself removes tons of work from the old days).




To accomplish your goal, you need to know how to program no matter what.
Once you know how to program, you will find it is much easier to use L. Spiro Script rather than starting your own project from scratch.

Firstly, you don’t have to make an application that can latch onto the target process; there is already one there for you.
Secondly, “extern” variables (and functions) will prove to be sent from the heavens when you are trying to process data in the target process for whatever you are doing all along your project.





Conceptually speaking, your bot will be simple.
It can easily read data from the game(s), so from there you simply need to run through the enemies and find the closest one.
Use the existing examples to see how to send mouse and button presses to move your character.




Torero wrote:L. Spiro, Do you have a sample of the code that updates local variables from the table of found values?

That would be very useful

Snippets and Examples
Go to the “SetResultsTo0()” function near the bottom.


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan


Return to General Related Discussions

Who is online

Users browsing this forum: No registered users and 0 guests