Raised This Month: $ Target: $400
 0% 

StringTable Dumper


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 10-30-2014 , 20:51   StringTable Dumper
Reply With Quote #1

I've found myself needing to analyze the stringtables a few times, so I wrote a stringtable dumper each time. I realized that this was pretty dumb to keep rewriting it so here it is. Mostly for myself for future reference, but feel free to use it for whatever.

PHP Code:
#include <sourcemod>
#include <sdktools>

public OnMapStart() {
    new 
Handle:file OpenFile("stringtables.txt""w");
    new 
num GetNumStringTables();
    
decl String:name[32], String:str[256];
    for(new 
0numi++) {
        
GetStringTableName(inamesizeof(name));
        new 
size GetStringTableNumStrings(i);
        
WriteFileLine(file"[%d] %s [%d/%d]"inamesizeGetStringTableMaxStrings(i));
        for(new 
0sizej++) {
            
ReadStringTable(ijstrsizeof(str));
            
WriteFileLine(file"\t[%d] %s"jstr);
            
            new 
length GetStringTableDataLength(ij);
            if(
length 0) {
                
decl String:data[length 1];
                
GetStringTableData(ijdatalength 1);
                
WriteFileLine(file"\t\t%s"data);
            }
        }
    }
    
    
CloseHandle(file);

__________________
Dr. McKay is offline
psychonic

BAFFLED
Join Date: May 2008
Old 10-30-2014 , 20:53   Re: StringTable Dumper
Reply With Quote #2

con_logfile stringtables.txt
dumpstringtables
con_logfile ""
psychonic is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 10-30-2014 , 20:55   Re: StringTable Dumper
Reply With Quote #3

Quote:
Originally Posted by psychonic View Post
con_logfile stringtables.txt
dumpstringtables
con_logfile ""
Doesn't include any data associated with any strings.
__________________
Dr. McKay is offline
psychonic

BAFFLED
Join Date: May 2008
Old 10-30-2014 , 23:19   Re: StringTable Dumper
Reply With Quote #4

Quote:
Originally Posted by Dr. McKay View Post
Doesn't include any data associated with any strings.
Because some tables use binary data, rather than printable string data.

Last edited by psychonic; 10-30-2014 at 23:19.
psychonic is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-31-2014 , 15:42   Re: StringTable Dumper
Reply With Quote #5

Quote:
Originally Posted by psychonic View Post
con_logfile stringtables.txt
dumpstringtables
con_logfile ""
It's been a few months since I tried it, but last I recal con_logfile "" will toss an error at you on TF2.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode