Getting the Area name menu

User Tag List

Results 1 to 6 of 6
  1. #1
    Chumbax's Avatar Private
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting the Area name

    I've been trying to get the area name, but with some problems.

    This returns the correct value if the "name" is long enought
    Code:
    Memory.ReadString(0x180437c + 0x29, 100);
    But if the Area name is "Stonefort" it reads the "old" value togheter with the new.
    "Stonefort Level 1" etc.

    How do I make it so that it only reads the "current" area and don't apply the old togheter with the new?
    Greetings

    Getting the Area name
  2. #2
    enigma32's Avatar Legendary
    Reputation
    912
    Join Date
    Jan 2013
    Posts
    551
    Thanks G/R
    4/738
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How is the ReadString method implemented? Keep in mind it probably is a null-terminated string that you are trying to read. Anything after, (and including '\0' depending on language) is junk and is not considered valid data.

  3. #3
    Chumbax's Avatar Private
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its Loot Alert source. Do I check in ReadString if its the value is null ?

    Code:
      public string ReadString(int addr, int length, bool ascii = true)
            {
                if (ascii == false)
                    return Encoding.Unicode.GetString(ReadMem(addr, length));
                return Encoding.ASCII.GetString(ReadMem(addr, length));
            }

  4. #4
    enigma32's Avatar Legendary
    Reputation
    912
    Join Date
    Jan 2013
    Posts
    551
    Thanks G/R
    4/738
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's how I convert bytes into a string:
    Code:
    private string ReadString(byte[] buffer, int offset, int length)
    {
        return Encoding.ASCII.GetString(
            buffer,
            offset,
            length)
            .Split('\0')[0];
    }
    Note how I split the string on all '\0' (null) chars, then just take the first part.

  5. #5
    Chumbax's Avatar Private
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by enigma32 View Post
    Here's how I convert bytes into a string:
    Code:
    private string ReadString(byte[] buffer, int offset, int length)
    {
        return Encoding.ASCII.GetString(
            buffer,
            offset,
            length)
            .Split('\0')[0];
    }
    Note how I split the string on all '\0' (null) chars, then just take the first part.
    Works like a charm, but I had to get the index at 5 instead of 0. Thanks Enigma32

  6. #6
    enigma32's Avatar Legendary
    Reputation
    912
    Join Date
    Jan 2013
    Posts
    551
    Thanks G/R
    4/738
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're welcome

    And, that's because the address or offset isn't quite right.
    Example of what is read:
    Code:
    "\0\0\0Bastion's Keep Stronghold\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
    As you can (hopefully) see the address should start 3 bytes later.

    Not sure why you get it to work at index 5 though since for me I get index 3 (0,1,2 contains '\0'),
    I'd say the correct address is "0x180437c + 0x2c".

Similar Threads

  1. I need to get the last name to an account.
    By mudfish in forum World of Warcraft General
    Replies: 1
    Last Post: 07-04-2008, 03:45 AM
All times are GMT -5. The time now is 07:41 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search