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

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 85

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
Tibia.Dat file reader consuming ~75kb in RAM?
Results 1 to 9 of 9

Thread: Tibia.Dat file reader consuming ~75kb in RAM?

  1. #1
    Senior Member
    Join Date
    Oct 2010
    Posts
    146

    Tibia.Dat file reader consuming ~75kb in RAM?

    Sup guys, Puterin here again xD
    I was trying to mitigate lag problems of the bot I'm coding and found out where it was consuming that much...
    When the Dat_Reader is off (commented) the process is like 6kb; but if I turn it on (not commented xD) the procces will be almost 82kb!!
    Is this normal? keep in mind that I'm reading the .dat file, not in tibia's memory... Is this happening to everyone? if not, what would be the normal "kb" it should consume?

    Thanks!

    @Edited:
    btw, If anybody wanna check the .dat reader I use is in here http://pastebin.com/RnusJVHP , forgot I had uploaded 1 month ago to ask something else here =)
    Last edited by Puterin; 04-13-2013 at 01:17 PM.

  2. #2
    Senior Member
    Join Date
    Jan 2012
    Posts
    417
    I just see no reason to keep the .dat file loaded into your app holding a huge amount of memory, when you can read an specific item of the .dat file in a few steps that doesn't require any searching through an array.

    You can check http://tpforums.org/forum/threads/52...ory-DataReader to see how to read an specific item.

  3. #3
    Senior Member
    Join Date
    Oct 2010
    Posts
    146
    Quote Originally Posted by Blequi View Post
    I just see no reason to keep the .dat file loaded into your app holding a huge amount of memory, when you can read an specific item of the .dat file in a few steps that doesn't require any searching through an array.

    You can check http://tpforums.org/forum/threads/52...ory-DataReader to see how to read an specific item.
    mmm, you are right, didn't see it that way :/
    but one question please, I have read that thread entirely, and also spent a couple of hours reading threads in this forum.
    After that I decided to do it your way, and I was going to use that thread you sent me, but also the TibiaAPI which Jash recommended in another post.https://code.google.com/p/tibiaapi/s...emAddresses.cs
    And they are not the same! =0

    I think this is because in your URL they used
    PHP Code:
    const
      
    DatPointer = $7B973C;
      
    StepItems 136;  //<------only StepITems
      
    FlagsOffset 68;  //<------only Flags, nothing more 
    while in TibiaAPI they used everything
    PHP Code:
            public class DatItemAddresses
            
    {
                public 
    uint StepItems//<------ StepITems
                
    public uint Width;
                public 
    uint Height;
                public 
    uint MaxSizeInPixels;
                public 
    uint Layers;
                public 
    uint PatternX;
                public 
    uint PatternY;
                public 
    uint PatternDepth;
                public 
    uint Phase;
                public 
    uint Sprite;
                public 
    uint Flags//<------Flags
                
    public uint CanEquip;
                public 
    uint CanLookAt;
                public 
    uint WalkSpeed;
                public 
    uint TextLimit;
                public 
    uint LightRadius;
                public 
    uint LightColor;
                public 
    uint ShiftX;
                public 
    uint ShiftY;
                public 
    uint WalkHeight;
                public 
    uint Automap
                public 
    uint LensHelp;
                public 
    uint ClothSlot;
                public 
    uint MarketCategory;
                public 
    uint MarketTradeAs;
                public 
    uint MarketShowAs;
                public 
    uint MarketName;
                public 
    uint MarketRestrictProfession;
                public 
    uint MarketRestrictLevel
    is all of that really needed?
    yes--> for what?

    ty Blequi =)

  4. #4
    Senior Member
    Join Date
    Jan 2012
    Posts
    417
    keep in mind that TibiaApi is a general purpose library and many contributors have helped the project since it was created.

    For example, for 99% of the tibia bots dev in this forum, the constants you posted above
    Code:
    const
      DatPointer = $7B973C;
      StepItems = 136;  //<------only StepITems
      FlagsOffset = 68;
    are enough for their purpose with their own bots, but I personally use, at least, 90% + of these constants in the datitem class.

    As an example, if you want to perfect draw each tibia sprite (as I do), you'll need several of them. On the other hand, if you do not custom draw items, hardly you'll find an use for half of these offsets (mainly the first ones).

  5. #5
    Senior Member
    Join Date
    Oct 2010
    Posts
    146
    okey dokey, got ya. I'm gonna add now the memory .dat reader, I'll post here results (comparing kb in RAM or %CPU usage) once I have finished.

  6. #6
    Senior Member
    Join Date
    Apr 2008
    Posts
    689
    you will save a good ammount of memory if you keep the flags as uint/long

  7. #7
    Senior Member
    Join Date
    Oct 2010
    Posts
    146
    Quote Originally Posted by Farsa View Post
    you will save a good ammount of memory if you keep the flags as uint/long
    done, thanks for the tip Farsa. (idk why but every single time I'm going to write your name I write "Farse" xDDDD)

    didn't post this before due to a fcking bug in my code.... I've been the whole afternoon/night trying to fix it and like 30 min ago I found the problem...
    Anyway, here are the pics, check them by yourself :O

    with Tibia.dat parser


    with Klusbert's function


    It really is an incredible change, but now it has to read_memory() each time it wants a flag/name of an item cause it doesn't have them loaded (so it does make sense xD)

    I tried with some ID's like brown mushroom, crystal wand, scarf, stamped parcel,etc... and found them,
    buuuut, when I tried with Gold/Platinum/crystal Coin(3031,3035,30XX) it didn't work! :O it read "unknown", what could be the reason if the others were right?

    @Edited:
    loooool, just checked out that those items doesn't exist, or at least the names.... and in one post of Blequi in the thread "Memory Data Reader", those id's aren't in that list of items =0
    why is that?
    Last edited by Puterin; 04-14-2013 at 01:24 AM.

  8. #8
    Member Diego's Avatar
    Join Date
    Mar 2012
    Location
    México
    Posts
    79
    Only the names listed in the market has a name flag, and valuable items for obvious reason are not included.
    TibiaViewer taking AFK botting to a whole different level Sign up!.

  9. #9
    Senior Member
    Join Date
    Oct 2010
    Posts
    146
    Quote Originally Posted by Diego View Post
    Only the names listed in the market has a name flag, and valuable items for obvious reason are not included.
    looool that's why!!
    kkk LOTS of thx guys, solved =)

Posting Permissions

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