Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
How to get logged character's name?
Results 1 to 7 of 7

Thread: How to get logged character's name?

  1. #1
    Junior Member
    Join Date
    Aug 2013
    Posts
    6

    How to get logged character's name?

    Someone can help me? Thanks!

  2. #2
    Senior Member
    Join Date
    Mar 2009
    Location
    Brazil
    Posts
    266
    Hello, Yucks.

    How much you know about memory reading?
    Last edited by Ash Katchup; 08-17-2013 at 05:54 PM.

  3. #3
    Junior Member
    Join Date
    Aug 2013
    Posts
    6
    Hello, thanks for answer, I'm newbie on that to create bots for Tibia, but I Know Delphi language, for now I've been helping myself with CheatEngine to retrieve the addresses where keeps the name of the char online, but can not find ...

    I have this:

    Code:
    function TfrmMain.GetCharName():string;
    var
    name : string;
    begin
        Offset := Integer(GetTibiaBaseAddress(ProcessID));
        name := ReadString(CharName  + Offset);
        Result := 'Char Name: ' + name;
    end;
    Where CharName is the address of Char who is Online.

  4. #4
    Using cheat engine, search "charlist selected index" and "charlist names"...
    With a few calculations you can retrieve the character name...

    Code:
    const
      LoginList_Selected  = $????????; // index
      LoginList_Address   = $????????; // start of charlist structure
      LoginList_Length    = $????????; // char count
      LoginList_Dist      = 84; // distance in memory between each char in charlist
      LoginList_DistName = 0;  
      LoginList_DistWorld = 30;
    
    function getName:string;
    var
      pointer, selected:Integer;
    begin
      pointer := ReadMemInt( LoginList_Address );
      selected := ReadMemInt( LoginList_Selected );
      pointer := pointer + ( selected * LoginList_Dist );
      Result := ReadMemStr( pointer + LoginList_DistName );
    end;
    
    function getWorld:string;
    var
      pointer, selected:Integer;
    begin
      pointer := ReadMemInt( LoginList_Address );
      selected := ReadMemInt( LoginList_Selected );
      pointer := pointer + ( selected * LoginList_Dist );
      Result := ReadMemStr( pointer + LoginList_DistWorld );
    end;
    Ps.: This is for older versions... In the newest I think you need to calculate base address + xor and fix address and offsets...

  5. #5
    Senior Member
    Join Date
    Sep 2007
    Posts
    230
    If you are working with the newest Tibia version your character's name, when logged in, is added to the client's window title in the format of "Tibia - Character Name". So you can just use GetWindowText to get the title and then sub string the character name out.

  6. #6
    Junior Member
    Join Date
    Aug 2013
    Posts
    6
    Yes, I've made another function as you say Sketchy, taking name from window title:

    Code:
    function TfrmMain.GetCharName():string;
    var
      liLength : Integer;
      lpChar : PChar;
      name : string;
    begin
      liLength := GetWindowTextLength(TibiaH) + 1;
      lpChar := StrAlloc(liLength);
      Try
        GetWindowText(TibiaH, lpChar, liLength);
        Result:=fGen.MidStr(lpChar,9,Length(lpChar)-8);
      Finally
        StrDispose(lpChar);
      End;
    end;
    Quote Originally Posted by Blood View Post
    Using cheat engine, search "charlist selected index" and "charlist names"...
    With a few calculations you can retrieve the character name...

    Code:
    const
      LoginList_Selected  = $????????; // index
      LoginList_Address   = $????????; // start of charlist structure
      LoginList_Length    = $????????; // char count
      LoginList_Dist      = 84; // distance in memory between each char in charlist
      LoginList_DistName = 0;  
      LoginList_DistWorld = 30;
    
    function getName:string;
    var
      pointer, selected:Integer;
    begin
      pointer := ReadMemInt( LoginList_Address );
      selected := ReadMemInt( LoginList_Selected );
      pointer := pointer + ( selected * LoginList_Dist );
      Result := ReadMemStr( pointer + LoginList_DistName );
    end;
    
    function getWorld:string;
    var
      pointer, selected:Integer;
    begin
      pointer := ReadMemInt( LoginList_Address );
      selected := ReadMemInt( LoginList_Selected );
      pointer := pointer + ( selected * LoginList_Dist );
      Result := ReadMemStr( pointer + LoginList_DistWorld );
    end;
    Ps.: This is for older versions... In the newest I think you need to calculate base address + xor and fix address and offsets...
    Thank you Blood.

  7. #7
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725
    Quote Originally Posted by yucks View Post
    Yes, I've made another function as you say Sketchy, taking name from window title:

    Code:
    function TfrmMain.GetCharName():string;
    var
      liLength : Integer;
      lpChar : PChar;
      name : string;
    begin
      liLength := GetWindowTextLength(TibiaH) + 1;
      lpChar := StrAlloc(liLength);
      Try
        GetWindowText(TibiaH, lpChar, liLength);
        Result:=fGen.MidStr(lpChar,9,Length(lpChar)-8);
      Finally
        StrDispose(lpChar);
      End;
    end;


    Thank you Blood.
    The way I normally go about it (in case you were interested) is by reading the battle list until one of the results returns a null string, then evaluate the list to find one which has my CID, if I find one, I'm logged in and my name is at the offset of the CID for that creature in the battle list + 0x4 bytes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •