|
You last visited: Today at 23:42
Advertisement
read the names of the characters in delphi
Discussion on read the names of the characters in delphi within the PW Hacks, Bots, Cheats, Exploits forum part of the Perfect World category.
05/07/2012, 05:03
|
#1
|
elite*gold: 0
Join Date: Nov 2010
Posts: 3
Received Thanks: 0
|
read the names of the characters in delphi
function ReadPlayerName (hProcess, data: DWord): string;
var
i, rw: DWord;
ch: WideChar;
wch: array [0 .. 255] of WideChar;
str: string;
begin
i:= 0;
repeat
ReadProcessMemory (hProcess, ptr (data),@ch,2,rw);
data:= data +2;
wch [i]:= ch;
inc (i);
until
(Ord (ch) = 0) or (i>= 255);
i:= 0;
str:='';
repeat
str:= str + wch [i];
inc (i);
until
wch [i]='';
result:= str;
end;
...
var
hp2,hpmax2,mp2,mpmax2,nama: integer;
whp2,whpmax2,wmp2,wmpmax2,nob2,wnama2: dword;
begin
ReadProcessMemory (hProses, Pointer($b29184), @wnama, sizeof
(wnama),***);
//ReadProcessMemory (hProses, Pointer($1c), @wnama, sizeof(wnama),
***);
ReadProcessMemory (hProses, Pointer($34), @wnama, sizeof(wnama),
***);
ReadProcessMemory(hProses, Pointer($638), @nama, sizeof(nama), ***);
label6.Caption:=ReadPlayerName(hproses,wnama);
( I just got a character like this = 깤 ¡)
how to get the character's name correctly
thanks for the help
|
|
|
05/07/2012, 13:26
|
#2
|
elite*gold: 20
Join Date: May 2009
Posts: 1,290
Received Thanks: 326
|
AAhhhh use code tags next time please....
Some things.
First of - I don't think you know what you're doing
You aren't resolving any part of the whole pointer chain - you need to add your prior value to the new offset - that will be the chain. Your code just overwrites each value.
Base + 1C + 34 + 638 + 0
Then - I think you where thinking the right way, but kind of messed up  Yes, Widestring is two bytes, so you need to read two bytes of memory - but this x length!
A better/much simpler way of doing this would be the following ( 1:1 copy from my bot) :
Code:
function THostchar.Name: String;
var
eax, written, Base: cardinal;
TName : array [0..49] of widechar;
begin
ReadProcessMemory(Self.Handle, ptr(self.Offsets.Addresses_base_Address), @eax, 4, written);
ReadProcessMemory(Self.Handle, ptr(eax + $1C), @eax, 4, written);
ReadProcessMemory(Self.Handle, ptr(eax + self.Offsets.Structural_Character), @eax, 4, written);
ReadProcessMemory(Self.Handle, ptr(eax + self.Offsets.Character_Name), @eax, 4, written);
ReadProcessMemory(Self.Handle, ptr(eax), @Tname, 100, written);
Result := WideCharToString(TName);
end;
And even 50 characters is overkill, but 256!? Who has that long of a name
So, copy 100 bytes of data into an array of WideChar(you where correct there), then just cast this into a string - quite simple, you where thinking too complex I think
Cheers
|
|
|
05/08/2012, 11:58
|
#3
|
elite*gold: 0
Join Date: Nov 2010
Posts: 3
Received Thanks: 0
|
Quote:
Originally Posted by Sᴡoosh
AAhhhh use code tags next time please....
Some things.
First of - I don't think you know what you're doing
You aren't resolving any part of the whole pointer chain - you need to add your prior value to the new offset - that will be the chain. Your code just overwrites each value.
Base + 1C + 34 + 638 + 0
Then - I think you where thinking the right way, but kind of messed up  Yes, Widestring is two bytes, so you need to read two bytes of memory - but this x length!
A better/much simpler way of doing this would be the following ( 1:1 copy from my bot) :
Code:
function THostchar.Name: String;
var
eax, written, Base: cardinal;
TName : array [0..49] of widechar;
begin
ReadProcessMemory(Self.Handle, ptr(self.Offsets.Addresses_base_Address), @eax, 4, written);
ReadProcessMemory(Self.Handle, ptr(eax + $1C), @eax, 4, written);
ReadProcessMemory(Self.Handle, ptr(eax + self.Offsets.Structural_Character), @eax, 4, written);
ReadProcessMemory(Self.Handle, ptr(eax + self.Offsets.Character_Name), @eax, 4, written);
ReadProcessMemory(Self.Handle, ptr(eax), @Tname, 100, written);
Result := WideCharToString(TName);
end;
And even 50 characters is overkill, but 256!? Who has that long of a name
So, copy 100 bytes of data into an array of WideChar(you where correct there), then just cast this into a string - quite simple, you where thinking too complex I think
Cheers
|
thanks, it worked
|
|
|
05/08/2012, 17:53
|
#4
|
elite*gold: 0
Join Date: May 2010
Posts: 220
Received Thanks: 203
|
4 times memory read for 1 name ?
or did i miss something, im not familiar with delphi
Quote:
;autoit 
Global $NAME = _MemoryRead(_MemoryRead($CHAR_DATA_BASE + $OFFSET_NAME, $PROCESS_INFORMATION), $PROCESS_INFORMATION, 'wchar[30]')
|
2 memory read should do the same, or ?
|
|
|
05/08/2012, 19:02
|
#5
|
elite*gold: 20
Join Date: May 2009
Posts: 1,290
Received Thanks: 326
|
Quote:
Originally Posted by amineurin
4 times memory read for 1 name ?
or did i miss something, im not familiar with delphi
2 memory read should do the same, or ?
|
The process of reading game's memory is language independant - offset chains need to be traversed anyways.
And about your script :
$CHAR_DATA_BASE needs to be populated somewhere to, hm?  So there's your other two (three if you use "real" base) memory reads.
|
|
|
05/08/2012, 21:48
|
#6
|
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
|
Quote:
Originally Posted by Sᴡoosh
The process of reading game's memory is language independant - offset chains need to be traversed anyways.
And about your script :
$CHAR_DATA_BASE needs to be populated somewhere to, hm?  So there's your other two (three if you use "real" base) memory reads.
|
As far as I know the player pointer should remain constant at least until you log out. So it is possible to save on some memory reading there. It's prolly not really much improvement, but in theory it could be. I personally don't bother with it since it's all premature optimization, but some find great pleasure in optimizing stuff like that
|
|
|
05/08/2012, 22:40
|
#7
|
elite*gold: 20
Join Date: May 2009
Posts: 1,290
Received Thanks: 326
|
Yeah, that's stuff which people won't even notice if you optimize. Some people don't stop bot while switching characters, for whatever reason, so this is the safest way to go in my opinion.
Yepp, we all know somebody who is a crazy optimizator.
*Looking at someone specifically*
|
|
|
05/09/2012, 00:39
|
#8
|
elite*gold: 10
Join Date: Sep 2010
Posts: 400
Received Thanks: 234
|
Can't be me... I barely ever finish anything, let alone optimise it lol
|
|
|
05/09/2012, 11:55
|
#9
|
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
|
Quote:
Originally Posted by dumbfck
Can't be me... I barely ever finish anything, let alone optimise it lol 
|
lmao, I know that feeling
Optimizing is overrated, at least with small programs like bots
|
|
|
05/10/2012, 07:02
|
#10
|
elite*gold: 0
Join Date: Nov 2010
Posts: 3
Received Thanks: 0
|
Now I have a problem, how to get target name ?
|
|
|
05/10/2012, 09:48
|
#11
|
elite*gold: 20
Join Date: May 2009
Posts: 1,290
Received Thanks: 326
|
Read monster array, get WID of closest named monster, and target that. Sorry, no source this time, others will need to decide about posting theirs - I still want to sell stuff
|
|
|
05/10/2012, 10:14
|
#12
|
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
|
Quote:
Originally Posted by kilua_xxxx
Now I have a problem, how to get target name ?
|
get your current targetId from your player struct and compare that to the ids of the mobs around you.
|
|
|
 |
Similar Threads
|
WTB - All Characters 101+ [READ]
06/30/2011 - Silkroad Online Trading - 27 Replies
Hello everyone, I'm glad to make this thread containing my need of a few characters level 101+
I don't care about what server
I don't care about what build
It MUST have a decent set & wep.
MUST come with gold (300M Minimum)
MUST be ISRO
------------------------------------------------- ----------------------------
Leave your offer's below, or add me to msn, or send a PM to me on Elitepvpers!
|
[Gracia] WTS High Lvl Characters + Infinity in Kark [READ]
08/19/2010 - Archlord Trading - 2 Replies
Hi everyone, Im quitting the game so im selling everything!!!! Ive played for a very long time but I guess I just got bored of everything and definately spent wayyyyyy to much money. Selling all for Paypal Money Transfer Only! That means no tradeing characters or anything... Also Must be verified. So here it goes...
:rolleyes: ALL CHARACTERS ARE ON SEPERATE ACCOUNTS:rolleyes:
Infinity in Kark I refuse to spend anymore money on this game so you must have...
|
Selling Account with 50+ Characters on it, +++++Read for info+++++
12/10/2008 - Trading - 8 Replies
Hi,
I would sell these to [email protected] but he doesnt want them right now, so, decided to sell here for only 5$ USD for 1 lvl 50.. any char, u name it, pm me your msn adress..
68 Segita *Sold
57 Segita
63 Segita *Sold
61 Segnale *Sold
69 Segnale *Sold
63 Segnale *Sold
|
Names with foreign characters
03/08/2008 - Cabal Online - 2 Replies
Is it possible to use CE to make my character's name with foreign characters? If so, how do i do it?
|
All times are GMT +1. The time now is 23:42.
|
|